On Apr 07, 2011, at 12:10 PM, Michael Foord wrote: >>> On 4/5/2011 11:52 AM, Barry Warsaw wrote: >>> >>> DEFAULT_VERSION_RE = re.compile(r'(?P<version>\d+\.\d(?:\.\d+)?)') >>> >>> __version__ = pkgutil.get_distribution('elle').metadata['version'] >>> > >I really dislike this way of specifying the version. For a start it is really >ugly.
Agreed! There should be a higher level API for this, e.g.: __version__ = pkgutil.get_version('elle') >More importantly it means the version information is *only* available if the >package has been installed by "packaging", and so isn't available for the >parts of my pre-build process like building the documentation (which import >the version number to put into the docs). That would have to be an important feature of .get_version() I think. >Currently all my packages have the canonical version number information in >the package itself using: > > __version__ = '1.2.3' > >Anything that needs the version number, including setup.py for upload to >pypi, has one place to look for it and it doesn't depend on any other tools >or processes. If switching to "packaging" prevents me from doing this then it >will inhibit me using "packaging". It definitely shouldn't prevent this. I personally do the same thing, and it seems the least bad way of doing it. I think the clear version string assigned to __version__ is the best recommendation (though not the only one) that the PEP makes. -Barry
signature.asc
Description: PGP signature
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com