Skip to content

Simplify, standardize, and reduce repetition of version checks - #3389

Merged
eteq merged 8 commits into
astropy:masterfrom
embray:utils/minversion
Feb 10, 2015
Merged

eteq merged 8 commits into
astropy:masterfrom
embray:utils/minversion

Conversation

@embray

@embray embray commented Jan 29, 2015

Copy link
Copy Markdown
Member

This adds a new utility minversion that can be used to check Python module version dependencies. I also went through and used this where appropriate, but I also cut down on the number of Numpy version checks by putting several of them in the numpycompat module and just importing Numpy version checks from there where needed (in many cases).

I should also add, though it is unlikely to matter 99.99% of the time, minversion defaults to using pkg_resources.parse_version which, as of setuptools 8.0 uses PEP-440-compliant version comparison by default. If for whatever reason that's unavailable we fall back on distutils.verison.LooseVersion which is still good enough for most cases.

@embray embray added Affects-dev PRs and issues that do not impact an existing Astropy release Affects-release utils and removed Affects-dev PRs and issues that do not impact an existing Astropy release labels Jan 29, 2015
@embray

embray commented Jan 29, 2015

Copy link
Copy Markdown
Member Author

If this is merged first, it could be used by #3383 too. Otherwise I'll update this after #3383 is merged.

@embray

embray commented Jan 29, 2015

Copy link
Copy Markdown
Member Author

Looks like my docstrings need fixing, and that I might have broken something on Numpy 1.7 (probably changed some conditional to the wrong thing--I'll go through and double check again.

@embray

embray commented Jan 30, 2015

Copy link
Copy Markdown
Member Author

Should be fixed up now.

@embray

embray commented Jan 30, 2015

Copy link
Copy Markdown
Member Author

That's odd. 0a5b2f0 should have fixed the tests that were failing. I confirmed this locally.

Comment thread astropy/units/tests/test_quantity.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Think this would be NUMPY_LT_1_7, no?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah that could work here.

@mhvk

mhvk commented Jan 30, 2015

Copy link
Copy Markdown
Contributor

Nice! Will make it all the easier to remove cruft once older numpy versions are no longer supported. I made in-line comments in two places were I think the pre-defined variables should do.

@mhvk

mhvk commented Jan 30, 2015

Copy link
Copy Markdown
Contributor

BTW, happy with this, so can be merged as far as I'm concerned. But maybe @astrofrog wants to have a quick look?

@embray

embray commented Feb 3, 2015

Copy link
Copy Markdown
Member Author

appveyor fell over for no reason

@landscape-bot

Copy link
Copy Markdown

Code Health
Repository health increased by 0.00% when pulling 7a337ed on embray:utils/minversion into 122fb4a on astropy:master.

@embray

embray commented Feb 10, 2015

Copy link
Copy Markdown
Member Author

Since this fixes #3471, I might go ahead and merge it for 1.0? Or is it too late?

I just need to rebase.

…only used by minversion (and in fact for a feature that we don't really need right now. But it may be useful in other places.
…d-written comparisons. Also use save some common Numpy version tests off in the numpycompat module and use those in code rather than redefining them repeatedly.
…be used. I didn't really care here since it was in a test but might as well.
…lass just replace it with a subclass that is.
@eteq

eteq commented Feb 10, 2015

Copy link
Copy Markdown
Member

@astrofrog - what do you think about this re: 1.0? It does make sense to be more consistent on this, but it touches a lot of files... If the test pass I think I'm fine with it, though.

Should there be a changelog entry, or did you think this shouldn't be "public", @embray?

@eteq eteq mentioned this pull request Feb 10, 2015
5 of 14 tasks
@eteq

eteq commented Feb 10, 2015

Copy link
Copy Markdown
Member

Alright, we concluded it should go in for v1.0. Tests passing, so I'm going to go ahead and merge. If you think this should have a changelog entry, @embray, feel free to add it in master (and backport to v1.0.x)

eteq added a commit that referenced this pull request Feb 10, 2015
Simplify, standardize, and reduce repetition of version checks
@eteq
eteq merged commit c36bec4 into astropy:master Feb 10, 2015
@eteq eteq added this to the v1.0.0 milestone Feb 10, 2015
eteq added a commit that referenced this pull request Feb 10, 2015
Simplify, standardize, and reduce repetition of version checks
@eteq

eteq commented Feb 10, 2015

Copy link
Copy Markdown
Member

backported to v1.0.x in 1350b96

@embray
embray deleted the utils/minversion branch February 10, 2015 21:13
@embray

embray commented Feb 10, 2015

Copy link
Copy Markdown
Member Author

Oh, yeah. And I did want this to have a changelog entry before merging it. I think the minversion utility is useful for affiliated packages to know about as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants