[Distutils] [setuptools] How to maintain version strings?

John J Lee jjl at pobox.com
Sun Dec 18 15:47:55 CET 2005

Annoying little issue: I have version strings here and there in my
projects, and would prefer to keep the version in a single place.  In
particular, I have __version__ strings in module code, and also in

I also want to avoid importing code from setup.py, because people
sometimes want to install using a Python executable other than the one
with which they intend to import the package (I assume that's sensible &
possible with setuptools packages), and imports in setup.py have broken
that in the past.

Seems I can't just open('mymodule.py') and find the version string with a
regexp, I assume because of setuptools' "sandbox".  So, I just have to
have my release script check that I remembered to update both.  No big
deal, but it annoys me :-)

Anybody have a way of doing this (or a slap to my forehead to teach me the
simple way to do it ;-)?


More information about the Distutils-SIG mailing list