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: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
version: 2
updates:
- package-ecosystem: pre-commit
directory: /
labels:
- run-gpu-ci
schedule:
interval: weekly
cooldown:
default-days: 7
groups:
pre-commit:
patterns: ["*"]
- package-ecosystem: github-actions
directory: /
labels:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# The workflow name is mandated by autofix.ci.
# It needs to be a dedicated workflow, as autofix.ci times out on long runs.
name: autofix.ci

on:
pull_request:
branches: [main]

permissions:
contents: read

jobs:
lint:
name: Pre-commit checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with: { fetch-depth: 0, filter: "blob:none", persist-credentials: false }
- uses: astral-sh/setup-uv@v10.1.0
with:
enable-cache: true
- run: uv tool install hatch
- name: Run pre-commit hooks
run: uvx prek run --all-files --show-diff-on-failure --color=always
- uses: autofix-ci/action@v1.3.4
if: '!cancelled()'
2 changes: 1 addition & 1 deletion .github/workflows/ci-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
steps:
- uses: flying-sheep/check@v1
with:
success: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'run-gpu-ci') || github.event.pull_request.user.login == 'pre-commit-ci[bot]' }}
success: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'run-gpu-ci') }}
test:
name: All Tests
needs: check
Expand Down
10 changes: 0 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,6 @@ jobs:
- run: python -c 'import fast_array_utils as fau; print(fau.__all__)'
- run: uv pip install --system -e .[testing]
- run: python -c 'import testing.fast_array_utils as tfau; print(tfau.ArrayType("numpy", "ndarray"))'
check:
name: Static Checks
runs-on: ubuntu-latest
env:
SKIP: no-commit-to-branch # this CI runs on the main branch
steps:
- uses: actions/checkout@v7
with: { fetch-depth: 0, filter: "blob:none" }
- uses: j178/prek-action@v3.0.0
pass:
name: All Checks
if: always()
Expand All @@ -123,7 +114,6 @@ jobs:
- test
- bench
- import
- check
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@release/v1
Expand Down
35 changes: 12 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ repos:
rev: v6.0.0
hooks:
- id: end-of-file-fixer
groups: [format]
- id: trailing-whitespace
groups: [format]
- id: no-commit-to-branch
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.8
Expand All @@ -13,37 +15,24 @@ repos:
- id: ruff-check
args: [--preview, --select=CPY]
- id: ruff-format
groups: [format]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.29.4
hooks:
- id: pyproject-fmt
groups: [format]
- repo: https://github.com/biomejs/pre-commit
rev: v2.5.14
hooks:
- id: biome-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v2.3.1
groups: [format]
- repo: local
hooks:
- id: mypy
args: [--config-file=pyproject.toml, .]
name: mypy
entry: hatch check types
language: system
types_or: [python, pyi]
require_serial: true
pass_filenames: false
additional_dependencies:
- anndata>=0.12
- array-api-compat>=1.13,!=1.15.0 # https://github.com/data-apis/array-api-compat/issues/436
- dask>=2026.1
- h5py>=3.15
- jax>=0.10
- numba>=0.63
- packaging>=26
- pytest>=9
- pytest-codspeed>=4.3
- scikit-learn>=1.8
- scipy-stubs>=1.17
- sphinx>=9
- types-array-api>=1.3
- types-docutils>=0.22
- zarr>=3.1
ci:
autoupdate_commit_msg: 'ci: pre-commit autoupdate'
skip:
- mypy # too big
groups: [typecheck]
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ test-min = [
"pytest-doctestplus",
"pytest-xdist",
]
typecheck = [
"array-api-compat!=1.15", # https://github.com/data-apis/array-api-compat/issues/436
"mypy",
"scipy-stubs",
"sphinx",
]

[tool.hatch]
version.source = "vcs"
Expand All @@ -75,6 +81,14 @@ envs.docs.scripts.build = "sphinx-build -M html docs docs/_build"
envs.docs.scripts.clean = "git clean -fdX docs"
envs.docs.scripts.open = "python -m webbrowser -t docs/_build/html/index.html"
envs.docs.dependency-groups = [ "doc" ]
envs.hatch-check-code.dependencies = [ "prek" ]
envs.hatch-check-code.scripts.lint-check = "echo 'try `hatch check code --fix`'; false"
envs.hatch-check-code.scripts.lint-fix = "prek run -a --no-group=format --no-group=typecheck"
envs.hatch-check-fmt.dependencies = [ "prek" ]
envs.hatch-check-fmt.scripts.format-check = "echo 'try `hatch check fmt --fix`'; false"
envs.hatch-check-fmt.scripts.format-fix = "prek run -a --group=format --no-group=typecheck"
envs.hatch-check-types.scripts.check = [ "mypy" ]
envs.hatch-check-types.dependency-groups = [ "typecheck", "test" ]
envs.hatch-test.extra-dependencies = [ "ipycytoscape", "ipykernel" ]
envs.hatch-test.env-vars.CODSPEED_PROFILE_FOLDER = "test-data/codspeed"
envs.hatch-test.matrix = [
Expand Down Expand Up @@ -140,6 +154,7 @@ lint.future-annotations = true

[tool.mypy]
mypy_path = [ "$MYPY_CONFIG_FILE_DIR/typings", "$MYPY_CONFIG_FILE_DIR/src" ]
files = [ "." ]
explicit_package_bases = true
# https://github.com/dask/dask/issues/8853
implicit_reexport = true
Expand Down
1 change: 0 additions & 1 deletion typings/llvmlite/__init__.pyi

This file was deleted.

38 changes: 3 additions & 35 deletions typings/numba/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,42 +1,10 @@
# SPDX-License-Identifier: MPL-2.0
from collections.abc import Callable, Iterable
from typing import Literal, SupportsIndex, overload
from collections.abc import Iterable
from typing import SupportsIndex, overload

from .core import config as config
from .core.types import Type
from .core.decorators import njit as njit

type __Signature = str | Type
type _Signature = str | Type | tuple[__Signature, ...]

# https://numba.readthedocs.io/en/stable/reference/jit-compilation.html#numba.jit
@overload
def njit[F: Callable[..., object]](
f: F,
*,
nopython: bool = True,
nogil: bool = False,
cache: bool = False,
forceobj: bool = False,
parallel: bool = False,
error_model: Literal["python", "numpy"] = "python",
fastmath: bool = False,
locals: dict[str, object] = {},
boundscheck: bool = False,
) -> F: ...
@overload
def njit[F: Callable[..., object]](
signature: _Signature | list[_Signature] | None = None,
*,
nopython: bool = True,
nogil: bool = False,
cache: bool = False,
forceobj: bool = False,
parallel: bool = False,
error_model: Literal["python", "numpy"] = "python",
fastmath: bool = False,
locals: dict[str, object] = {},
boundscheck: bool = False,
) -> Callable[[F], F]: ...
@overload
def prange(stop: SupportsIndex, /) -> Iterable[int]: ...
@overload
Expand Down
2 changes: 0 additions & 2 deletions typings/numba/core/base.pyi

This file was deleted.

2 changes: 0 additions & 2 deletions typings/numba/core/datamodel/__init__.pyi

This file was deleted.

2 changes: 0 additions & 2 deletions typings/numba/core/datamodel/manager.pyi

This file was deleted.

6 changes: 0 additions & 6 deletions typings/numba/core/datamodel/registry.pyi

This file was deleted.

5 changes: 0 additions & 5 deletions typings/numba/core/typing/templates.pyi

This file was deleted.

15 changes: 0 additions & 15 deletions typings/numba/core/typing/typeof.pyi

This file was deleted.

2 changes: 0 additions & 2 deletions typings/numba/extending.pyi

This file was deleted.

Loading