From 12560f0b5236c1e85dae91ad2a1e0923cb291995 Mon Sep 17 00:00:00 2001 From: Ken Kroenlein Date: Fri, 15 Dec 2023 15:59:40 -0700 Subject: [PATCH 1/2] Add compatibility for latest Pint release --- gemd/units/impl.py | 5 ++++- requirements.txt | 3 --- setup.py | 4 ++-- test_requirements.txt | 3 +++ 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gemd/units/impl.py b/gemd/units/impl.py index 5e18ca27..9c9c52e8 100644 --- a/gemd/units/impl.py +++ b/gemd/units/impl.py @@ -8,7 +8,10 @@ from typing import Union, List, Tuple, Generator, Any from pint import UnitRegistry, Unit, register_unit_format -from pint.compat import tokenizer +try: # Pint 0.23 migrated the location of this method, and augmented it + from pint.pint_eval import tokenizer +except ImportError: + from pint.compat import tokenizer from tokenize import NAME, NUMBER, OP, ERRORTOKEN, TokenInfo # alias the error that is thrown when units are incompatible # this helps to isolate the dependence on pint diff --git a/requirements.txt b/requirements.txt index 1ec0897e..5c53781c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,2 @@ pint==0.20 -sphinx==4.3.0 -sphinxcontrib-apidoc==0.3.0 -sphinx-rtd-theme==1.0.0 deprecation==2.1.0 diff --git a/setup.py b/setup.py index a2e28811..b753863c 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ packages.append("") setup(name='gemd', - version='1.16.7', + version='1.16.8', python_requires='>=3.8', url='http://github.com/CitrineInformatics/gemd-python', description="Python binding for Citrine's GEMD data model", @@ -23,7 +23,7 @@ 'tests.units': ['test_units.txt'] }, install_requires=[ - "pint>=0.20,<0.23", + "pint>=0.20,<0.24", "deprecation>=2.1.0,<3" ], extras_require={ diff --git a/test_requirements.txt b/test_requirements.txt index 339caa06..4264feee 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -5,3 +5,6 @@ pytest-cov==4.0.0 pandas==1.5.0 toolz==0.12.0 derp==0.1.1 +sphinx==4.3.0 +sphinxcontrib-apidoc==0.3.0 +sphinx-rtd-theme==1.0.0 From 30fe1f746640d50d3b2a8dd1c3300ad64fa77094 Mon Sep 17 00:00:00 2001 From: Ken Kroenlein Date: Fri, 15 Dec 2023 16:10:14 -0700 Subject: [PATCH 2/2] Add no-cover to version-dependent import --- gemd/units/impl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gemd/units/impl.py b/gemd/units/impl.py index 9c9c52e8..6fe24b7e 100644 --- a/gemd/units/impl.py +++ b/gemd/units/impl.py @@ -10,7 +10,7 @@ from pint import UnitRegistry, Unit, register_unit_format try: # Pint 0.23 migrated the location of this method, and augmented it from pint.pint_eval import tokenizer -except ImportError: +except ImportError: # pragma: no cover from pint.compat import tokenizer from tokenize import NAME, NUMBER, OP, ERRORTOKEN, TokenInfo # alias the error that is thrown when units are incompatible