> In general, requirements.txt seems to be an > anti-pattern. You either have to use likely to break tooling or you'll > have to reinvent that from scratch. You're better off putting it > directly in setup.py and using setup.py to install dependencies in a > virtualenv instead of requirements.txt >
I don't know your context for calling it an anti-pattern, but there are valid use cases for requirements.txt vs install_requires. here's what the "Python Packaging User Guide" has on the distinction https://packaging.python.org/en/latest/requirements.html skipping to the distinctions, it lists four: Whereas install_requires defines the dependencies for a single project, *Requirements Files* <https://pip.pypa.io/en/latest/user_guide.html#requirements-files> are often used to define the requirements for a complete python environment. Whereas install_requires requirements are minimal, requirements files often contain an exhaustive listing of pinned versions for the purpose of achieving *repeatable installations* <https://pip.pypa.io/en/latest/user_guide.html#repeatability> of a complete environment. Whereas install_requires requirements are “Abstract”, requirements files often contain pip options like --index-url or --find-links to make requirements “Concrete”. [1] <https://packaging.python.org/en/latest/requirements.html#id4> Whereas install_requires metadata is automatically analyzed by pip during an install, requirements files are not, and only are used when a user specifically installs them using pip install -r.
_______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig