Skip to content

Commit 2a60aa4

Browse files
[pre-commit.ci] pre-commit autoupdate (#20)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Tobias Raabe <[email protected]>
1 parent 42c2be8 commit 2a60aa4

File tree

5 files changed

+57
-27
lines changed

5 files changed

+57
-27
lines changed

.pre-commit-config.yaml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,46 +17,36 @@ repos:
1717
args: [--branch, main]
1818
- id: trailing-whitespace
1919
- repo: https://github.com/pre-commit/pygrep-hooks
20-
rev: v1.9.0 # Use the ref you want to point at
20+
rev: v1.10.0
2121
hooks:
2222
- id: python-check-blanket-noqa
2323
- id: python-check-mock-methods
2424
- id: python-no-eval
2525
- id: python-no-log-warn
2626
- id: python-use-type-annotations
2727
- id: text-unicode-replacement-char
28-
- repo: https://github.com/asottile/pyupgrade
29-
rev: v3.3.1
30-
hooks:
31-
- id: pyupgrade
32-
args: [--py37-plus]
3328
- repo: https://github.com/asottile/reorder_python_imports
3429
rev: v3.9.0
3530
hooks:
3631
- id: reorder-python-imports
3732
args: [--py37-plus, --add-import, 'from __future__ import annotations']
3833
- repo: https://github.com/psf/black
39-
rev: 22.12.0
34+
rev: 23.1.0
4035
hooks:
4136
- id: black
4237
- repo: https://github.com/charliermarsh/ruff-pre-commit
43-
rev: v0.0.205
38+
rev: v0.0.244
4439
hooks:
4540
- id: ruff
4641
- repo: https://github.com/dosisod/refurb
47-
rev: v1.9.1
42+
rev: v1.12.0
4843
hooks:
4944
- id: refurb
5045
args: [--ignore, FURB126]
5146
- repo: https://github.com/asottile/setup-cfg-fmt
5247
rev: v2.2.0
5348
hooks:
5449
- id: setup-cfg-fmt
55-
- repo: https://github.com/PyCQA/docformatter
56-
rev: v1.5.1
57-
hooks:
58-
- id: docformatter
59-
args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank]
6050
- repo: https://github.com/econchick/interrogate
6151
rev: 1.5.0
6252
hooks:
@@ -77,6 +67,20 @@ repos:
7767
- id: codespell
7868
args: [-L als, -L unparseable]
7969
additional_dependencies: ["tomli"]
70+
- repo: https://github.com/pre-commit/mirrors-mypy
71+
rev: 'v1.0.0'
72+
hooks:
73+
- id: mypy
74+
args: [
75+
--no-strict-optional,
76+
--ignore-missing-imports,
77+
]
78+
additional_dependencies: [
79+
attrs>=21.3.0,
80+
click,
81+
types-setuptools
82+
]
83+
pass_filenames: false
8084
- repo: https://github.com/mgedmin/check-manifest
8185
rev: "0.49"
8286
hooks:

pyproject.toml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,29 @@ build-backend = "setuptools.build_meta"
77
write_to = "src/pytask_environment/_version.py"
88

99

10+
[tool.mypy]
11+
files = ["src", "tests"]
12+
check_untyped_defs = true
13+
disallow_any_generics = true
14+
disallow_incomplete_defs = true
15+
disallow_untyped_defs = true
16+
no_implicit_optional = true
17+
warn_redundant_casts = true
18+
warn_unused_ignores = true
19+
20+
21+
[[tool.mypy.overrides]]
22+
module = "tests.*"
23+
disallow_untyped_defs = false
24+
ignore_errors = true
25+
26+
1027
[tool.codespell]
1128
ignore-words-list = "falsy"
1229

1330

1431
[tool.ruff]
32+
target-version = "py37"
1533
select = ["ALL"]
1634
fix = true
1735
extend-ignore = [
@@ -37,9 +55,13 @@ extend-ignore = [
3755
"EM", # flake8-errmsg
3856
"ANN401", # flake8-annotate typing.Any
3957
"PD", # pandas-vet
40-
"UP", # pyupgrade is too aggressive for py<3.10
58+
"COM812", # trailing comma missing, but black takes care of that
59+
"D401", # imperative mood for first line. too many false-positives.
60+
# Temporarily ignored.
61+
"TCH002",
4162
]
4263

4364

4465
[tool.ruff.per-file-ignores]
45-
"tests/*" = ["D", "ANN"]
66+
"tests/*" = ["D", "ANN", "PLR0913"]
67+
"__init__.py" = ["D104"]

src/pytask_environment/logging.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,24 @@ def pytask_log_session_header(session: Session) -> None:
6868
pass
6969
else:
7070
console.print()
71-
raise Exception(msg + "\n\n" + _ERROR_MSG) from None
71+
raise Exception(msg + "\n\n" + _ERROR_MSG) from None # noqa: TRY002
7272

7373

7474
@orm.db_session
75-
def retrieve_package(name: str) -> str:
75+
def retrieve_package(name: str) -> str | None:
7676
"""Return booleans indicating whether the version or path of a package changed."""
7777
try:
78-
package = Environment[name]
78+
package = Environment[name] # type: ignore[type-arg, valid-type]
7979
except orm.ObjectNotFound:
80-
package = None
80+
package = None # type: ignore[misc]
8181
return package
8282

8383

8484
@orm.db_session
8585
def create_or_update_state(name: str, version: str, path: str) -> None:
8686
"""Create or update a state."""
8787
try:
88-
package_in_db = Environment[name]
88+
package_in_db = Environment[name] # type: ignore[type-arg, valid-type]
8989
except orm.ObjectNotFound:
9090
Environment(name=name, version=version, path=path)
9191
else:

tests/__init__.py

Whitespace-only changes.

tests/test_logging.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from _pytask.database_utils import db
1717

1818

19-
@pytest.mark.end_to_end
19+
@pytest.mark.end_to_end()
2020
def test_existence_of_python_executable_in_db(tmp_path, runner):
2121
"""Test that the Python executable is stored in the database."""
2222
task_path = tmp_path.joinpath("task_dummy.py")
@@ -38,7 +38,7 @@ def test_existence_of_python_executable_in_db(tmp_path, runner):
3838
orm.delete(e for e in entity)
3939

4040

41-
@pytest.mark.end_to_end
41+
@pytest.mark.end_to_end()
4242
def test_flow_when_python_version_has_changed(monkeypatch, tmp_path, runner):
4343
"""Test the whole use-case.
4444
@@ -96,8 +96,10 @@ def test_flow_when_python_version_has_changed(monkeypatch, tmp_path, runner):
9696
orm.delete(e for e in entity)
9797

9898

99-
@pytest.mark.end_to_end
100-
@pytest.mark.parametrize("check_python_version, expected", [("true", 1), ("false", 0)])
99+
@pytest.mark.end_to_end()
100+
@pytest.mark.parametrize(
101+
("check_python_version", "expected"), [("true", 1), ("false", 0)]
102+
)
101103
def test_python_version_changed(
102104
monkeypatch, tmp_path, runner, check_python_version, expected
103105
):
@@ -129,8 +131,10 @@ def test_python_version_changed(
129131
orm.delete(e for e in entity)
130132

131133

132-
@pytest.mark.end_to_end
133-
@pytest.mark.parametrize("check_python_version, expected", [("true", 1), ("false", 0)])
134+
@pytest.mark.end_to_end()
135+
@pytest.mark.parametrize(
136+
("check_python_version", "expected"), [("true", 1), ("false", 0)]
137+
)
134138
def test_environment_changed(
135139
monkeypatch, tmp_path, runner, check_python_version, expected
136140
):

0 commit comments

Comments
 (0)