jbweston / miniver

Like Versioneer, but smaller
Creative Commons Zero v1.0 Universal
53 stars 10 forks source link

Python2 incompatibilities #2

Closed cmarquardt closed 6 years ago

cmarquardt commented 6 years ago

Hi,

and many thanks for making miniver available!

I started to use miniver in a project which is still based on python 2.17 and noticed a few incompatibilities in _version.py; basically the use of f-strings (in other places, the older .format() is however still used) as well as a <unicode-string>.contains(). They are however straightforward to fix and now it works beautifully in the older python as well (and under MacOS X, by the way).

I also turned a '-dev' component of the constructed version string into '.dev'; setuptools complained about the hyphen and made that replacement when using the version string.

cmarquardt commented 6 years ago

Just realised that I had to change the code in setup.py as well. Maybe the _setup_template in install_miniver should also be updated?

jbweston commented 6 years ago

Hi!

I only just saw this; sorry for the delay.

jbweston commented 6 years ago

I also turned a '-dev' component of the constructed version string into '.dev'; setuptools complained about the hyphen and made that replacement when using the version string.

Yeah, I was trying to more strictly adhere to semver, which dictates that:

A pre-release version MAY be denoted by appending a hyphen and a series of dot separated identifiers immediately following the patch version.

But given that we're only concerned with Python projects probably it does indeed make sense to prefer PEP440.

jbweston commented 6 years ago

@cmarquardt thanks for the work that you put in to this! Especially the adherence to PEP440 and fixing the inconsistencies in the use of f-strings vs format.

I thought for a bit about this, and I'm not really sure that I want to include the Python 2 support.

Python 2 will reach its end of life in 2020, and I think that we should encourage the use of Python 3 by making our tools Python 3 only.

Of course I'm happy to add a note to the README pointing to your fork!

jbweston commented 6 years ago

@cmarquardt I just opened #3 that incorporates your fixes for the f-strings and PEP440 formatting, but leaves out the Python 2 compatibility.

As these are your changes I set you as the commit author. Is this ok?

cmarquardt commented 6 years ago

Hi,

no worries - and thanks for looking at the pull request at all! Please feel free to take what you find useful.

On the python 2 support - yes, I understand your point. If it's ok for you, I rename the fork to something like minver2, point to your project as the authoritative original, and state that mine is a friendly fork with the sole purpose of supporting the migration of existing python 2 projects to python 3. I'll occasionally check for updates on your side and merge them into the python 2 version until the latter becomes obsolete. Would that be ok?

jbweston commented 6 years ago

Sure no problem!

I'll close this MR now.

cmarquardt commented 6 years ago

Great - thanks a lot! The URL has changed, it's https://github.com/cmarquardt/miniver2 now...

Thanks a lot!