[Distutils] Setting version from commandline or setup.cfg?

Alan Franzoni mailing at franzoni.eu
Sun Jan 16 14:32:54 CET 2011


On Tue, Jan 11, 2011 at 2:41 PM, Maurits van Rees
<m.van.rees at zestsoftware.nl> wrote:
> Op 11-01-11 12:51, Alan Franzoni schreef:
>>
>> Hello,
>> I'm trying to automate my release process from vcs - something like:
>>
>> run tests ->
>>  fetch current major, minor from branch (e.g. release_1.2) and
>> revision from tag (e.g. v1.2.1) ->
>> upload with current major, minor and  revision +1>
>> tag with such current major, minor and incremented revision.
>>
>>
>> I'd like to set my version from outside my setup.py file, either via
>> setup.py or a commandline option - I don't want to execute code in my
>> setup.py since this usually causes all sort of headaches with missing
>> dependencies.
>>
>> Is there any proper way to do it? Might I break  other things
>> unexpectedly?
>
> I suggest using a tool like:
> http://pypi.python.org/pypi/zest.releaser

I have played a bit with zest.releaser, and while it seems interesting
I'm not sure about some things, e.g.:

I'd like to test my project *before* committing any version change or
tagging anything. I'd like to pass a "candidate changeset" for a
release; if all tests on such release succeed, I'd then like to tag
the current changeset, upload everything to pypi, upgrade setup.py (or
version.txt) with the next development version. zest.releaser offers
setup.py entrypoint hooks, but maybe a buildout hook (run another
part) would work better?

Also, version.txt looks better than embedding the version in setup.py,
but I'd like to follow even more a convention-over-configuration
thing; I'd like release branches to be named something like

release_1.2
release_1.3

and I'd really like to pull version numbers from the branch name and
latest revision from the tag info - nor version.txt neither setup.py
should be committed at any time - that's often an issue because when
working with multiple branches, the forward merge of version changes
often produces merge errors that must be corrected manually. Saving
version info in metadata like branch names or tags is a better
solution, I think.

I'll try playing a bit with the zest.releaser source by the way, If I
can reach a good result I'll let you know.


-- 
Alan Franzoni
--
contact me at public@[mysurname].eu


More information about the Distutils-SIG mailing list