Skip to content

Commit 529e5f2

Browse files
authored
Use justfile commands in CI. (#695)
1 parent 5431aaf commit 529e5f2

File tree

4 files changed

+19
-29
lines changed

4 files changed

+19
-29
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ jobs:
2525
- uses: astral-sh/setup-uv@v6
2626
with:
2727
enable-cache: true
28-
- run: uv run --no-dev --group typing mypy
29-
- run: uv run --no-dev --group typing nbqa mypy --ignore-missing-imports .
28+
- name: Install just
29+
uses: extractions/setup-just@v2
30+
- run: just typing
31+
- run: just typing-nb
3032

3133
run-tests:
3234

@@ -43,8 +45,10 @@ jobs:
4345
- uses: actions/checkout@v4
4446
- uses: astral-sh/setup-uv@v6
4547
with:
46-
python-version: ${{ matrix.python-version }}
4748
enable-cache: true
49+
python-version: ${{ matrix.python-version }}
50+
- name: Install just
51+
uses: extractions/setup-just@v2
4852

4953
- if: matrix.os == 'ubuntu-latest'
5054
run: |
@@ -53,15 +57,15 @@ jobs:
5357
5458
- name: Run tests, doctests, and notebook tests
5559
shell: bash -l {0}
56-
run: uv run --group test pytest --nbmake --cov=src --cov=tests --cov-report=xml -n auto
60+
run: just test-cov
5761

5862
- name: Upload test coverage reports to Codecov with GitHub Action
5963
uses: codecov/codecov-action@v5
6064

6165
- name: Run tests with lowest resolution
6266
if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
63-
run: uv run --group test --resolution lowest-direct pytest --nbmake -n auto
67+
run: just test-lowest
6468

6569
- name: Run tests with highest resolution
6670
if: matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest'
67-
run: uv run --group test --resolution highest pytest --nbmake -n auto
71+
run: just test-highest

.pre-commit-config.yaml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
ci:
2-
skip: [type-checking]
3-
41
repos:
52
- repo: https://github.com/pre-commit/pre-commit-hooks
63
rev: v5.0.0
@@ -31,7 +28,7 @@ repos:
3128
rev: v0.12.4
3229
hooks:
3330
- id: ruff-format
34-
- id: ruff
31+
- id: ruff-check
3532
- repo: https://github.com/executablebooks/mdformat
3633
rev: 0.7.22
3734
hooks:
@@ -58,7 +55,7 @@ repos:
5855
- id: nbstripout
5956
exclude: (docs)
6057
- repo: https://github.com/crate-ci/typos
61-
rev: v1
58+
rev: v1.34.0
6259
hooks:
6360
- id: typos
6461
exclude: (\.ipynb)
@@ -67,10 +64,3 @@ repos:
6764
- id: check-hooks-apply
6865
- id: check-useless-excludes
6966
# - id: identity # Prints all files passed to pre-commits. Debugging.
70-
- repo: local
71-
hooks:
72-
- id: type-checking
73-
name: type-checking
74-
entry: uv run --group typing mypy
75-
language: system
76-
pass_filenames: false

justfile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# Default recipe to display available commands
2-
default:
3-
@just --list
4-
51
# Install all dependencies
62
install:
73
uv sync --all-groups
@@ -20,11 +16,11 @@ test-nb:
2016

2117
# Run type checking
2218
typing:
23-
uv run --group typing mypy check
19+
uv run --group typing --no-dev --isolated mypy
2420

2521
# Run type checking on notebooks
2622
typing-nb:
27-
uv run --group typing nbqa mypy --ignore-missing-imports .
23+
uv run --group typing --no-dev --isolated nbqa mypy --ignore-missing-imports .
2824

2925
# Run linting
3026
lint:

src/_pytask/click.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
if importlib.metadata.version("click") < "8.2":
4040
from click.parser import split_opt
4141

42-
class EnumChoice(Choice):
42+
class EnumChoice(Choice): # type: ignore[type-arg, unused-ignore]
4343
"""An enum-based choice type.
4444
4545
The implementation is copied from https://github.com/pallets/click/pull/2210 and
@@ -71,17 +71,17 @@ def convert(
7171
return self.enum_type(value)
7272

7373
else:
74-
from click.parser import ( # type: ignore[attr-defined, no-redef]
74+
from click.parser import ( # type: ignore[attr-defined, no-redef, unused-ignore]
7575
_split_opt as split_opt,
7676
)
7777

7878
ParamTypeValue = TypeVar("ParamTypeValue")
7979

80-
class EnumChoice(Choice): # type: ignore[no-redef]
80+
class EnumChoice(Choice): # type: ignore[no-redef, type-arg, unused-ignore]
8181
def __init__(
8282
self, choices: Iterable[ParamTypeValue], case_sensitive: bool = False
8383
) -> None:
84-
super().__init__(choices=choices, case_sensitive=case_sensitive) # type: ignore[arg-type]
84+
super().__init__(choices=choices, case_sensitive=case_sensitive) # type: ignore[arg-type, unused-ignore]
8585

8686

8787
class _OptionHighlighter(RegexHighlighter):
@@ -340,7 +340,7 @@ def _format_help_text( # noqa: C901, PLR0912, PLR0915
340340
elif param.is_bool_flag and param.secondary_opts: # type: ignore[attr-defined]
341341
# For boolean flags that have distinct True/False opts,
342342
# use the opt without prefix instead of the value.
343-
default_string = split_opt(
343+
default_string = split_opt( # type: ignore[operator, unused-ignore]
344344
(param.opts if param.default else param.secondary_opts)[0]
345345
)[1]
346346
elif (

0 commit comments

Comments
 (0)