[Python-Dev] PEP 396, Module Version Numbers (original) (raw)

Barry Warsaw barry at python.org
Tue Apr 12 20:46:38 CEST 2011


On Apr 07, 2011, at 12:26 AM, Nick Coghlan wrote:

On 4/5/2011 11:52 AM, Barry Warsaw wrote:

DEFAULTVERSIONRE = re.compile(r'(?P\d+.\d(?:.\d+)?)') version = pkgutil.getdistribution('elle').metadata['version'] The RE as given won't match alpha, beta, rc, dev, and post suffixes that are discussed in POP 386. Indeed, I really don't like the RE suggestion - better to tell people to just move the version info into the static config file and use pkgutil to make it available as shown. That solves the build time vs install time problem as well.

I'm actually going to remove the regexp example from the PEP. It's distracting, incorrect, and unnecessary (give that packaging will have such an API).

Yep, this is why the version information should be in the setup.cfg file, and hence available via pkgutil without loading the module first.

If the version information is in the setup.cfg, then the question is, what's the code look like to get that stuffed into a module's version attribute? If it's not the pkgutil ugliness, what is it? And does it work whether your in say the source tree of your uninstalled module, or in a Python where the package was installed via they OS?

-Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: not available URL: <http://mail.python.org/pipermail/python-dev/attachments/20110412/9f902162/attachment.pgp>



More information about the Python-Dev mailing list