[Tutor] About (dev-)requirements.txt
Mats Wichmann
mats at wichmann.us
Thu Mar 11 15:32:39 EST 2021
On 3/11/21 7:37 AM, Albert-Jan Roskam wrote:
> Hi,
> How do I generate separate (i.e., disjoint) lists of requirements for the
> app itself and the dev-requirements? I know I can use pip freeze, but how
> do I separate dev and non-dev? Let's say I use nose, pdoc3 and tox for
> dev-requirements.txt. How do I separate those packages AND their
> dependencies from the non-dev requirements.txt?
> And what do I do with libraries like setuptools, wheel and pip? Should
> they be in both lists? Or should they be installed first, before anything
> else? I recently experienced many problems related to old pip/wheel
> versions after I tried to recreate a virtualenv with existing
> requirement.txt's but a higher Python version so I hope next time this
> process will be less "trial and error".
> Thanks!
> Albert-Jan
This seems to be a space where conventions are evolving.
I used to hear the advice to put install requirements in setup.py, and
build requirements in requirements.txt.
More recently I've heard people using separate requirements files, like
you mention.
requirements-dev.txt seems to be the convention - PyPi even has a dummy
package of this name to prevent issues if you try to install using this
file and leave out the "-r".
https://pypi.org/project/requirements-dev.txt/
If you're using pipenv (I don't, at the moment, so this is just from
reading docs, not personal experience):
pipenv lock -r
and
pipenv lock -r --dev
will generate you separate lists for runtime and for dev.
BUT... that means you already had to record what you wanted in the
pipfile, so it feels kind of like "to solve the problem, you first have
to solve the problem" :)
Let us know what you find out...
More information about the Tutor
mailing list