On Mon, May 07, 2018 at 08:48:23AM +0200, Carles Sala Cladellas wrote:
Hello here!
TL;DR: Should I use requirements.txt, or should I have my dependencies only listed inside setup.py?
Short answer: only setup.py, unless you find a reason to also use a requirements.txt. Long answer: https://packaging.python.org/discussions/install-requires-vs-requirements/ and especially https://caremad.io/posts/2013/07/setup-vs-requirement/
But then I came across this, [1]https://stackoverflow.com/a/28842733, which recommends using a `dev` entry in `extras_require` and then using `pip install -e .[dev]` to install them, which could be easily extended to also have a `pip install -e .[test]`.
I find this a very clean option, since it reduces the amount of files the repository and makes setup.py and makes setup.py self-contained.
Are any known drawbacks to this approach? Is it a good way to go?
I like it. It works nicely for me. It's not 100% complete approach: sometimes (when I'm working on an application rather than a tool/library) I also wish to have a list of concrete version pins with which the application has been known to work, so I use pip freeze (or pip-tools) to get a requirements.txt with all the frozen versions. HTH, Marius Gedminas -- Everyone generalizes from one example. At least, I do. -- Steven Brust