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
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:
- name: typos
uses: crate-ci/[email protected]

- uses: astral-sh/[email protected].2
- uses: astral-sh/[email protected].3
with:
python-version: "3.13"
python-version: "3.14"

- name: ruff check
run: uv run ruff check --output-format=github
Expand All @@ -60,10 +60,13 @@ jobs:
np: "1.25"
- py: "3.13"
np: "2.0"
include:
- py: "3.14"
np: "2.3"
steps:
- uses: actions/[email protected]

- uses: astral-sh/[email protected].2
- uses: astral-sh/[email protected].3
with:
activate-environment: true
python-version: ${{ matrix.py }}
Expand Down Expand Up @@ -108,7 +111,7 @@ jobs:
steps:
- uses: actions/[email protected]

- uses: astral-sh/[email protected].2
- uses: astral-sh/[email protected].3
with:
python-version: ${{ matrix.py }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
steps:
- uses: actions/[email protected]

- uses: astral-sh/[email protected].2
- uses: astral-sh/[email protected].3
with:
python-version: "3.13"
python-version: "3.14"

- name: uv build
run: uv build
Expand Down
20 changes: 10 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["uv_build>=0.9.0,<0.10.0"]
requires = ["uv_build>=0.9.8,<0.10.0"]
build-backend = "uv_build"

[tool.uv.build-backend]
Expand Down Expand Up @@ -68,19 +68,19 @@ extra = [
]
lint = [
"dprint-py>=0.50.2.0",
"ruff>=0.14.0",
"sp-repo-review[cli]>=2025.10.1",
"ruff>=0.14.4",
"sp-repo-review[cli]>=2025.11.10",
]
test = [
{ include-group = "extra" },
"beartype>=0.22.2",
"pytest>=8.4.2",
"beartype>=0.22.5",
"pytest>=9.0.0",
"typing-extensions>=4.15.0",
]
type = [
{ include-group = "extra" },
{ include-group = "test" },
"basedpyright>=1.31.7",
"basedpyright>=1.33.0",
"mypy[faster-cache]>=1.18.2",
"pyrefly==0.40.1",
]
Expand Down Expand Up @@ -138,14 +138,14 @@ reportUnusedVariable = false # dupe of F841

# pytest

[tool.pytest.ini_options]
minversion = "8.0"
[tool.pytest]
minversion = "9.0"
testpaths = ["optype", "examples", "tests"]
addopts = ["-ra", "--doctest-modules", "--strict-config", "--strict-markers"]
addopts = ["-ra", "--doctest-modules"]
doctest_optionflags = ["NORMALIZE_WHITESPACE", "IGNORE_EXCEPTION_DETAIL", "ELLIPSIS"]
filterwarnings = ["error"]
log_cli_level = "INFO"
xfail_strict = true
strict = true

# repo-review

Expand Down
54 changes: 27 additions & 27 deletions tests/numpy/test_any_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,46 @@
# All allowed arguments that when passed to `np.array`, will result in an
# array of the specified scalar type(s).

_UNSIGNED_INTEGER_NP: Final = (
_UNSIGNED_INTEGER_NP: Final = {
np.uint8, np.uint16, np.uint32, np.uint64, np.uintp,
np.ubyte, np.ushort, np.uintc, ulong, np.ulonglong,
) # fmt: skip
_UNSIGNED_INTEGER_CT: Final = (
} # fmt: skip
_UNSIGNED_INTEGER_CT: Final = {
ct.c_uint8, ct.c_uint16, ct.c_uint32, ct.c_uint64, ct.c_size_t,
ct.c_ubyte, ct.c_ushort, ct.c_uint, ct.c_ulong, ct.c_ulonglong,
) # fmt: skip
UNSIGNED_INTEGER: Final = *_UNSIGNED_INTEGER_NP, *_UNSIGNED_INTEGER_CT
_SIGNED_INTEGER_NP: Final = (
} # fmt: skip
UNSIGNED_INTEGER: Final = _UNSIGNED_INTEGER_NP | _UNSIGNED_INTEGER_CT
_SIGNED_INTEGER_NP: Final = {
np.int8, np.int16, np.int32, np.int64, np.intp,
np.byte, np.short, np.intc, long, np.longlong,
) # fmt: skip
_SIGNED_INTEGER_CT: Final = (
} # fmt: skip
_SIGNED_INTEGER_CT: Final = {
ct.c_int8, ct.c_int16, ct.c_int32, ct.c_int64, ct.c_ssize_t,
ct.c_byte, ct.c_short, ct.c_int, ct.c_long, ct.c_longlong,
) # fmt: skip
SIGNED_INTEGER: Final = *_SIGNED_INTEGER_NP, *_SIGNED_INTEGER_CT
INTEGER: Final = *UNSIGNED_INTEGER, *SIGNED_INTEGER
} # fmt: skip
SIGNED_INTEGER: Final = _SIGNED_INTEGER_NP | _SIGNED_INTEGER_CT
INTEGER: Final = UNSIGNED_INTEGER | SIGNED_INTEGER

_FLOATING_NP: Final = (
_FLOATING_NP: Final = {
np.float16, np.float32, np.float64,
np.half, np.single, np.double, np.longdouble,
) # fmt: skip
_FLOATING_CT: Final = ct.c_float, ct.c_double
FLOATING: Final = *_FLOATING_NP, *_FLOATING_CT
COMPLEX_FLOATING: Final = (
} # fmt: skip
_FLOATING_CT: Final = {ct.c_float, ct.c_double}
FLOATING: Final = _FLOATING_NP | _FLOATING_CT
COMPLEX_FLOATING: Final = {
np.complex64, np.complex128, np.csingle, np.cdouble, np.clongdouble,
) # fmt: skip
DATETIME64: Final = np.datetime64, dt.datetime
TIMEDELTA64: Final = np.timedelta64, dt.timedelta
STR: Final = np.str_, str
BYTES: Final = np.bytes_, ct.c_char, bytes
CHARACTER: Final = *STR, *BYTES
} # fmt: skip
DATETIME64: Final = {np.datetime64, dt.datetime}
TIMEDELTA64: Final = {np.timedelta64, dt.timedelta}
STR: Final = {np.str_, str}
BYTES: Final = {np.bytes_, ct.c_char, bytes}
CHARACTER: Final = STR | BYTES
# TODO(jorenham): structured dtype support
# https://github.com/jorenham/optype/issues/371
VOID: Final = (np.void,)
FLEXIBLE: Final = *VOID, *CHARACTER
BOOL: Final = np.bool_, ct.c_bool, bool
OBJECT: Final = np.object_, ct.py_object
VOID: Final = {np.void}
FLEXIBLE: Final = VOID | CHARACTER
BOOL: Final = {np.bool_, ct.c_bool, bool}
OBJECT: Final = {np.object_, ct.py_object}


def _shape(a: object, /) -> tuple[int, ...]:
Expand Down Expand Up @@ -223,7 +223,7 @@ def test_any_flexible_array(
assert np.issubdtype(x.dtype, np.flexible)


@pytest.mark.parametrize("sctype", BOOL)
@pytest.mark.parametrize("sctype", BOOL, ids="{0.__module__}.{0.__qualname__}".format)
def test_any_bool_array(sctype: type[bool | np.bool_ | _ct.Bool]) -> None:
x = np.array(sctype(True))
x_any: onp.AnyBoolArray = x
Expand Down
3 changes: 2 additions & 1 deletion tests/numpy/test_is.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
else:
CHARS = "?BbHhIiLlQqPpefdgFDGSUVOMm" # pyright: ignore[reportConstantRedefinition]

DTYPES = [np.dtype(char) for char in CHARS]
# dtypes aren't hashable on numpy<2
DTYPES = set({str(np.dtype(char)): np.dtype(char) for char in CHARS}.values())
SCTYPES = {dtype.type for dtype in DTYPES if issubclass(dtype.type, np.generic)}
NDARRAY_TYPES = np.ndarray, np.ma.MaskedArray

Expand Down
30 changes: 15 additions & 15 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.