From 32b91d8aabac4ca6359b6c1f19d3e5de78326b8f Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sun, 27 Jul 2025 11:30:42 +0200 Subject: [PATCH 1/6] Use justfile commands in CI. --- .github/workflows/main.yml | 16 ++++++++++------ .pre-commit-config.yaml | 14 ++------------ justfile | 8 ++------ 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 85049918..510a4255 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,8 +25,10 @@ jobs: - uses: astral-sh/setup-uv@v6 with: enable-cache: true - - run: uv run --no-dev --group typing mypy - - run: uv run --no-dev --group typing nbqa mypy --ignore-missing-imports . + - name: Install just + uses: extractions/setup-just@v2 + - run: just typing + - run: just typing-nb run-tests: @@ -43,8 +45,10 @@ jobs: - uses: actions/checkout@v4 - uses: astral-sh/setup-uv@v6 with: - python-version: ${{ matrix.python-version }} enable-cache: true + python-version: ${{ matrix.python-version }} + - name: Install just + uses: extractions/setup-just@v2 - if: matrix.os == 'ubuntu-latest' run: | @@ -53,15 +57,15 @@ jobs: - name: Run tests, doctests, and notebook tests shell: bash -l {0} - run: uv run --group test pytest --nbmake --cov=src --cov=tests --cov-report=xml -n auto + run: just test-cov - name: Upload test coverage reports to Codecov with GitHub Action uses: codecov/codecov-action@v5 - name: Run tests with lowest resolution if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest' - run: uv run --group test --resolution lowest-direct pytest --nbmake -n auto + run: just test-lowest - name: Run tests with highest resolution if: matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' - run: uv run --group test --resolution highest pytest --nbmake -n auto + run: just test-highest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7ed6f3cb..664e556e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,3 @@ -ci: - skip: [type-checking] - repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 @@ -31,7 +28,7 @@ repos: rev: v0.12.4 hooks: - id: ruff-format - - id: ruff + - id: ruff-check - repo: https://github.com/executablebooks/mdformat rev: 0.7.22 hooks: @@ -58,7 +55,7 @@ repos: - id: nbstripout exclude: (docs) - repo: https://github.com/crate-ci/typos - rev: v1 + rev: v1.34.0 hooks: - id: typos exclude: (\.ipynb) @@ -67,10 +64,3 @@ repos: - id: check-hooks-apply - id: check-useless-excludes # - id: identity # Prints all files passed to pre-commits. Debugging. -- repo: local - hooks: - - id: type-checking - name: type-checking - entry: uv run --group typing mypy - language: system - pass_filenames: false diff --git a/justfile b/justfile index dbb4d19f..aa947c89 100644 --- a/justfile +++ b/justfile @@ -1,7 +1,3 @@ -# Default recipe to display available commands -default: - @just --list - # Install all dependencies install: uv sync --all-groups @@ -20,11 +16,11 @@ test-nb: # Run type checking typing: - uv run --group typing mypy check + uv run --group typing --isolated mypy # Run type checking on notebooks typing-nb: - uv run --group typing nbqa mypy --ignore-missing-imports . + uv run --group typing --isolated nbqa mypy --ignore-missing-imports # Run linting lint: From a8c5ae4cf95ce592bfd31a3b78abcbee65ed43f7 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sun, 27 Jul 2025 11:35:03 +0200 Subject: [PATCH 2/6] Explicitly exclude dev deps in type checking. --- justfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/justfile b/justfile index aa947c89..2bc18144 100644 --- a/justfile +++ b/justfile @@ -16,11 +16,11 @@ test-nb: # Run type checking typing: - uv run --group typing --isolated mypy + uv run --group typing --no-dev --isolated mypy # Run type checking on notebooks typing-nb: - uv run --group typing --isolated nbqa mypy --ignore-missing-imports + uv run --group typing --no-dev --isolated nbqa mypy --ignore-missing-imports # Run linting lint: From 54224885cd705d39033b10d5fa8cc63f4332df92 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sun, 27 Jul 2025 11:57:04 +0200 Subject: [PATCH 3/6] fix. --- .github/workflows/main.yml | 62 +++++++++++++++++++------------------- justfile | 2 +- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 510a4255..fea85ee7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,42 +30,42 @@ jobs: - run: just typing - run: just typing-nb - run-tests: + # run-tests: - name: Run tests for ${{ matrix.os }} on ${{ matrix.python-version }} - runs-on: ${{ matrix.os }} + # name: Run tests for ${{ matrix.os }} on ${{ matrix.python-version }} + # runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + # strategy: + # fail-fast: false + # matrix: + # os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] + # python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] - steps: - - uses: actions/checkout@v4 - - uses: astral-sh/setup-uv@v6 - with: - enable-cache: true - python-version: ${{ matrix.python-version }} - - name: Install just - uses: extractions/setup-just@v2 + # steps: + # - uses: actions/checkout@v4 + # - uses: astral-sh/setup-uv@v6 + # with: + # enable-cache: true + # python-version: ${{ matrix.python-version }} + # - name: Install just + # uses: extractions/setup-just@v2 - - if: matrix.os == 'ubuntu-latest' - run: | - sudo apt-get update - sudo apt-get install graphviz graphviz-dev + # - if: matrix.os == 'ubuntu-latest' + # run: | + # sudo apt-get update + # sudo apt-get install graphviz graphviz-dev - - name: Run tests, doctests, and notebook tests - shell: bash -l {0} - run: just test-cov + # - name: Run tests, doctests, and notebook tests + # shell: bash -l {0} + # run: just test-cov - - name: Upload test coverage reports to Codecov with GitHub Action - uses: codecov/codecov-action@v5 + # - name: Upload test coverage reports to Codecov with GitHub Action + # uses: codecov/codecov-action@v5 - - name: Run tests with lowest resolution - if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest' - run: just test-lowest + # - name: Run tests with lowest resolution + # if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest' + # run: just test-lowest - - name: Run tests with highest resolution - if: matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' - run: just test-highest + # - name: Run tests with highest resolution + # if: matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' + # run: just test-highest diff --git a/justfile b/justfile index 2bc18144..5dd930e2 100644 --- a/justfile +++ b/justfile @@ -20,7 +20,7 @@ typing: # Run type checking on notebooks typing-nb: - uv run --group typing --no-dev --isolated nbqa mypy --ignore-missing-imports + uv run --group typing --no-dev --isolated nbqa mypy --ignore-missing-imports . # Run linting lint: From ad6c681877240136c10a4eee3a6fc6d0eb620eb2 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sun, 27 Jul 2025 15:08:00 +0200 Subject: [PATCH 4/6] Fix type-checking regardless of click version. --- src/_pytask/click.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/_pytask/click.py b/src/_pytask/click.py index 7da27f08..c87df390 100644 --- a/src/_pytask/click.py +++ b/src/_pytask/click.py @@ -39,7 +39,7 @@ if importlib.metadata.version("click") < "8.2": from click.parser import split_opt - class EnumChoice(Choice): + class EnumChoice(Choice): # type: ignore[type-arg] """An enum-based choice type. The implementation is copied from https://github.com/pallets/click/pull/2210 and @@ -71,17 +71,17 @@ def convert( return self.enum_type(value) else: - from click.parser import ( # type: ignore[attr-defined, no-redef] + from click.parser import ( # type: ignore[attr-defined, no-redef, unused-ignore] _split_opt as split_opt, ) ParamTypeValue = TypeVar("ParamTypeValue") - class EnumChoice(Choice): # type: ignore[no-redef] + class EnumChoice(Choice): # type: ignore[no-redef, type-arg] def __init__( self, choices: Iterable[ParamTypeValue], case_sensitive: bool = False ) -> None: - super().__init__(choices=choices, case_sensitive=case_sensitive) # type: ignore[arg-type] + super().__init__(choices=choices, case_sensitive=case_sensitive) # type: ignore[arg-type, unused-ignore] class _OptionHighlighter(RegexHighlighter): @@ -340,7 +340,7 @@ def _format_help_text( # noqa: C901, PLR0912, PLR0915 elif param.is_bool_flag and param.secondary_opts: # type: ignore[attr-defined] # For boolean flags that have distinct True/False opts, # use the opt without prefix instead of the value. - default_string = split_opt( + default_string = split_opt( # type: ignore[operator] (param.opts if param.default else param.secondary_opts)[0] )[1] elif ( From 311397bbcb8a8882d7b4998277b2605e9cef7492 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sun, 27 Jul 2025 15:08:27 +0200 Subject: [PATCH 5/6] Fix workflow. --- .github/workflows/main.yml | 62 +++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fea85ee7..510a4255 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,42 +30,42 @@ jobs: - run: just typing - run: just typing-nb - # run-tests: + run-tests: - # name: Run tests for ${{ matrix.os }} on ${{ matrix.python-version }} - # runs-on: ${{ matrix.os }} + name: Run tests for ${{ matrix.os }} on ${{ matrix.python-version }} + runs-on: ${{ matrix.os }} - # strategy: - # fail-fast: false - # matrix: - # os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] - # python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + strategy: + fail-fast: false + matrix: + os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] - # steps: - # - uses: actions/checkout@v4 - # - uses: astral-sh/setup-uv@v6 - # with: - # enable-cache: true - # python-version: ${{ matrix.python-version }} - # - name: Install just - # uses: extractions/setup-just@v2 + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + python-version: ${{ matrix.python-version }} + - name: Install just + uses: extractions/setup-just@v2 - # - if: matrix.os == 'ubuntu-latest' - # run: | - # sudo apt-get update - # sudo apt-get install graphviz graphviz-dev + - if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get update + sudo apt-get install graphviz graphviz-dev - # - name: Run tests, doctests, and notebook tests - # shell: bash -l {0} - # run: just test-cov + - name: Run tests, doctests, and notebook tests + shell: bash -l {0} + run: just test-cov - # - name: Upload test coverage reports to Codecov with GitHub Action - # uses: codecov/codecov-action@v5 + - name: Upload test coverage reports to Codecov with GitHub Action + uses: codecov/codecov-action@v5 - # - name: Run tests with lowest resolution - # if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest' - # run: just test-lowest + - name: Run tests with lowest resolution + if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest' + run: just test-lowest - # - name: Run tests with highest resolution - # if: matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' - # run: just test-highest + - name: Run tests with highest resolution + if: matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' + run: just test-highest From f3dd0e1e46b25563e36b046ea5b7b065371d2a68 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sun, 27 Jul 2025 15:15:42 +0200 Subject: [PATCH 6/6] fix. --- src/_pytask/click.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/_pytask/click.py b/src/_pytask/click.py index c87df390..10a16867 100644 --- a/src/_pytask/click.py +++ b/src/_pytask/click.py @@ -39,7 +39,7 @@ if importlib.metadata.version("click") < "8.2": from click.parser import split_opt - class EnumChoice(Choice): # type: ignore[type-arg] + class EnumChoice(Choice): # type: ignore[type-arg, unused-ignore] """An enum-based choice type. The implementation is copied from https://github.com/pallets/click/pull/2210 and @@ -77,7 +77,7 @@ def convert( ParamTypeValue = TypeVar("ParamTypeValue") - class EnumChoice(Choice): # type: ignore[no-redef, type-arg] + class EnumChoice(Choice): # type: ignore[no-redef, type-arg, unused-ignore] def __init__( self, choices: Iterable[ParamTypeValue], case_sensitive: bool = False ) -> None: @@ -340,7 +340,7 @@ def _format_help_text( # noqa: C901, PLR0912, PLR0915 elif param.is_bool_flag and param.secondary_opts: # type: ignore[attr-defined] # For boolean flags that have distinct True/False opts, # use the opt without prefix instead of the value. - default_string = split_opt( # type: ignore[operator] + default_string = split_opt( # type: ignore[operator, unused-ignore] (param.opts if param.default else param.secondary_opts)[0] )[1] elif (