Itamar Turner-Trauring writes:
These sort of problems are one of the many reasons you want to “pin” your application’s dependencies: make sure you only install a specific, fixed set of dependencies. Without reproducible dependencies, as soon as NumPy 2 comes out your application might break when it gets installed with new dependencies.
The really short version is that you have two sets of dependency configurations:
- A direct dependency list: A list of libraries you directly import in your code, loosely restricted. This is the list of dependencies you put in pyproject.toml or setup.py.
- A lock file: A list of all dependencies you rely on, direct or indirect (dependencies of dependencies), pinned to specific versions. This might be a requirements.txt, or some other file dependencies on which tool you’re using.
At appropriate intervals you update the lock file based on the direct dependency list.
I’ve written multiple articles on the topic, in case you’re not familiar with the relevant tools:
- “Faster Docker builds with pipenv, poetry, or pip-tools” covers using those three tools to maintain lockfiles.
- For Conda, see “Reproducible and upgradable Conda environments with conda-lock”.
Read NumPy 2 is coming: preventing breakage, updating your code
No comments yet!