Closed pshem closed 5 years ago
Dependency resolution was hacked together by monitoring sys.modules
. Due to how this fails to distinguish between default and extra modules, unittest should now be included if any module uses it, obsoleting the manual override for numpy. The GET script still doesn't expose a way for users to pass Python modules as part of the compilation process.
Besides, python3 still includes sqlite3 which doesn't work(It is compiled to use mremap by default) . Should I filter it from the image, since it doesn't work anyway?
@wkozaczuk since you were the one who added this python3 module, can you please review this pull request?
@pshem Thanks for the patch. I am going to review and test it soon. Which Linux distribution have you been testing it against? I know that Python installation in Fedora and Ubuntu is somewhat different.
I used Ubuntu 18.04. I didn't test on Fedora
This is embarrassing, but it seems like the changes in https://github.com/cloudius-systems/osv-apps/pull/61/commits/8848e8117d07f0fdce54b5462d19e3b99e3b24e3, which worked so nice in an isolated script, printing the correct paths, break the PR for non-empty PYTHON_MODULES
. Sorry.
Would it be preferable to delay the review until I find a way to make dependency resolution work, or should I rather revert to the working commit of https://github.com/cloudius-systems/osv-apps/pull/61/commits/cfc097ab72fadf5033632eca5407333ce2fca925, which provides module uploads without automated dependency resolution?
Sure no problem. It is really up to you but if was up to me I would go with a evolutionary approach. So maybe for now implement non-automated module resolution and then the remaining part. Also I must say I prefer version of the commit with nicely formatted Python code in shell function rather than inlined long Python code that is harder to read.
I've reverted attempts to resolve dependencies and transformed the one-liner into a multi-line script. Should be ready for review now. Sorry it took so long
Add PYTHON_MODULES as a variable in GET for specifying non-default modules to include in the unikernel. It doesn't include a nice way to expose this to the user(as a parameter taken by GET for example), but it makes it easier to deploy python3 applications on OSv.
This patch requires a user to manually resolve dependencies, as parsing
python3 -m pip show
output forRequires:
only works for packages installed through pip(wouldn't work for packages installed from distro's package managers) and doesn't work for packages that require modules filtered from default modules(for example, numpy requires unittest - a default python module filtered in line 42.