Skip to content

Commit eb744ce

Browse files
committed
Merge remote-tracking branch 'origin/main' into codex/lock-docs
2 parents bbb1154 + 532bfcf commit eb744ce

25 files changed

Lines changed: 474 additions & 375 deletions

.github/workflows/main.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ jobs:
2929
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
3030
with:
3131
persist-credentials: false
32-
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
32+
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
3333
with:
3434
enable-cache: true
3535
- name: Install just
36-
uses: extractions/setup-just@f8a3cce218d9f83db3a2ecd90e41ac3de6cdfd9b # v3
36+
uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0
3737
- name: Install graphviz
3838
run: |
3939
sudo apt-get update
@@ -57,12 +57,12 @@ jobs:
5757
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
5858
with:
5959
persist-credentials: false
60-
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
60+
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
6161
with:
6262
enable-cache: true
6363
python-version: ${{ matrix.python-version }}
6464
- name: Install just
65-
uses: extractions/setup-just@f8a3cce218d9f83db3a2ecd90e41ac3de6cdfd9b # v3
65+
uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0
6666

6767
- if: matrix.os == 'ubuntu-latest'
6868
run: |
@@ -81,7 +81,7 @@ jobs:
8181
run: uv run --group test pytest --cov=src --cov=tests --cov-report=xml -n auto
8282

8383
- name: Upload test coverage reports to Codecov with GitHub Action
84-
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5
84+
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
8585

8686
- name: Run tests with lowest resolution
8787
if: matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest'

.github/workflows/publish-to-pypi.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
with:
1717
persist-credentials: false
1818
- name: Install uv
19-
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
19+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
2020
with:
2121
enable-cache: true
2222
python-version: "3.13"
@@ -47,7 +47,7 @@ jobs:
4747
name: python-package-distributions
4848
path: dist/
4949
- name: Install uv
50-
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
50+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
5151
- name: Publish distribution 📦 to PyPI
5252
run: uv publish
5353

@@ -70,7 +70,7 @@ jobs:
7070
name: python-package-distributions
7171
path: dist/
7272
- name: Sign the dists with Sigstore
73-
uses: sigstore/gh-action-sigstore-python@a5caf349bc536fbef3668a10ed7f5cd309a4b53d # v3.2.0
73+
uses: sigstore/gh-action-sigstore-python@04cffa1d795717b140764e8b640de88853c92acc # v3.3.0
7474
with:
7575
inputs: >-
7676
./dist/*.tar.gz

.github/workflows/update-plugin-list.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
persist-credentials: false
2626

2727
- name: Install uv
28-
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
28+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
2929
with:
3030
python-version: 3.12
3131

.github/workflows/zizmor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
with:
2727
persist-credentials: false
2828

29-
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
29+
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
3030
with:
3131
enable-cache: true
3232
python-version: '3.13'

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ repos:
2626
- id: python-no-log-warn
2727
- id: text-unicode-replacement-char
2828
- repo: https://github.com/astral-sh/ruff-pre-commit
29-
rev: v0.15.8
29+
rev: v0.15.10
3030
hooks:
3131
- id: ruff-format
3232
- id: ruff-check
3333
- repo: https://github.com/astral-sh/uv-pre-commit
34-
rev: 0.11.2
34+
rev: 0.11.6
3535
hooks:
3636
- id: uv-lock
3737
- repo: https://github.com/executablebooks/mdformat
@@ -61,7 +61,7 @@ repos:
6161
- id: nbstripout
6262
exclude: (docs)
6363
- repo: https://github.com/crate-ci/typos
64-
rev: v1.44.0
64+
rev: v1
6565
hooks:
6666
- id: typos
6767
exclude: (\.ipynb)

pyproject.toml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,48 @@ unused-ignore-comment = "error"
171171
[[tool.ty.overrides]]
172172
include = [
173173
"src/_pytask/_version.py",
174-
"src/_pytask/click.py",
175174
"tests/test_dag_command.py",
176175
]
177176

178177
[tool.ty.overrides.rules]
179178
unused-ignore-comment = "ignore"
180179

180+
[[tool.ty.overrides]]
181+
include = ["src/_pytask/click.py"]
182+
183+
[tool.ty.overrides.rules]
184+
unresolved-attribute = "ignore"
185+
unused-ignore-comment = "ignore"
186+
187+
[[tool.ty.overrides]]
188+
include = ["src/_pytask/debugging.py"]
189+
190+
[tool.ty.overrides.rules]
191+
unsupported-base = "ignore"
192+
193+
[[tool.ty.overrides]]
194+
include = ["src/_pytask/hookspecs.py"]
195+
196+
[tool.ty.overrides.rules]
197+
empty-body = "ignore"
198+
199+
[[tool.ty.overrides]]
200+
include = ["src/_pytask/warnings_utils.py"]
201+
202+
[tool.ty.overrides.rules]
203+
unresolved-attribute = "ignore"
204+
205+
[[tool.ty.overrides]]
206+
include = ["tests/**/*.py", "tests/**/*.ipynb"]
207+
208+
[tool.ty.overrides.rules]
209+
call-non-callable = "ignore"
210+
invalid-argument-type = "ignore"
211+
invalid-return-type = "ignore"
212+
unresolved-attribute = "ignore"
213+
unresolved-reference = "ignore"
214+
unsupported-operator = "ignore"
215+
181216
[tool.ty.src]
182217
include = ["src", "tests"]
183218
exclude = ["src/_pytask/_hashlib.py"]

src/_pytask/capture.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def __exit__(
244244
@property
245245
def buffer(self) -> BinaryIO:
246246
# The str/bytes doesn't actually matter in this type, so OK to fake.
247-
return self # type: ignore[return-value]
247+
return cast("BinaryIO", self)
248248

249249

250250
# Capture classes.
@@ -553,7 +553,7 @@ def snap(self) -> bytes:
553553
res = self.tmpfile.buffer.read()
554554
self.tmpfile.seek(0)
555555
self.tmpfile.truncate()
556-
return res # type: ignore[return-value]
556+
return cast("bytes", res)
557557

558558
def writeorg(self, data: bytes) -> None:
559559
"""Write to original file descriptor."""
@@ -656,8 +656,10 @@ def pop_outerr_to_orig(self) -> tuple[AnyStr, AnyStr]:
656656
"""Pop current snapshot out/err capture and flush to orig streams."""
657657
out, err = self.readouterr()
658658
if out:
659+
assert self.out is not None
659660
self.out.writeorg(out) # type: ignore[union-attr]
660661
if err:
662+
assert self.err is not None
661663
self.err.writeorg(err) # type: ignore[union-attr]
662664
return out, err
663665

@@ -678,7 +680,8 @@ def resume_capturing(self) -> None:
678680
if self.err:
679681
self.err.resume()
680682
if self._in_suspended:
681-
self.in_.resume() # type: ignore[union-attr]
683+
assert self.in_ is not None
684+
self.in_.resume()
682685
self._in_suspended = False
683686

684687
def stop_capturing(self) -> None:
@@ -699,10 +702,9 @@ def is_started(self) -> bool:
699702
return self._state == "started"
700703

701704
def readouterr(self) -> CaptureResult[AnyStr]:
702-
out = self.out.snap() if self.out else ""
703-
err = self.err.snap() if self.err else ""
704-
# Will be fixed by pytest. This type error is real, need to fix.
705-
return CaptureResult(out, err) # type: ignore[arg-type]
705+
out = self.out.snap() if self.out else cast("AnyStr", "")
706+
err = self.err.snap() if self.err else cast("AnyStr", "")
707+
return CaptureResult(out, err)
706708

707709

708710
def _get_multicapture(method: CaptureMethod) -> MultiCapture[str]:

src/_pytask/collect.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ def _collect_not_collected_tasks(session: Session) -> None:
192192
for path in list(COLLECTED_TASKS):
193193
tasks = COLLECTED_TASKS.pop(path)
194194
for task in tasks:
195-
name = task.pytask_meta.name # type: ignore[attr-defined]
195+
name = task.pytask_meta.name
196+
assert name is not None
196197
node: PTask
197198
if path:
198199
node = Task(base_name=name, path=path, function=task)

src/_pytask/config_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ def set_defaults_from_config(
4343
# command-line options during parsing. Here, we add their defaults to the
4444
# configuration.
4545
command_option_names = [option.name for option in context.command.params]
46-
commands = context.parent.command.commands # type: ignore[union-attr]
46+
assert context.parent is not None
47+
assert isinstance(context.parent.command, click.Group)
48+
commands = context.parent.command.commands
4749
all_defaults_from_cli = {
4850
option.name: option.default
4951
for name, command in commands.items()

src/_pytask/console.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from pathlib import Path
99
from typing import TYPE_CHECKING
1010
from typing import Any
11+
from typing import Literal
1112
from typing import cast
1213

1314
from rich.console import Console
@@ -32,7 +33,6 @@
3233
from collections.abc import Callable
3334
from collections.abc import Iterable
3435
from collections.abc import Sequence
35-
from enum import Enum
3636

3737
from _pytask.node_protocols import PTask
3838
from _pytask.outcomes import CollectionOutcome
@@ -119,7 +119,10 @@ def render_to_string(
119119
except (AttributeError, IndexError, TypeError):
120120
theme = None
121121
render_console = Console(
122-
color_system=console.color_system, # type: ignore[invalid-argument-type]
122+
color_system=cast(
123+
"Literal['auto', 'standard', '256', 'truecolor', 'windows'] | None",
124+
console.color_system,
125+
),
123126
force_terminal=True,
124127
width=console.width,
125128
no_color=False,
@@ -282,7 +285,7 @@ def unify_styles(*styles: str | Style) -> Style:
282285

283286

284287
def create_summary_panel(
285-
counts: dict[Enum, int],
288+
counts: dict[CollectionOutcome | TaskOutcome, int],
286289
outcome_enum: type[CollectionOutcome | TaskOutcome],
287290
description_total: str,
288291
) -> Panel:
@@ -302,14 +305,14 @@ def create_summary_panel(
302305
grid.add_row(
303306
Padding(str(value), pad=_HORIZONTAL_PADDING),
304307
Padding(
305-
outcome.description, # type: ignore[attr-defined]
308+
outcome.description,
306309
pad=_HORIZONTAL_PADDING,
307310
),
308311
Padding(
309312
percentage,
310313
pad=_HORIZONTAL_PADDING,
311314
),
312-
style=outcome.style_textonly, # type: ignore[attr-defined]
315+
style=outcome.style_textonly,
313316
)
314317

315318
return Panel(

0 commit comments

Comments
 (0)