Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/check_nitypes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
os: [windows-latest, ubuntu-latest, macos-latest]
# Type checking requires an up-to-date NumPy.
# The latest NumPy only supports 3.11 and later
# Pin to 3.14.8 to workaround AB#4147280
python-version: [3.11, 3.14.8]
# Pin to 3.14.8 and 3.15.0 to workaround AB#4147280
python-version: [3.11, 3.15.0]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repo
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/run_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
# Pin to 3.14.8 to workaround AB#4147280
python-version: [3.9, '3.10', 3.11, 3.12, 3.13, 3.14.8, 3.14t, pypy3.11]
# Pin to 3.14.8 and 3.15.0 to workaround AB#4147280
python-version: [3.11, 3.12, 3.13, 3.14.8, 3.14t, 3.15.0, 3.15t, pypy3.11]
# Fail-fast skews the pass/fail ratio and seems to make pytest produce
# incomplete JUnit XML results.
fail-fast: false
Expand All @@ -38,7 +38,12 @@ jobs:
- name: Install nitypes
run: poetry install -v
- name: Display installed dependency versions
run: poetry run pip list
run: |
# Use importlib instead of assuming that the project venv contains an up-to-date pip.
import importlib.metadata
for dist in sorted(importlib.metadata.Distribution.discover(), key=lambda d: d.name):
print(f"{dist.name}: {dist.version}")
shell: poetry run python {0}
- name: Run unit/acceptance/doc tests and code coverage
run: poetry run pytest -v --cov=nitypes --junitxml=test_results/nitypes-${{ matrix.os }}-py${{ matrix.python-version }}.xml
- name: Run benchmarks
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/run_unit_tests_oldest_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
python-version: [3.9]
python-version: [3.11]
# Fail-fast skews the pass/fail ratio and seems to make pytest produce
# incomplete JUnit XML results.
fail-fast: false
Expand Down Expand Up @@ -47,7 +47,12 @@ jobs:
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
run: poetry install -v
- name: Display installed dependency versions
run: poetry run pip list
run: |
# Use importlib instead of assuming that the project venv contains an up-to-date pip.
import importlib.metadata
for dist in sorted(importlib.metadata.Distribution.discover(), key=lambda d: d.name):
print(f"{dist.name}: {dist.version}")
shell: poetry run python {0}
- name: Run unit tests and code coverage
# Skip test___pickled_value___unpickle___is_compatible because this test's pickle data was saved with NumPy 2.x and cannot be loaded in NumPy 1.x.
run: poetry run pytest ./tests/unit -v --cov=nitypes --junitxml=test_results/nitypes-oldest-deps-${{ matrix.os }}-py${{ matrix.python-version }}.xml -k "not test___pickled_value___unpickle___is_compatible"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ See the [API Reference](https://nitypes.readthedocs.io/).

## Python Version Support

`nitypes` supports CPython 3.9+ and PyPy3.
`nitypes` supports CPython 3.11+ and PyPy3.

# Installation

Expand Down
2 changes: 1 addition & 1 deletion docs/intro.inc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Operating System Support
Python Version Support
----------------------

``nitypes`` supports CPython 3.9+ and PyPy3.
``nitypes`` supports CPython 3.11+ and PyPy3.

Installation
------------
Expand Down
1,103 changes: 155 additions & 948 deletions poetry.lock

Large diffs are not rendered by default.

23 changes: 9 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,19 @@ classifiers = [
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dynamic = ["dependencies"]
readme = "README.md"
authors = [{name = "NI", email = "opensource@ni.com"}]
maintainers = [{name = "Brad Keryan", email = "brad.keryan@ni.com"}]
requires-python = '>=3.9,<4.0'
requires-python = '>=3.11,<4.0'

[project.urls]
repository = "https://github.com/ni/nitypes-python"
Expand All @@ -37,9 +36,10 @@ packages = [{ include = "nitypes", from = "src" }]
requires-poetry = '>=2.1,<3.0'

[tool.poetry.dependencies]
# NumPy 2.0.x is the last version that supports Python 3.9, but it crashes with Python 3.13.
# NumPy 1.23.2 is the first version with binary wheels for Python 3.11. NumPy
# 1.22 crashes on Python 3.11 and NumPy 2.0.x crashes on Python 3.13.
numpy = [
{ version = ">=1.22", python = ">=3.9,<3.13" },
{ version = ">=1.23.2", python = ">=3.11,<3.13" },
{ version = ">=2.1", python = "^3.13" }
]
hightime = { version = ">=0.2.2", allow-prereleases = true }
Expand All @@ -48,10 +48,10 @@ typing-extensions = ">=4.13.2"
[tool.poetry.group.dev.dependencies]
# Specify additional NumPy version constraints to speed up locking and test with binary wheels that support PyPy.
numpy = [
{ version = ">=1.22", python = ">=3.9,<3.12", markers = "implementation_name != 'pypy'" },
{ version = ">=1.23.2", python = ">=3.11,<3.12", markers = "implementation_name != 'pypy'" },
{ version = ">=1.26", python = ">=3.12,<3.13", markers = "implementation_name != 'pypy'" },
{ version = ">=2.1", python = "^3.13", markers = "implementation_name != 'pypy'" },
{ version = ">=2.1", python = ">=3.10,<3.11", markers = "implementation_name == 'pypy'" },
{ version = ">=2.1", python = ">=3.13,<3.15", markers = "implementation_name != 'pypy'" },
{ version = ">=2.5.1", python = "^3.15", markers = "implementation_name != 'pypy'" },
{ version = ">=2.3", python = "^3.11", markers = "implementation_name == 'pypy'" },
]

Expand All @@ -76,12 +76,7 @@ tzlocal = ">=5.0"
optional = true

[tool.poetry.group.docs.dependencies]
# The latest Sphinx requires a recent Python version.
Sphinx = [
{ version = ">=7.4", python = ">=3.9,<3.10" },
{ version = ">=8.1", python = ">=3.10,<3.11" },
{ version = ">=8.2", python = "^3.11" },
]
Sphinx = ">=8.2"
sphinx-rtd-theme = ">=1.0.0"
sphinx-autoapi = ">=1.8.4"
m2r2 = ">=0.3.2"
Expand Down
11 changes: 9 additions & 2 deletions tests/unit/complex/test_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,15 @@ def test___arrays_with_static_shape___convert_complex___preserves_static_and_run
value_out_3d = convert_complex(np.complex64, value_in_3d)

assert_type(value_out_1d, np.ndarray[tuple[int], np.dtype[np.complex128]])
assert_type(value_out_2d, np.ndarray[tuple[int, int], np.dtype[ComplexInt32Base]])
assert_type(value_out_3d, np.ndarray[tuple[int, int, int], np.dtype[np.complex64]])
# With NumPy 2.5.4, Pyright infers np.ndarray[tuple[Literal[4], Literal[5]], ...]
assert_type(
value_out_2d, # pyright: ignore[reportAssertTypeFailure]
np.ndarray[tuple[int, int], np.dtype[ComplexInt32Base]],
)
assert_type(
value_out_3d, # pyright: ignore[reportAssertTypeFailure]
np.ndarray[tuple[int, int, int], np.dtype[np.complex64]],
)
assert isinstance(value_out_1d, np.ndarray) and value_out_1d.shape == (3,)
assert isinstance(value_out_2d, np.ndarray) and value_out_2d.shape == (4, 5)
assert isinstance(value_out_3d, np.ndarray) and value_out_3d.shape == (6, 7, 8)
Expand Down
Loading