Skip to content

Commit 4b77c67

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 4b77c67

File tree

7 files changed

+26
-40
lines changed

7 files changed

+26
-40
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 29 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 }}
@@ -31,18 +27,12 @@ jobs:
3127
uses: astral-sh/setup-uv@v6
3228
with:
3329
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"
4030

4131
- name: Install the project
42-
run: uv sync --group test
32+
run: uv sync --locked --group test
4333

4434
- name: Run lefthook hooks
45-
run: uv run lefthook run
35+
run: uv run --frozen lefthook run pre-commit
4636

4737
checks:
4838
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
@@ -66,18 +56,16 @@ jobs:
6656
uses: astral-sh/setup-uv@v6
6757
with:
6858
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 }}
59+
python-version: ${{ matrix.python-version }}
7360

7461
- name: Install the project
75-
run: uv sync --group test
62+
run: uv sync --locked --group test
7663

7764
- name: Test package
7865
run: >-
79-
uv run pytest src docs tests -ra --cov --cov-report=xml
80-
--cov-report=term --durations=20
66+
uv run --frozen pytest
67+
-cov --cov-report=xml --cov-report=term --durations=20
68+
src docs tests
8169
8270
- name: Upload coverage report
8371
uses: codecov/[email protected]
@@ -101,18 +89,15 @@ jobs:
10189
uses: astral-sh/setup-uv@v6
10290
with:
10391
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-
92+
python-version: ${{ matrix.python-version }}
10993
- name: Install the project
110-
run: uv sync --extra all --group test-all --resolution lowest-direct
94+
run: uv sync --locked --group test --resolution lowest-direct
11195

11296
- name: Test package
11397
run: >-
114-
uv run pytest src docs tests -ra --cov --cov-report=xml
115-
--cov-report=term --durations=20 --mpl
98+
uv run --frozen pytest
99+
--cov --cov-report=xml --cov-report=term --durations=20
100+
src docs tests
116101
117102
- name: Upload coverage report
118103
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
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
"""Tests."""

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)