Skip to content

Commit 19bd988

Browse files
nstarmanjorenham
andcommitted
Apply suggestions from code review
Co-authored-by: Joren Hammudoglu <[email protected]> Signed-off-by: Nathaniel Starkman <[email protected]>
1 parent 909f749 commit 19bd988

File tree

7 files changed

+26
-49
lines changed

7 files changed

+26
-49
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
name: CI
2-
3-
permissions:
4-
contents: read
5-
packages: read
2+
permissions: read-all
63

74
on:
85
workflow_dispatch:
96
pull_request:
107
push:
11-
branches:
12-
- main
8+
branches: [main]
139

1410
concurrency:
1511
group: ${{ github.workflow }}-${{ github.ref }}
@@ -29,20 +25,12 @@ jobs:
2925

3026
- name: Install uv
3127
uses: astral-sh/setup-uv@v6
32-
with:
33-
enable-cache: true
34-
cache-dependency-glob: "uv.lock"
35-
36-
- name: "Set up Python"
37-
uses: actions/setup-python@v5
38-
with:
39-
python-version-file: ".python-version"
4028

4129
- name: Install the project
42-
run: uv sync --group test
30+
run: uv sync --locked --group test
4331

4432
- name: Run lefthook hooks
45-
run: uv run lefthook run
33+
run: uv run --frozen lefthook run pre-commit
4634

4735
checks:
4836
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
@@ -54,30 +42,22 @@ jobs:
5442
python-version: ["3.11", "3.12", "3.13"]
5543
runs-on: [ubuntu-latest, macos-latest, windows-latest]
5644

57-
# TODO: check when pypy3.11 is available
58-
# include:
59-
# - python-version: pypy-3.11
60-
# runs-on: ubuntu-latest
61-
6245
steps:
6346
- uses: actions/checkout@v4
6447

6548
- name: Install uv
6649
uses: astral-sh/setup-uv@v6
6750
with:
68-
enable-cache: true
69-
cache-dependency-glob: "uv.lock"
70-
71-
- name: Set up Python ${{ matrix.python-version }}
72-
run: uv python install ${{ matrix.python-version }}
51+
python-version: ${{ matrix.python-version }}
7352

7453
- name: Install the project
75-
run: uv sync --group test
54+
run: uv sync --locked --group test
7655

7756
- name: Test package
7857
run: >-
79-
uv run pytest src docs tests -ra --cov --cov-report=xml
80-
--cov-report=term --durations=20
58+
uv run --frozen pytest
59+
-cov --cov-report=xml --cov-report=term --durations=20
60+
src docs tests
8161
8262
- name: Upload coverage report
8363
uses: codecov/[email protected]
@@ -100,19 +80,15 @@ jobs:
10080
- name: Install uv
10181
uses: astral-sh/setup-uv@v6
10282
with:
103-
enable-cache: true
104-
cache-dependency-glob: "uv.lock"
105-
106-
- name: Set up Python ${{ matrix.python-version }}
107-
run: uv python install ${{ matrix.python-version }}
108-
83+
python-version: ${{ matrix.python-version }}
10984
- name: Install the project
110-
run: uv sync --extra all --group test-all --resolution lowest-direct
85+
run: uv sync --locked --group test --resolution lowest-direct
11186

11287
- name: Test package
11388
run: >-
114-
uv run pytest src docs tests -ra --cov --cov-report=xml
115-
--cov-report=term --durations=20 --mpl
89+
uv run --frozen pytest
90+
--cov --cov-report=xml --cov-report=term --durations=20
91+
src docs tests
11692
11793
- name: Upload coverage report
11894
uses: codecov/[email protected]

conftest.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
"""Pytest configuration file."""
22

3+
from typing import Final
4+
35
from sybil import Sybil
46
from sybil.parsers.doctest import DocTestParser
57

6-
readme_tester = Sybil(
8+
readme_tester: Final = Sybil(
79
parsers=[DocTestParser()],
810
pattern="README.md",
911
)
1012

11-
python_file_tester = Sybil(
13+
python_file_tester: Final = Sybil(
1214
parsers=[DocTestParser()],
1315
pattern="src/**/*.py",
1416
)
1517

16-
pytest_collect_file = (readme_tester + python_file_tester).pytest()
18+
pytest_collect_file: Final = (readme_tester + python_file_tester).pytest()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ version_tuple = {version_tuple!r}
139139
]
140140

141141
[tool.ruff.lint.per-file-ignores]
142-
"tests/*.py" = ["ANN201", "S101"]
142+
"tests/*.py" = ["ANN201", "D1", "S101"]
143143

144144
[tool.ruff.lint.flake8-import-conventions]
145145
banned-from = ["array_api_typing"]

src/array_api_typing/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
"""Static typing support for the array API standard."""
22

3-
__all__ = ["HasArrayNamespace", "__version__", "__version_tuple__"]
3+
__all__ = (
4+
"HasArrayNamespace",
5+
"__version__",
6+
"__version_tuple__",
7+
)
48

59
from ._namespace import HasArrayNamespace
610
from ._version import version as __version__, version_tuple as __version_tuple__

src/array_api_typing/_namespace.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""Static typing support for the array API standard."""
2-
3-
__all__ = ["HasArrayNamespace"]
1+
__all__ = ("HasArrayNamespace",)
42

53
from types import ModuleType
64
from typing import Protocol, final

tests/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/test_namespace.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
"""Tests for the HasArrayNamespace protocol."""
2-
31
from types import SimpleNamespace
42
from typing import Protocol, runtime_checkable
53

0 commit comments

Comments
 (0)