@mike10010100, at my org we source a module_rigging.sh file in each of our ‘vendored’ module’s plan.sh files (we do this to DRY up the vendored module plans):
This allows us to populate our PYTHONPATH automatically as we depend on vendored modules. This has worked well for us, and we can still override callback definitions that originated in the module_rigging.sh file by re-defining them in the main plan.sh. The following example was pulled from https://bldr.habitat.sh/#/pkgs/smartb/tensorflow/latest:
I had a quick question surrounding your solution: are you passing around the virtualenv as the output to your package? If so, are you then sourcing it with every new package?
we are propagating the location of the modules we installed with virtualenv to any packages that depend on our Python module package. So we are getting the files into place with virtualenv but don’t use it after that because Habitat’s aggregation of paths into a single concatenated PYTHONPATH is doing the same thing that source ./bin/activate would.
Very happy to help! Python magic in Habitat is less magical than one might hope, I think partly because workflow patterns in the Python community are less well-defined than for languages like Ruby. For example, every Rubyist uses Bundler, but Python has Virtualenv, Pyenv and others. For us at smartB this has meant digging into Python ecosystem internals a bit, which is why we built some of the stuff I pointed you to.