[Python-Dev] PEP 0365: Adding the pkg_resources module (original) (raw)
M.-A. Lemburg mal at egenix.com
Fri May 4 16:06:54 CEST 2007
- Previous message: [Python-Dev] PEP 0365: Adding the pkg_resources module
- Next message: [Python-Dev] PEP 0365: Adding the pkg_resources module
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2007-05-01 02:29, Phillip J. Eby wrote:
I wanted to get this in before the Py3K PEP deadline, since this is a Python 2.6 PEP that would presumably impact 3.x as well. Feedback welcome.
Could you add a section that explains the side effects of importing pkg_resources ?
The documentation of the module doesn't mention any, but the code suggests that you are installing (some form of) import hooks.
Some other comments:
Wouldn't it be better to factor out all the meta-data access code that's not related to eggs into pkgutil ?!
How about then renaming the remaining module to egglib ?!
The module needs some reorganization: imports, globals and constants at the top, maybe a few comments delimiting the various sections,
The get_*_platform() should probably use the platform module which is a lot more flexible than distutils' get_platform() (which should probably use the platform module as well in the long run)
Thanks,
Marc-Andre Lemburg eGenix.com
Professional Python Services directly from the Source (#1, May 04 2007)
Python/Zope Consulting and Support ... http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611
PEP: 365 Title: Adding the pkgresources module Version: Revision:55032Revision: 55032 Revision:55032 Last-Modified: Date:2007−04−3020:24:48−0400(Mon,30Apr2007)Date: 2007-04-30 20:24:48 -0400 (Mon, 30 Apr 2007) Date:2007−04−3020:24:48−0400(Mon,30Apr2007) Author: Phillip J. Eby <pje at telecommunity.com> Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 30-Apr-2007 Post-History: 30-Apr-2007
Abstract ======== This PEP proposes adding an enhanced version of the
pkgresources
module to the standard library.pkgresources
is a module used to find and manage Python package/version dependencies and access bundled files and resources, including those inside of zipped.egg
files. Currently,pkgresources
is only available through installing the entiresetuptools
distribution, but it does not depend on any other part of setuptools; in effect, it comprises the entire runtime support library for Python Eggs, and is independently useful. In addition, with one feature addition, this module could support easy bootstrap installation of several Python package management tools, includingsetuptools
,workingenv
, andzc.buildout
. Proposal ======== Rather than proposing to includesetuptools
in the standard library, this PEP proposes only thatpkgresources
be added to the standard library for Python 2.6 and 3.0.pkgresources
is considerably more stable than the rest of setuptools, with virtually no new features being added in the last 12 months. However, this PEP also proposes that a new feature be added topkgresources
, before being added to the stdlib. Specifically, it should be possible to do something like:: python -m pkgresources SomePackage==1.2 to request downloading and installation ofSomePackage
from PyPI. This feature would not be a replacement foreasyinstall
; instead, it would rely onSomePackage
having pure-Python.egg
files listed for download via the PyPI XML-RPC API, and the eggs would be placed in the$PYTHONEGGS
cache, where they would not be importable by default. (And no scripts would be installed) However, if the download egg contains installation bootstrap code, it will be given a chance to run. These restrictions would allow the code to be extremely simple, yet still powerful enough to support users downloading package management tools such assetuptools
,workingenv
andzc.buildout
, simply by supplying the tool's name on the command line. Rationale ========= Many users have requested thatsetuptools
be included in the standard library, to save users needing to go through the awkward process of bootstrapping it. However, most of the bootstrapping complexity comes from the fact that setuptools-installed code cannot use thepkgresources
runtime module unless setuptools is already installed. Thus, installing setuptools requires (in a sense) that setuptools already be installed. Other Python package management tools, such asworkingenv
andzc.buildout
, have similar bootstrapping issues, since they both make use of setuptools, but also want to provide users with something approaching a "one-step install". The complexity of creating bootstrap utilities for these and any other such tools that arise in future, is greatly reduced ifpkgresources
is already present, and is also able to download pre-packaged eggs from PyPI. (It would also mean that setuptools would not need to be installed in order to simply use eggs, as opposed to building them.) Finally, in addition to providing access to eggs built via setuptools or other packaging tools, it should be noted that since Python 2.5, the distutils install package metadata (akaPKG-INFO
) files that can be read bypkgresources
to identify what distributions are already onsys.path
. In environments where Python packages are installed using system package tools (like RPM), thepkgresources
module provides an API for detecting what versions of what packages are installed, even if those packages were installed via the distutils instead of setuptools. Implementation and Documentation ================================ Thepkgresources
implementation is maintained in the Python SVN repository under/sandbox/trunk/setuptools/
; seepkgresources.py
andpkgresources.txt
. Documentation for the egg format(s) supported bypkgresources
can be found indoc/formats.txt
. HTML versions of these documents are available at: * http://peak.telecommunity.com/DevCenter/PkgResources and * http://peak.telecommunity.com/DevCenter/EggFormats (These HTML versions are for setuptools 0.6; they may not reflect all of the changes found in the Subversion trunk's.txt
versions.) Copyright ========= This document has been placed in the public domain.
Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/mal%40egenix.com
- Previous message: [Python-Dev] PEP 0365: Adding the pkg_resources module
- Next message: [Python-Dev] PEP 0365: Adding the pkg_resources module
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]