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..5dd930e2 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 --no-dev --isolated mypy # Run type checking on notebooks typing-nb: - uv run --group typing nbqa mypy --ignore-missing-imports . + uv run --group typing --no-dev --isolated nbqa mypy --ignore-missing-imports . # Run linting lint: diff --git a/src/_pytask/click.py b/src/_pytask/click.py index 7da27f08..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): + 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 @@ -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, unused-ignore] 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, unused-ignore] (param.opts if param.default else param.secondary_opts)[0] )[1] elif (