Skip to content
Draft
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
4 changes: 4 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ on:
workflow_call:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
name: Build distributions
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:

test:
name: Test
needs: build
uses: ./.github/workflows/test.yaml
secrets: inherit

Expand Down
27 changes: 19 additions & 8 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,38 @@ on:
workflow_call:
workflow_dispatch:

permissions:
contents: read

concurrency: lint-${{ github.sha }}

jobs:
lint:
name: Lint and type check with Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
env:
PYTHON_VERSION: "3.10"
strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Python ${{ env.PYTHON_VERSION }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Install the project
run: uv sync --all-extras --dev
- name: Install project dependencies
run: uv sync --all-groups --python ${{ matrix.python-version }}

- name: Run pre-commit hooks
uses: pre-commit/action@v3.0.1
- name: Run hooks
uses: j178/prek-action@v1
33 changes: 27 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,51 @@ on:
workflow_call:
workflow_dispatch:

permissions:
contents: read

concurrency: test-${{ github.sha }}

jobs:
test:
name: Test with Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
env:
PYTHON_VERSION: "3.10"
CONTIGUITY_PROJECT_ID: ${{ secrets.CONTIGUITY_PROJECT_ID }}
CONTIGUITY_TOKEN: ${{ secrets.CONTIGUITY_TOKEN }}
CONTIGUITY_DATA_KEY: ${{ secrets.CONTIGUITY_DATA_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Python ${{ env.PYTHON_VERSION }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Install the project
run: uv sync --all-extras --dev
- name: Install project dependencies
run: uv sync --no-install-project --all-groups --python ${{ matrix.python-version }}

- name: Download sdist artifact
uses: actions/download-artifact@v6
with:
name: sdist
path: ./dist

- name: Install package
run: uv pip install dist/*.tar.gz

- name: Run tests
- name: Run pytest
run: uv run pytest tests
11 changes: 8 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ repos:
- id: ruff
- id: ruff-format

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.407
- repo: local
hooks:
- id: pyright
- id: ty-check
name: ty check
description: Type check with ty.
entry: uvx ty check
language: system
pass_filenames: false
require_serial: true
8 changes: 2 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ dependencies = [

[dependency-groups]
dev = [
"pre-commit~=4.5.0",
"prek>=0.2.22",
"pytest~=9.0.2",
"pytest-asyncio~=1.3.0",
"pytest-cov~=7.0.0",
"python-dotenv~=1.2.1",
"ty>=0.0.2",
]

[project.urls]
Expand All @@ -70,10 +71,5 @@ ignore = ["A", "D", "T201"]
[tool.ruff.lint.per-file-ignores]
"**/tests/*" = ["S101", "S311"]

[tool.pyright]
venvPath = "."
venv = ".venv"
reportUnnecessaryTypeIgnoreComment = true

[tool.pytest.ini_options]
asyncio_mode = "auto"
8 changes: 4 additions & 4 deletions tests/base/test_async_base_dict_typed.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ async def test_update(base: AsyncBase[DictItemType]) -> None:
assert updated_item == {
"key": "test_key",
"field1": "updated_value",
"field3": item["field3"] + 2,
"field4": item["field4"] - 2,
"field5": [*item["field5"], "baz"],
"field6": [3, 4, *item["field6"]],
"field3": item["field3"] + 2, # ty: ignore[unsupported-operator]
"field4": item["field4"] - 2, # ty: ignore[unsupported-operator]
"field5": [*item["field5"], "baz"], # ty: ignore[not-iterable]
"field6": [3, 4, *item["field6"]], # ty: ignore[not-iterable]
"field7": item["field7"],
}

Expand Down
8 changes: 4 additions & 4 deletions tests/base/test_async_base_dict_untyped.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ async def test_update(base: AsyncBase) -> None:
assert updated_item == {
"key": "test_key",
"field1": "updated_value",
"field3": item["field3"] + 2,
"field4": item["field4"] - 2,
"field5": [*item["field5"], "baz"],
"field6": [3, 4, *item["field6"]],
"field3": item["field3"] + 2, # ty: ignore[unsupported-operator]
"field4": item["field4"] - 2, # ty: ignore[unsupported-operator]
"field5": [*item["field5"], "baz"], # ty: ignore[not-iterable]
"field6": [3, 4, *item["field6"]], # ty: ignore[not-iterable]
"field7": item["field7"],
}

Expand Down
8 changes: 4 additions & 4 deletions tests/base/test_base_dict_typed.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ def test_update(base: Base[DictItemType]) -> None:
assert updated_item == {
"key": "test_key",
"field1": "updated_value",
"field3": item["field3"] + 2,
"field4": item["field4"] - 2,
"field5": [*item["field5"], "baz"],
"field6": [3, 4, *item["field6"]],
"field3": item["field3"] + 2, # ty: ignore[unsupported-operator]
"field4": item["field4"] - 2, # ty: ignore[unsupported-operator]
"field5": [*item["field5"], "baz"], # ty: ignore[not-iterable]
"field6": [3, 4, *item["field6"]], # ty: ignore[not-iterable]
"field7": item["field7"],
}

Expand Down
8 changes: 4 additions & 4 deletions tests/base/test_base_dict_untyped.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ def test_update(base: Base) -> None:
assert updated_item == {
"key": "test_key",
"field1": "updated_value",
"field3": item["field3"] + 2,
"field4": item["field4"] - 2,
"field5": [*item["field5"], "baz"],
"field6": [3, 4, *item["field6"]],
"field3": item["field3"] + 2, # ty: ignore[unsupported-operator]
"field4": item["field4"] - 2, # ty: ignore[unsupported-operator]
"field5": [*item["field5"], "baz"], # ty: ignore[not-iterable]
"field6": [3, 4, *item["field6"]], # ty: ignore[not-iterable]
"field7": item["field7"],
}

Expand Down
Loading
Loading