[Distutils] Single version number
Ben Finney
ben+python at benfinney.id.au
Fri Jul 10 16:31:25 CEST 2009
Marius Gedminas <marius at pov.lt> writes:
> What do people use to avoid repeating the version number both in the
> setup.py as well as in application/library code, when the
> application/library wants to know its own version number?
>
> I've seen several options:
>
> 1) put __version__ = '4.2' in yourpackage/__init__.py, have setup.py
> do from yourpackage import __version__ and pass that to setup()
I do a variant on this: ‘mainpackage/version.py’ contains attributes for
version string, author details, copyright license, and so on. The
‘mainpackage/__init__.py’ docstring is parsed for the short and long
description; it often has the project URL too.
Using Bazaar, I can also (with ‘bzr version-info --format=python’)
automatically generate an importable module with information about the
current VCS head revision; sometimes I use that to put the revision
number in the version string, or to get the end-year of a copyright year
range, etc.
--
\ “Judge: A law student who marks his own papers.” —Henry L. |
`\ Mencken |
_o__) |
Ben Finney
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20090711/bf7d3e0c/attachment.pgp>
More information about the Distutils-SIG
mailing list