On Apr 07, 2011, at 12:26 AM, Nick Coghlan 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'] >> >> 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
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