Skip to content

Dev version hard to check #19419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pllim opened this issue Feb 1, 2021 · 6 comments · Fixed by #20369
Closed

Dev version hard to check #19419

pllim opened this issue Feb 1, 2021 · 6 comments · Fixed by #20369
Milestone

Comments

@pllim
Copy link

pllim commented Feb 1, 2021

Hello. astropy tests against the dev version of matplotlib by installing git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib (see https://github.com/astropy/astropy/blob/13c4faa2ef41624f0f454f16ded57043c2b1c4ec/tox.ini#L84). Unfortunately, this gives a dev version that is hard to check.

Example log using latest stable: https://github.com/astropy/astropy/runs/1807399647?check_suite_focus=true (Matplotlib: 3.3.4)

Example log using dev: https://github.com/astropy/astropy/runs/1807399544?check_suite_focus=true (Matplotlib: 3.3.2+2259.g30546931d)

As a result, I am not sure how to check if a given Matplotlib version is dev or not:

>>> from packaging.version import Version
>>> stable = Version('3.3.4')
>>> dev = Version('3.3.2+2259.g30546931d')
>>> dev > stable  # Expected: True
False
>>> dev.is_devrelease  # Expected: True
False

Any advise would be really appreciated. Thanks!

xref astropy/astropy#11267

@anntzer
Copy link
Contributor

anntzer commented Feb 1, 2021

likely #18971 will fix that?

@pllim
Copy link
Author

pllim commented Feb 1, 2021

I hope so!

@QuLogic
Copy link
Member

QuLogic commented May 19, 2021

>>> stable = Version('3.3.4')
>>> dev = Version('3.3.2+2259.g30546931d')
>>> dev > stable  # Expected: True

This is because the v3.3.x branch was not merged to master after the release. This would probably still be a problem now with setuptools-scm if that were not done, but it was done fairly quickly after 3.4.2, so is fine right now. However, since we use the post-release version scheme, you don't get is_devrelease == True.

@QuLogic
Copy link
Member

QuLogic commented May 19, 2021

We may want to switch to release-branch-semver, which seems automatic while still closer to what we do compared to the default guess-next-dev.

@QuLogic QuLogic added the status: needs comment/discussion needs consensus on next step label May 19, 2021
@QuLogic
Copy link
Member

QuLogic commented May 20, 2021

On the call, we decided that it's probably a good idea to switch to this form for 3.5.0/master, but we don't have a strong preference. It would be best to confirm that this works for downstream libraries first. So this would change from:
- master : 3.4.2.post825+g303873fc65
- v3.4.x : 3.4.2+16.gdcfc7a17a2 <- Note this didn't use setuptools-scm, but would be a mix of these two things for the v3.5.x branch
to:
- master : 3.5.0.dev820+g6768ef8c4c.d20210520
- v3.4.x : 3.4.3.dev4+g97f47ba6d8.d20210520

This should always satisfy dev > stable for master, and I believe also version.is_devrelease.

Does that sound good for Astropy, @pllim?

@pllim
Copy link
Author

pllim commented May 20, 2021

Hello. Thanks for the replies! We don't really use is_devrelease attribute. I was just trying that out when > comparison didn't work. We usually use something like this in our tests. This is a very specific example but hopefully the idea comes across:

from packaging.version import Version

import matplotlib
import pytest

MATPLOTLIB_LT_3_5 = Version(matplotlib.__version__) < Version('3.5')

@pytest.mark.skipif(MATPLOTLIB_LT_3_5, reason="new feature")
def test_something():
    # blah blah

I think the new scheme will work nicely for us. Thanks! 🙇‍♀️

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 a pull request may close this issue.

3 participants