How to list in Python project all libraries and their version?
(similar to Java maven pom.xml
and Node.js npm 'package.json')
There is definitely way to specify that on command line,
e.g. pip install pandas==0.23
, but that only hopefully will be listed in README, but most likely be forgotten.
Also as there is pip
and conda
, do they address this? Or maybe some other 3rd tool tries to unify for whatever pip or conda usage?
There are two main mechanisms to specify libraries for a package/repository:
setup.py
/pyproject.toml
. These are used by package managers to automatically install required dependencies on package installation.requirements.txt
. These are used by package managers to explicitly install required dependencies.Notably, the two handle different use-cases: Package dependencies define the general dependencies, only restricting dependency versions to specific ranges when needed for compatibility. Requirements define the precise dependencies, restricting all direct and indirect dependency versions to replicate some pre-existing setup.