[Distutils] How to specify dependencies in Python
Jim Fulton
jim at jimfulton.info
Tue Jan 17 12:40:32 EST 2017
On Tue, Jan 17, 2017 at 11:34 AM, Thomas Güttler <
guettliml at thomas-guettler.de> wrote:
>
>
> Am 16.01.2017 um 18:06 schrieb Jim Fulton:
>
>>
>>
>> On Mon, Jan 16, 2017 at 11:03 AM, Thomas Güttler <
>> guettliml at thomas-guettler.de <mailto:guettliml at thomas-guettler.de>>
>> wrote:
>>
>>
>>
>> Am 13.01.2017 um 16:25 schrieb Jim Fulton:
>>
>>
>>
>> On Fri, Jan 13, 2017 at 7:23 AM, Thomas Güttler <
>> guettliml at thomas-guettler.de
>> <mailto:guettliml at thomas-guettler.de> <mailto:
>> guettliml at thomas-guettler.de
>> <mailto:guettliml at thomas-guettler.de>>> wrote:
>>
>> What is an application for you?
>>
>>
>> Another way to think about this, FWIW, is to distinguish between
>> the "whole system" (for which "Application" is
>> often a
>> useful shorthand), as opposed to components (aka libraries).
>>
>> It's important for components to be flexible, so they're
>> typically very flexible about versions of their
>> dependencies.
>>
>> For whole systems, OTOH, it's important that once a configuration
>> is tested, that the same configuration is used in
>> production, so systems typically pin all of their dependencies,
>> ideally extending to their environments (which is a
>> reason why container technology is attractive).
>>
>>
>> Yes, install_requires in setup.py should define flexible
>> dependencies, but requirements.txt should define fixed
>> dependencies via fixed version.
>>
>> Do you agree with my sentence from above?
>>
>>
>> Are you speaking of a component/library or whole system?
>>
>
> I am speaking of both. And: I think requirements.txt is optional.
Then I disagree with your statement. :)
I should stop, but I'll take one more stab at this.
It matters whether you're talking about components(/libraries) or whole
systems (/applications).
For components:
Consumers of a component need to be able to to determine the component's
dependencies. The component uses install_required (and extras_require) for
this. The version specifications in these dependencies should be as
flexible as possible, to allow reuse in as many whole systems as possible.
Developers of a component will use tools like pip and buildout to automate
their development activities. For pip, that will usually entail one or
more requirements.txt files. For buildout, that will entail one or more
(for different development activities) buildout configs and a single
versions.cfg.
For whole systems:
Many whole systems only assemble components. For these systems, there is
no setup.py file (no python project).
If a whole system includes a Python project (that isn't distributed
separately), it's a matter of taste how much information is included in
setup.py. Personally, I would treat the Python project like a component
project and include its direct dependencies and minimal version constraints.
Typically a whole system managed with pip will use a requirements.txt file
(or possibly multiple) and a system developed with buildout will have a
buildout config and a versions config.
A whole system could fix all of its dependent versions in install_requires
in a setup script, but that would be cumbersome. By using requirements.txt
or a buildout versions config, a developer can avail themselves of
automation to help maintain the files.
Jim
--
Jim Fulton
http://jimfulton.info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20170117/d4366290/attachment.html>
More information about the Distutils-SIG
mailing list