Skip to content

Commit

Permalink
support 3.9 (#2019)
Browse files Browse the repository at this point in the history
changed matplotlib test to use a build that has a pypi wheel available for python3.10
changed TypeAlias import for 3.9 compat
changed min versions
  • Loading branch information
andrewgsavage committed Jun 21, 2024
1 parent 32ccd20 commit 4c25f32
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
numpy: [null, "numpy>=1.23,<2.0.0", "numpy>=2.0.0rc1"]
uncertainties: [null, "uncertainties==3.1.6", "uncertainties>=3.1.6,<4.0.0"]
extras: [null]
include:
- python-version: "3.10" # Minimal versions
numpy: "numpy"
extras: matplotlib==2.2.5
numpy: "numpy>=1.23,<2.0.0"
extras: matplotlib==3.5.3
- python-version: "3.10"
numpy: "numpy"
uncertainties: "uncertainties"
extras: "sparse xarray netCDF4 dask[complete]==2023.4.0 graphviz babel==2.8 mip>=1.13"
extras: "sparse xarray netCDF4 dask[complete]==2024.5.1 graphviz babel==2.8 mip>=1.13"
runs-on: ubuntu-latest

env:
Expand Down
4 changes: 2 additions & 2 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Pint Changelog
==============

0.25 (unreleased)
0.24.1 (unreleased)
-----------------

- Fix custom formatter needing the registry object. (PR #2011)

- Support python 3.9 following difficulties installing with NumPy 2. (PR #2019)

0.24 (2024-06-07)
-----------------
Expand Down
6 changes: 3 additions & 3 deletions docs/user/log_units.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,16 @@ will not work:
.. doctest::

>>> -161.0 * ureg('dBm/Hz') == (-161.0 * ureg.dBm / ureg.Hz)
False
np.False_

But this will:

.. doctest::

>>> ureg('-161.0 dBm/Hz') == (-161.0 * ureg.dBm / ureg.Hz)
True
np.True_
>>> Q_(-161.0, 'dBm') / ureg.Hz == (-161.0 * ureg.dBm / ureg.Hz)
True
np.True_

To begin using this feature while avoiding problems, define logarithmic units
as single-unit quantities and convert them to their base units as quickly as
Expand Down
6 changes: 5 additions & 1 deletion pint/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@
from typing import (
Any,
NoReturn,
TypeAlias, # noqa
)

if sys.version_info >= (3, 10):
from typing import TypeAlias # noqa
else:
from typing_extensions import TypeAlias # noqa

if sys.version_info >= (3, 11):
from typing import Self # noqa
else:
Expand Down
3 changes: 1 addition & 2 deletions pint/delegates/formatter/_compound_unit_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@
TYPE_CHECKING,
Any,
Literal,
TypeAlias,
TypedDict,
TypeVar,
)

from ...compat import babel_parse
from ...compat import TypeAlias, babel_parse
from ...util import UnitsContainer

T = TypeVar("T")
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ classifiers = [
"Programming Language :: Python",
"Topic :: Scientific/Engineering",
"Topic :: Software Development :: Libraries",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
requires-python = ">=3.10"
requires-python = ">=3.9"
dynamic = ["version", "dependencies"]

[tool.setuptools.package-data]
Expand Down

0 comments on commit 4c25f32

Please sign in to comment.