jeudi 4 mai 2017

How do you use multiple versions of a Python package concurrently?

Suppose I have two standalone Python packages, each with its own setup.py and requirements.txt files. Both packages have a requirement for a third package, but different versions of that package. A virtual environment would normally suffice to keep versions separate.

Here's the catch: What if my second package depends on the first package? For example, I have a workflow where package one does some work and the output is used as input by package two, i.e. the packages need to be composable.

For deployment this is not a problem since we can use containerisation (e.g. Docker) to keep things neat and separate.

Other than manually manipulating __path__ for each package, is there a reliable way to concurrently use different versions of the same package for development and testing purposes on a single local machine?

Aucun commentaire:

Enregistrer un commentaire