🏷️ add py.typed (#47) #110
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
permissions: read-all | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: [main] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
UV_LOCKED: 1 | |
# Many color libraries just need this to be set to any value, but at least | |
# one distinguishes color depth, where "3" -> "256-bit color". | |
FORCE_COLOR: 3 | |
jobs: | |
lint: | |
name: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: dprint | |
uses: dprint/check@9cb3a2b17a8e606d37aae341e49df3654933fc23 # v2.3 | |
- name: Install uv | |
uses: astral-sh/setup-uv@7edac99f961f18b581bbd960d59d049f04c0002f # v6.4.1 | |
- name: ruff | |
run: | | |
uv run ruff check --output-format=github | |
uv run ruff format --check | |
# TODO: Fail if lefthook changes any files: | |
# https://github.com/data-apis/array-api-typing/pull/35/files#r2179941334 | |
- name: lefthook | |
run: uv run lefthook run pre-commit | |
- name: mypy | |
run: uv run mypy --tb --no-incremental --cache-dir=/dev/null src | |
# TODO: (based)pyright | |
test_runtime: | |
name: runtime tests | |
runs-on: ${{ matrix.runs-on }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.11", "3.12", "3.13"] | |
runs-on: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Install uv | |
uses: astral-sh/setup-uv@7edac99f961f18b581bbd960d59d049f04c0002f # v6.4.1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Test package | |
run: >- | |
uv run --group=test_runtime | |
pytest --cov --cov-report=xml --cov-report=term --durations=20 | |
- name: Upload coverage report | |
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
test_integration_numpy: | |
name: integration tests (numpy) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
numpy-version: ["1.25.0", "1.26.4", "2.0.2", "2.1.3", "2.2.6", "2.3.1"] | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: astral-sh/setup-uv@7edac99f961f18b581bbd960d59d049f04c0002f # v6.4.1 | |
with: | |
python-version: "3.11" | |
activate-environment: true | |
- name: get major numpy version | |
id: numpy-major | |
run: | | |
version=$(echo ${{ matrix.numpy-version }} | cut -c 1) | |
echo "::set-output name=version::$version" | |
- name: install deps | |
run: | | |
uv sync --no-editable --group=mypy | |
uv pip install numpy==${{ matrix.numpy-version }} | |
# NOTE: `uv run --with=...` will be ignored by mypy (and `--isolated` does not help) | |
- name: mypy | |
run: > | |
uv run --no-sync --active | |
mypy --tb --no-incremental --cache-dir=/dev/null | |
tests/integration/test_numpy${{ steps.numpy-major.outputs.version }}.pyi | |
# TODO: (based)pyright | |
# TODO: integration tests for array-api-strict | |
# TODO: integration tests for 3rd party libs such as cupy, pytorch, tensorflow, dask, etc. |