[Distutils] Role of setuptools and eggs in "modern" distributing...
Chris Barker
chris.barker at noaa.gov
Tue Dec 23 22:04:47 CET 2014
On Tue, Dec 23, 2014 at 10:37 AM, Donald Stufft <donald at stufft.io> wrote:
> I’m going to attempt to read between the lines here a little bit.
>
Thank you -- you did an excellent job of capturing the gestalt of my
confusion !
The “egg” name is heavily overloaded in setuptools. It is used all over the
> place for varying sets of related but distinct concepts. The #egg= thing is
> one of those setuptools concepts where it used that name for something
> distinct but similar. Ideally it shouldn’t be #egg= or #wheel= but should
> be #dist= or something similar since it’s neither an egg or a Wheel and
> there is an open ticket in pip’s issue tracker to do that.
>
OK, that clears it up.
Though I still get egg-info files all over the place -- not sure why that
annoys me ;-)
> To make a clarification though, pip itself doesn’t depend on setuptools,
> it can install from Wheels without setuptools being installed on the system
> at all. It does however rely on setuptools to be installed if it is
> installing from a sdist. The reason for this is that pip uses setuptools as
> a build tool, so when it invokes a setup.py it’s “building" that
> distribution (even if it’s just pure python it needs “built”). However pip
> does some tricks so that it will always uses setuptools to build the
> project, regardless of if the project imports setuptools or distutils in
> their setup.py.
>
Ah -- so pip needs to use setuptools to build, but a package doesn't have
to explicitly use it in its setup.py.
To that aim, install_requires specifies a packages dependencies as well as
> other metadata for that package, and requirements.txt is just a list of
> packages to install. The difference is subtle but a requirements.txt isn’t
> attached to a particular project and the rest of the metadata like name,
> version, etc.
>
hmm...I agree, but often shipped alongside setup.py -- kind of like the
fact that the name "setup.py" is a conventions rather than a spec, but
expected all over the place.
On Tue, Dec 23, 2014 at 11:17 AM, Marcus Smith <qwcode at gmail.com> wrote:
which I can now get with "pip --editable" or does that give me setuptools
> develop mode anyway
>
"-e" uses setuptools develop mode.
OK -- though it sounds like pip would do that whether or not I used
setuptools in the setup.py.
the main reason for setuptools is for "install_requires", which is
> fundamental to pip dependency resolution.
> but in general, it offers more features and it's more maintained than pure
> distutils.
> The standard advice is to use setuptools over distutils.
OK -- still not clear how install_requires plays with conda - but it's
common enough that I think conda simply ignores it (though not silently)
The Packaging User Guide has a breakdown of install_requires vs
> requirements files.
>
> https://packaging.python.org/en/latest/technical.html#install-requires-vs-requirements-files
>
> In brief, requirements files are usually for a whole "environment",
> whereas install_requires is for a project.
>
A note about terminology here (both in this email and The Packaging User
Guide) -- it seems to me that install_requires is about requirements for a
"package" not a "project", and that, in fact, requirements.txt is best used
for "projects".
I guess the distinction may be that a "package" has a setup.py, whereas a
project is somethign you are building that requires perhaps a stack of
unrelated packages. So you can say : if you want to run my application,
run:
pip install -r requirements.txt
first.
"install_requires" is critical when publishing projects to PyPI.
Good to know -- I may need to go there art some point.
So I'll go with setuptools and install_requires, and see how it all goes.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20141223/e6276a91/attachment-0001.html>
More information about the Distutils-SIG
mailing list