<div dir="auto">It's probably a good idea here to explicitly distinguish between the kind of application that's a web app you deploy to sort of managed server environment, and the kind of application that's a command line or GUI tool that people download and run. The same word means radically different things to different people :-). I believe Paul's advice below is specifically addressing the former case, not the latter.</div><div class="gmail_extra"><br><div class="gmail_quote">On Jan 13, 2017 5:07 AM, "Paul Moore" <<a href="mailto:p.f.moore@gmail.com">p.f.moore@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 13 January 2017 at 12:23, Thomas Güttler<br>
<<a href="mailto:guettliml@thomas-guettler.de">guettliml@thomas-guettler.de</a>> wrote:<br>
> Am 12.01.2017 um 13:43 schrieb Nick Coghlan:<br>
>><br>
>> On 12 January 2017 at 22:04, Thomas Güttler<br>
>> <<a href="mailto:guettliml@thomas-guettler.de">guettliml@thomas-guettler.de</a>> wrote:<br>
>>><br>
>>> I came across a python library which has docs, which start like this:<br>
>>><br>
>>> {{{<br>
>>><br>
>>>  Quickstart<br>
>>><br>
>>>  Include foolib in your requirements.txt file.<br>
>>><br>
>>> }}}<br>
>>><br>
>>> AFAIK dependencies should be specified via `install_requires` in<br>
>>> `setup.py`.<br>
>><br>
>><br>
>> Applications and services don't necessarily have a setup.py file -<br>
>> setup.py is more for pip-installable libraries and frameworks (see<br>
>> <a href="https://caremad.io/posts/2013/07/setup-vs-requirement/" rel="noreferrer" target="_blank">https://caremad.io/posts/2013/<wbr>07/setup-vs-requirement/</a> for more on<br>
>> that topic).<br>
><br>
><br>
> What is an application?<br>
><br>
> The django project uses this definition:<br>
> <a href="https://docs.djangoproject.com/en/1.10/ref/applications/" rel="noreferrer" target="_blank">https://docs.djangoproject.<wbr>com/en/1.10/ref/applications/</a><br>
><br>
> I guess you mean something else, if you talk about "application".<br>
><br>
> What is an application for you?<br>
<br>
IMO, an "application" in this context is a standalone program<br>
(implemented in Python). This is as opposed to a "library" which is<br>
written to be imported in other Python code. Obviously, there's some<br>
overlap - some "applications" provide a "programming API" that can be<br>
imported, and some libraries provide command line entry points.<br>
<br>
A library (something that you import) should declare in its metadata<br>
that you need to have its dependencies installed before it will work.<br>
That lets you (the user of the library) be ignorant of the<br>
dependencies of the library (which are implementation details as far<br>
as you are concerned) - pip just sorts it out for you from the<br>
metadata. To get the dependency metadata, the *library* should include<br>
its dependencies in install_requires in its setup.py.<br>
<br>
For applications on the other hand, you need to install exactly the<br>
environment you tested, so you *don't* use dependency metadata.<br>
Rather, you create a requirements.txt file that contains the exact<br>
versions of everything (direct dependencies) your application needs,<br>
then deploy your application script to a Python environment where<br>
you've run "pip install -r requirements.txt" to set it up correctly.<br>
<br>
As I say, there are lots of grey areas here. But from your<br>
description, the library you found sounds like it should have<br>
dependency metadata, and not need you to use a requirements file. On<br>
the other hand, the "Quickstart" may be trying to tell people how to<br>
use foolib in their *application*, in which case it's correct. (It's<br>
oversimplified, as if you're writing a library that depends on foolib<br>
you'd use install_requires, but simply changing the text to just say<br>
"put foolib in your install_requires" is no better, as then you'd have<br>
ignored the application use case...)<br>
<br>
If you can point to the actual library you're referring to, it would<br>
be easier to be specific :-)<br>
<br>
Paul<br>
______________________________<wbr>_________________<br>
Distutils-SIG maillist  -  <a href="mailto:Distutils-SIG@python.org">Distutils-SIG@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/distutils-sig" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/distutils-sig</a><br>
</blockquote></div></div>