Hello here!
TL;DR: Should I use requirements.txt, or should I have my
dependencies only listed inside setup.py?
Long version:
The two most common ways to have dependencies listed in a
python package are either having them listed both in
setup.py and requirements.txt files, or having them only
listed in requirements.txt and then import them using some
`parse_requirements` methods.
In the projects which I am currently working on there are
five lists of requirements:
- requirements.txt
- requirements_test.txt
- requirements_dev.txt
- install_requires inside setup.py
- tests_require inside setup.py
I wanted to remove duplicities, so I thought about
removing the setup.py lists and parse the dependencies
from the requirements*.txt files.
But then I came across this,
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?
Regards,
--
Carles Sala Cladellas
carles@pythiac.com / +34 666 278 679
https://www.pythiac.com
Pythia Consulting - Data Science as a Service
--