[melbourne-pug] python package versions

Ben Finney ben+python at benfinney.id.au
Thu Mar 6 10:37:03 CET 2014


Brian May <brian at microcomaustralia.com.au> writes:

> On 6 March 2014 11:40, Ben Finney <ben+python at benfinney.id.au> wrote:
> > For [reading the version of an installed package distribution], we
> > need the third-party ‘pkg_resources’. This library was proposed for
> > the Python standard library in PEP 365, but rejected
> > <URL:http://legacy.python.org/dev/peps/pep-0365/> for reasons not
> > explained in that PEP.
>
> Any ideas why it was rejected?

Nothing clear. The PEP documents will often record the reasons for
rejection, but this one doesn't.

> I have been confused in the past in that setuptools is another
> package.
>
> Apparently setuptools is an add on for distutils?

You're right to be confused; there's a lot of tangled history.

The only things which affect us today:

Current ‘distutils’ in the Python standard library has recently grown a
lot of features that were once in the third-party ‘setuptools’.

The ‘setuptools’ library name is implemented by “Distribute”, which was
a fork but has now taken over as the active development for that code
base. Any reference you see to using ‘setuptools’ can be implemented
today by installing “Distribute”.

In fact, many GNU+Linux distributions simply make Distribute available
as the package name ‘python-setuptools’ for backward compatibility.

> http://stackoverflow.com/questions/10712809/how-to-require-and-install-a-package-using-python-3-x-distutils
>
> Is the information in this post on requires not working with distutils
> without setuptools still correct?

Correct; Python's standard library ‘distutils’ still doesn't implement
any of the ‘pkg_resources’ functionality, and you need third-party
library (“Distribute”, available by the package name ‘setuptools’) if
you want that.

Most packages don't need that functionality merely to *be installed*, so
it's not essential and isn't in the standard library.

But getting the library's own installed version string, which IMO is
needed by any decent library, is part of that functionality deemed “not
essential” and not available in ‘distutils’. So either you end up
re-implementing it (badly), or you have to depend on the third-party
‘pkg_resources’ functionality anyway.

-- 
 \       “Faith, n. Belief without evidence in what is told by one who |
  `\   speaks without knowledge, of things without parallel.” —Ambrose |
_o__)                           Bierce, _The Devil's Dictionary_, 1906 |
Ben Finney



More information about the melbourne-pug mailing list