Marius Gedminas <[email protected]> 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

Attachment: pgpzYLEFQfJj0.pgp
Description: PGP signature

_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to