Skip to content
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

Fix pint 0.9 errors from units.wraps and iterable #1087

Merged
merged 2 commits into from
Jul 6, 2019
Merged

Fix pint 0.9 errors from units.wraps and iterable #1087

merged 2 commits into from
Jul 6, 2019

Conversation

jthielen
Copy link
Collaborator

@jthielen jthielen commented Jul 5, 2019

As discussed in #997, there were two main issues with pint 0.9 and MetPy: @units.wraps and single value Quantities being evaluated as iterable. This PR implements an alternate way of ensuring matching units (and stripping the units) for the interpolation functions that previously used @units.wraps, as well as an iterable function that checks against the magnitude of the argument.

The two tests with matplotlib and scalar Quantities remain broken. I marked them as skipped for pint 0.9, but if a monkey patch of some kind based on the fix discussed in hgrecco/pint#751 is preferred, I can see what can be done.

Fixes #997.

@jthielen jthielen requested a review from dopplershift as a code owner July 5, 2019 21:35
dopplershift
dopplershift previously approved these changes Jul 5, 2019
Copy link
Member

@dopplershift dopplershift left a comment

Choose a reason for hiding this comment

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

Looks good, pending CI.

@dopplershift dopplershift added Area: Units Pertains to unit information Type: Maintenance Updates and clean ups (but not wrong) labels Jul 5, 2019
@dopplershift dopplershift added this to the 0.10.1 milestone Jul 5, 2019
@jthielen
Copy link
Collaborator Author

jthielen commented Jul 5, 2019

Pint 0.9 is still failing with Python 2.7 on Travis...if I'm seeing things correctly, @dopplershift your fix from January was merged into pint master, but still hasn't made it to release yet on pip (even though it is fixed on conda-forge...there's an open issue on pint for this: hgrecco/pint#819).

So, what should be done?

(Yet another addition to the chorus of frustration with Python 2.7...at least v0.11 should be the last release to support it?)

@dopplershift
Copy link
Member

Ok, so there's a work-around for the Python 2.7 issue by adding ImportError to the list of exceptions we catch when trying to tell pint to setup its matplotlib handling. I've added that commit to this PR so we can test if this fixes it. This PR will need a rebase onto latest master to fix the conflict with in setup.py.

@jthielen jthielen requested a review from zbruick as a code owner July 6, 2019 06:56
jthielen and others added 2 commits July 6, 2019 01:00
Pint 0.9 fails to setup matplotlib on Python 2.7. We can work around
this by catching the resulting ImportError and falling back to our
internal matplotlib unit code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Units Pertains to unit information Type: Maintenance Updates and clean ups (but not wrong)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MetPy broken by pint 0.9
2 participants