Should setuptools version propagate to a module's __version__? If so, how?

Cameron Simpson cs at cskk.id.au
Sat May 9 23:16:56 EDT 2020


On 08May2020 18:07, John Ladasky <john_ladasky at sbcglobal.net> wrote:
>I just came across a package in PyPI which is in a state of neglect.  The official version on the PyPI page is 1.3.1 -- but the installed module reports its version as 1.2.0.  This is confusing.
>
>There are several bugs in this package besides the mismatched version number.  I've forked a copy of the package on GitHub, and I will attempt a cleanup.
>
>In another private package of my own, I performed an unsavory hack in setup.py.  There is a "version" argument to the setup() call.  I define "version" as a global variable in setup.py.  Before I call setup with this version number, I also modify the line of package code which defines its __version__.  This works for me, but it feels wrong.
>
>Is there a recommended way to keep the internal reference and the 
>setup.py reference in sync?  Is there any reason someone would NOT want 
>these numbers to match?

My release script writes the setup.py on the fly, so it gets the version 
number from the release tag I use. I also autopatch the module itself to 
set __version__ to match when I make that release tag.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Python-list mailing list