Update compatibility to include latest Pint#222
Merged
Conversation
kroenlein
commented
Aug 15, 2024
Comment on lines
+308
to
+325
| try: # Informal route changed in 0.22 | ||
| from pint.formatting import _FORMATTERS | ||
| formatter = _FORMATTERS["D"] | ||
| except ImportError: # pragma: no cover | ||
| from pint import Unit | ||
| formatter_obj = registry.formatter._formatters["D"] | ||
|
|
||
| def _surrogate_formatter(unit, registry, **options): | ||
| try: | ||
| parsed = Unit(unit) | ||
| return formatter_obj.format_unit(parsed) | ||
| except ValueError: | ||
| parsed = Unit(unit) | ||
| return formatter_obj.format_quantity(unit) | ||
|
|
||
| formatter = _surrogate_formatter | ||
|
|
||
| return formatter(unit, registry, **options) |
Collaborator
Author
There was a problem hiding this comment.
Note that this is all to support a function marked for removal in 3.0
|
LGTM! |
jspeerless
approved these changes
Aug 15, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GEMD Python PR
Description
This PR updates gemd-python to be compatible with latest (0.24.3) pint.
It marks both 0.22 and 0.23 as incompatible because these two libraries are incompatible with numpy >= 2 but are not annotated as such in their setup.py. A Python 3.8 installation is incompatible with numpy >= 2 and a Python 3.9 installation is compatible with Pint >= 0.24, so this configuration protects us from the unfortunate configuration.
It also incorporates the minor updates to the Pint default units definition file 0.23 -> 0.24.3.
https://citrine.atlassian.net/browse/SPT-1493
PR Type:
Adherence to team decisions