On Fri, Feb 13, 2015 at 3:59 PM, Marcus Smith <qwc...@gmail.com> wrote:
>
>> 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 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 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]
>
> 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.


In 90% of the cases I see, requirements.txt are used to define the
requirements for the project to function which typically are the exact
same requirements necessary when installing the project. People also
will then write a test-requirements.txt (or dev-requirements.txt) file
to have a complete development environment. In this case, Thomas seems
to be using requirements.txt to define the requirements necessary when
installing the software they're developing.

If requirements.txt were used solely for a development environment,
they would look more like

| .
| dev-requirement-1>=0.1
| # etc.

Instead they seem to be used more to define the same requirements
someone would define in install_requires. This is the anti-pattern I'm
talking about.
_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to