Skip to content
Merged
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
16 changes: 10 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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: |
Expand All @@ -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
14 changes: 2 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
ci:
skip: [type-checking]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand All @@ -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
8 changes: 2 additions & 6 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Default recipe to display available commands
default:
@just --list

# Install all dependencies
install:
uv sync --all-groups
Expand All @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions src/_pytask/click.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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 (
Expand Down
Loading