Skip to content

Conversation

@tpikonen
Copy link
Contributor

@tpikonen tpikonen commented Aug 4, 2021

The adaptive branch currently has version numbers like '3.10.21+1', which breaks when trying to split() the version string on periods. This PR fixes or removes the version string splitting.

The unused variable __version_info__ is removed, and re.split() is used in util.get_update_info() which allows splitting also on '+'.

@elelay
Copy link
Member

elelay commented Aug 5, 2021

why not 👍

__version_info__ is found in some other packages (https://softwareengineering.stackexchange.com/questions/375922/whats-the-version-info-function-in-a-pypi-package) to do clean comparison, but not used indeed.

@tpikonen
Copy link
Contributor Author

tpikonen commented Aug 5, 2021

Obviously, re.split() can also be used to parse __version_info__ if it's needed. Your call.

@elelay
Copy link
Member

elelay commented Aug 5, 2021

I'm ok with removing it.

@thp
Copy link
Member

thp commented Aug 5, 2021 via email

@tpikonen
Copy link
Contributor Author

tpikonen commented Aug 5, 2021

@thp, the idea was to visually separate the adaptive revisions from the master branch releases, but as seen, this may cause more problems than it solves.

The reasonable options are to use re.split('.|+') for splitting the version string everywhere (see the latest push) or I start to use '.' as the adaptive revision separator. Either way is fine for me, but I would prefer the first option.

@elelay
Copy link
Member

elelay commented Aug 5, 2021

Using a +adaptive-N suffix would make it a local version, according to https://www.python.org/dev/peps/pep-0440/#development-release-separators. Is it what we're after?

Handle public and local version parts of __version__ in version
comparisons and when parsing __version_info__.
@tpikonen
Copy link
Contributor Author

tpikonen commented Aug 6, 2021

Interesting link. The latest push now handles the local version label as required in PEP 440 and leaves the public version part handling as it was.

@tpikonen
Copy link
Contributor Author

tpikonen commented Aug 6, 2021

BTW, there's a Python library function for version number parsing called packaging.version.parse (also included in setuptools as pkg_resources.packaging.version.parse), but using that requires adding either packaging or setuptools as dependency.

@elelay
Copy link
Member

elelay commented Aug 8, 2021

Adding the extra dependency seems a bit too much.

Regarding versioning, what format do you intend to use: 3.10.21+1 or 3.10.21+adaptive-1?

It seems to work as expected anyway:

>>> convert('3.10.21+1')
(3, 10, 21, 1)
>>> convert('3.10.21')
(3, 10, 21)
>>> (3, 10, 21, 1) >= (3, 10, 21)
True
>>> (3, 10, 21, 1) >= (3, 10, 22)
False
>>> convert('3.10.21+adaptive-1')
(3, 10, 21, 'adaptive-1')
>>> convert('3.10.21+adaptive-1') >= convert('3.10.21')
True
>>> convert('3.10.21+adaptive-1') >= convert('3.10.22')
False

@tpikonen
Copy link
Contributor Author

tpikonen commented Aug 9, 2021

I'll leave the adaptive branch versioning as it is, ('3.10.21+1' etc.), unless there is good reason to change it.

Copy link
Member

@thp thp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me, but it's @elelay's call :)

@elelay elelay merged commit b034f3d into gpodder:master Aug 10, 2021
@elelay
Copy link
Member

elelay commented Aug 10, 2021

That's it then :-)

@elelay
Copy link
Member

elelay commented Aug 10, 2021

Thanks

@tpikonen tpikonen deleted the version-plus branch August 14, 2021 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants