Skip to content

Commit

Permalink
Merge pull request #232 from neutrinoceros/dep/drop_cp310
Browse files Browse the repository at this point in the history
DEP: drop support for CPython 3.10 and numpy<1.25
  • Loading branch information
neutrinoceros authored Aug 4, 2024
2 parents afc46b8 + 7ca0e36 commit 824b566
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 86 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
python-version: 3.x
- uses: yezz123/setup-uv@v4
with:
uv-version: 0.2.18
uv-version: 0.2.33
uv-venv: .venv
- run: uv pip install check-manifest build
- name: Check build
Expand All @@ -43,7 +43,6 @@ jobs:
os:
- ubuntu-latest
python-version:
- '3.10'
- '3.11'
- '3.12'
marker: [''] # needed to avoid collision with PY_LIB job
Expand All @@ -57,7 +56,7 @@ jobs:
# test with minimal requirements
- marker: minimal
os: ubuntu-20.04
python-version: '3.10'
python-version: '3.11'
deps: minimal

# test GPGI_PY_LIB
Expand All @@ -76,7 +75,7 @@ jobs:

- uses: yezz123/setup-uv@v4
with:
uv-version: 0.2.18
uv-version: 0.2.33
uv-venv: .venv

- if: matrix.deps == 'minimal'
Expand Down Expand Up @@ -122,7 +121,7 @@ jobs:

- uses: yezz123/setup-uv@v4
with:
uv-version: 0.2.18
uv-version: 0.2.33
uv-venv: .venv

- name: Build library
Expand Down Expand Up @@ -176,7 +175,7 @@ jobs:

- uses: yezz123/setup-uv@v4
with:
uv-version: 0.2.18
uv-version: 0.2.33
uv-venv: .venv

- run: uv pip install 'coverage[toml]'
Expand Down Expand Up @@ -204,7 +203,7 @@ jobs:
strategy:
matrix:
python-version:
- '3.10'
- '3.11'
- '3.12'
runs-on: ubuntu-latest
name: type check
Expand All @@ -220,7 +219,7 @@ jobs:

- uses: yezz123/setup-uv@v4
with:
uv-version: 0.2.18
uv-version: 0.2.33
uv-venv: .venv

- name: Build
Expand Down Expand Up @@ -251,7 +250,7 @@ jobs:

- uses: yezz123/setup-uv@v4
with:
uv-version: 0.2.18
uv-version: 0.2.33
uv-venv: .venv

- name: Build
Expand Down
10 changes: 4 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ classifiers = [
"Programming Language :: Cython",
"Programming Language :: Python :: 3",
]
requires-python = ">=3.10"
requires-python = ">=3.11"
dependencies = [
# keep in sync with NPY_TARGET_VERSION (setup.py)
# https://github.com/scipy/oldest-supported-numpy/issues/76#issuecomment-1628865694
"numpy>=1.23, <3",
"typing-extensions>=4.1.0 ; python_version < '3.11'",
"numpy>=1.25, <3",
]

[project.readme]
Expand Down Expand Up @@ -103,7 +101,7 @@ convention = "numpy"
"_backports.py" = ["D"]

[tool.mypy]
python_version = "3.10"
python_version = "3.11"
show_error_codes = true
pretty = true
warn_return_any = true
Expand All @@ -124,7 +122,7 @@ filterwarnings = [
]

[tool.cibuildwheel]
build = "cp310-* cp311-* cp312-*"
build = "cp311-* cp312-*"
build-frontend = "build[uv]"
build-verbosity = 1
test-skip = "*-musllinux*"
Expand Down
2 changes: 2 additions & 0 deletions requirements/tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ coverage[toml]>=6.5
pytest>=7.0.0
pytest-mpl>=0.16.1
matplotlib>=3.5
# https://github.com/matplotlib/matplotlib/issues/28551
matplotlib!=3.9.1 ; platform_system=='Windows'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
include_dirs=[np.get_include()],
define_macros=[
# keep in sync with runtime requirements (pyproject.toml)
("NPY_TARGET_VERSION", "NPY_1_23_API_VERSION"),
("NPY_TARGET_VERSION", "NPY_1_25_API_VERSION"),
("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION"),
],
)
Expand Down
44 changes: 0 additions & 44 deletions src/gpgi/_backports.py

This file was deleted.

8 changes: 1 addition & 7 deletions src/gpgi/_typing.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import sys
from typing import TypedDict, TypeVar
from typing import NotRequired, TypedDict, TypeVar

import numpy as np
import numpy.typing as npt

if sys.version_info >= (3, 11):
from typing import NotRequired
else:
from typing_extensions import NotRequired

Real = TypeVar("Real", np.float32, np.float64)
RealArray = npt.NDArray[Real]
HCIArray = npt.NDArray[np.uint16]
Expand Down
21 changes: 2 additions & 19 deletions src/gpgi/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

import enum
import math
import sys
import warnings
from abc import ABC, abstractmethod
from copy import deepcopy
from enum import StrEnum
from functools import cached_property, partial, reduce
from itertools import chain
from textwrap import indent
from time import monotonic_ns
from typing import TYPE_CHECKING, Any, Literal, Protocol, cast
from typing import TYPE_CHECKING, Any, Literal, Protocol, Self, assert_never, cast

import numpy as np

Expand All @@ -31,15 +31,6 @@
)
from ._typing import FieldMap, Name

if sys.version_info >= (3, 11):
from enum import StrEnum
from typing import Self, assert_never
else:
from typing_extensions import Self, assert_never

from ._backports import StrEnum


if TYPE_CHECKING:
from ._typing import HCIArray, RealArray

Expand All @@ -53,14 +44,6 @@ class Geometry(StrEnum):
SPHERICAL = enum.auto()
EQUATORIAL = enum.auto()

if sys.version_info >= (3, 11):
pass
else:

def __str__(self) -> str:
r"""Return str(self)."""
return self.name.lower()


class DepositionMethod(enum.Enum):
NEAREST_GRID_POINT = enum.auto()
Expand Down

0 comments on commit 824b566

Please sign in to comment.