Skip to content

Commit ab6e200

Browse files
authored
Merge branch 'main' into array-api-implementation
2 parents c704259 + 3fac19a commit ab6e200

19 files changed

Lines changed: 644 additions & 44 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ jobs:
4646
os: [ubuntu-latest]
4747
include:
4848
- env:
49-
name: hatch-test.py3.13-full
50-
python: "3.13"
49+
name: hatch-test.py3.14-full
50+
python: "3.14"
5151
os: macos-latest
5252
steps:
5353
- uses: actions/checkout@v6
@@ -77,7 +77,7 @@ jobs:
7777
with: { fetch-depth: 0, filter: "blob:none" }
7878
- uses: actions/setup-python@v6
7979
with:
80-
python-version: '3.13'
80+
python-version: '3.14'
8181
- uses: astral-sh/setup-uv@v7
8282
- run: uv pip install --system --group=test -e .[full]
8383
- uses: CodSpeedHQ/action@v3
@@ -92,7 +92,7 @@ jobs:
9292
with: { fetch-depth: 0, filter: "blob:none" }
9393
- uses: actions/setup-python@v6
9494
with:
95-
python-version: '3.13'
95+
python-version: '3.14'
9696
- uses: astral-sh/setup-uv@v7
9797
- run: uv pip install --system -e .
9898
- run: python -c 'import fast_array_utils as fau; print(fau.__all__)'

.pre-commit-config.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,27 @@ repos:
66
- id: trailing-whitespace
77
- id: no-commit-to-branch
88
- repo: https://github.com/astral-sh/ruff-pre-commit
9-
rev: v0.15.6
9+
rev: v0.15.11
1010
hooks:
1111
- id: ruff-check
1212
args: [--fix, --exit-non-zero-on-fix]
1313
- id: ruff-check
1414
args: [--preview, --select=CPY]
1515
- id: ruff-format
1616
- repo: https://github.com/tox-dev/pyproject-fmt
17-
rev: v2.18.1
17+
rev: v2.21.1
1818
hooks:
1919
- id: pyproject-fmt
2020
- repo: https://github.com/biomejs/pre-commit
21-
rev: v2.4.7
21+
rev: v2.4.12
2222
hooks:
2323
- id: biome-format
2424
- repo: https://github.com/pre-commit/mirrors-mypy
25-
rev: v1.19.1
25+
rev: v1.20.1
2626
hooks:
2727
- id: mypy
2828
args: [--config-file=pyproject.toml, .]
2929
pass_filenames: false
30-
language_version: '3.13'
3130
additional_dependencies:
3231
- anndata>=0.12
3332
- array-api-compat>=1.13

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2
22
build:
33
os: ubuntu-24.04
44
tools:
5-
python: "3.13"
5+
python: "3.14"
66
jobs:
77
create_environment:
88
- asdf plugin add uv

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@
1717
},
1818
"python.testing.pytestArgs": ["-vv", "--color=yes", "-m", "not benchmark"],
1919
"python.testing.pytestEnabled": true,
20+
"python-envs.defaultEnvManager": "flying-sheep.hatch:hatch",
21+
"python-envs.defaultPackageManager": "flying-sheep.hatch:hatch",
2022
}

docs/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@
7171
zarr=("https://zarr.readthedocs.io/en/stable/", None),
7272
)
7373
nitpick_ignore = [
74+
("py:class", "P"),
75+
("py:class", "R"),
7476
("py:class", "Arr"),
7577
("py:class", "Array"),
7678
("py:class", "ToDType"),

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
fast-array-utils <self>
88
conv
99
stats
10+
numba
1011
typing
1112
testing
1213

docs/numba.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
``fast_array_utils.numba``
2+
==========================
3+
4+
.. automodule:: fast_array_utils.numba
5+
:members:

pyproject.toml

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ envs.hatch-test.overrides.matrix.resolution.dependencies = [
8484
{ if = [ "lowest" ], value = "scipy==1.13.0" },
8585
]
8686
envs.hatch-test.matrix = [
87-
{ python = [ "3.13", "3.12" ], extras = [ "full", "min" ] },
87+
{ python = [ "3.14", "3.12" ], extras = [ "full", "min" ] },
8888
{ python = [ "3.12" ], extras = [ "full" ], resolution = [ "lowest" ] },
8989
]
9090
metadata.hooks.docstring-description = {}
@@ -139,6 +139,20 @@ lint.isort.lines-after-imports = 2
139139
lint.pydocstyle.convention = "numpy"
140140
lint.future-annotations = true
141141

142+
[tool.mypy]
143+
strict = true
144+
# https://github.com/dask/dask/issues/8853
145+
implicit_reexport = true
146+
explicit_package_bases = true
147+
mypy_path = [ "$MYPY_CONFIG_FILE_DIR/typings", "$MYPY_CONFIG_FILE_DIR/src" ]
148+
149+
[tool.pyright]
150+
stubPath = "./typings"
151+
reportPrivateUsage = false
152+
153+
[tool.ty]
154+
environment.extra-paths = [ "./typings" ]
155+
142156
[tool.pytest]
143157
strict = true
144158
addopts = [
@@ -151,38 +165,18 @@ testpaths = [ "./tests", "fast_array_utils" ]
151165
doctest_subpackage_requires = [
152166
"src/fast_array_utils/conv/scipy/* = scipy",
153167
"src/fast_array_utils/conv/scipy/_to_dense.py = numba",
168+
"src/fast_array_utils/numba/* = numba",
154169
"src/fast_array_utils/stats/* = numba",
155170
"src/fast_array_utils/_plugins/dask.py = dask",
156171
"src/fast_array_utils/_plugins/numba_sparse.py = numba;scipy",
157172
]
158-
filterwarnings = [
159-
"error",
160-
# codspeed seems to break this dtype added by h5py
161-
"ignore:.*numpy[.]longdouble:UserWarning",
162-
"ignore:FNV hashing is not implemented in Numba:UserWarning",
163-
]
164173
markers = [
165174
"benchmark: marks tests as benchmark (to run with `--codspeed`)",
166175
]
167176

168177
[tool.coverage]
169178
run.data_file = "test-data/.coverage"
170179
run.omit = [ "src/testing/*", "tests/*" ]
171-
report.exclude_also = [ "@numba[.]njit", "[.]{3}", "if TYPE_CHECKING:" ]
180+
report.exclude_also = [ "@(numba[.])?njit", "[.]{3}", "if TYPE_CHECKING:" ]
172181
html.directory = "test-data/htmlcov"
173182
xml.output = "test-data/coverage.xml"
174-
175-
[tool.mypy]
176-
strict = true
177-
# https://github.com/dask/dask/issues/8853
178-
implicit_reexport = true
179-
explicit_package_bases = true
180-
mypy_path = [ "$MYPY_CONFIG_FILE_DIR/typings", "$MYPY_CONFIG_FILE_DIR/src" ]
181-
182-
[[tool.mypy.overrides]]
183-
module = [ "jax", "jax.*" ]
184-
ignore_missing_imports = true
185-
186-
[tool.pyright]
187-
stubPath = "./typings"
188-
reportPrivateUsage = false

src/fast_array_utils/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@
88
This submodule requires :doc:`numba <numba:index>` to be installed
99
and contains statistics utilities.
1010
11+
:mod:`fast_array_utils.numba`
12+
This submodule contains numba utilities.
13+
1114
:mod:`fast_array_utils.typing` and :mod:`fast_array_utils.types`
1215
These submodules contain types for annotations and checks, respectively.
1316
Stubs for these types are available even if the respective packages are not installed.
1417
"""
1518

1619
from __future__ import annotations
1720

18-
from . import _plugins, conv, stats, types
21+
from . import _plugins, conv, numba, stats, types
1922

2023

21-
__all__ = ["conv", "stats", "types"]
24+
__all__ = ["conv", "numba", "stats", "types"]
2225

2326
_plugins.patch_dask()
2427
_plugins.register_numba_sparse()

src/fast_array_utils/conv/scipy/_to_dense.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
import numba
77

8+
from ...numba import njit
9+
810

911
if TYPE_CHECKING:
1012
from typing import Any
@@ -18,14 +20,14 @@
1820
__all__ = ["_to_dense_csc_numba", "_to_dense_csr_numba"]
1921

2022

21-
@numba.njit(cache=True)
23+
@njit
2224
def _to_dense_csc_numba(x: CSBase, out: NDArray[np.number[Any]]) -> None:
2325
for c in numba.prange(out.shape[1]):
2426
for i in range(x.indptr[c], x.indptr[c + 1]):
2527
out[x.indices[i], c] = x.data[i]
2628

2729

28-
@numba.njit(cache=True)
30+
@njit
2931
def _to_dense_csr_numba(x: CSBase, out: NDArray[np.number[Any]]) -> None:
3032
for r in numba.prange(out.shape[0]):
3133
for i in range(x.indptr[r], x.indptr[r + 1]):

0 commit comments

Comments
 (0)