Skip to content

Commit 997776b

Browse files
[pre-commit.ci] pre-commit autoupdate (#29)
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 c453d5e commit 997776b

File tree

9 files changed

+33
-83
lines changed

9 files changed

+33
-83
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
fail-fast: false
2828
matrix:
2929
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
30-
python-version: ['3.8', '3.9', '3.10', '3.11']
30+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
3131

3232
steps:
3333
- uses: actions/checkout@v4

.pre-commit-config.yaml

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: v4.6.0
44
hooks:
55
- id: check-added-large-files
66
args: ['--maxkb=25']
@@ -17,28 +17,11 @@ repos:
1717
- id: python-no-log-warn
1818
- id: python-use-type-annotations
1919
- id: text-unicode-replacement-char
20-
- repo: https://github.com/asottile/reorder-python-imports
21-
rev: v3.11.0
22-
hooks:
23-
- id: reorder-python-imports
24-
args: [--py38-plus, --add-import, 'from __future__ import annotations']
25-
- repo: https://github.com/asottile/setup-cfg-fmt
26-
rev: v2.4.0
27-
hooks:
28-
- id: setup-cfg-fmt
29-
- repo: https://github.com/psf/black
30-
rev: 23.9.1
31-
hooks:
32-
- id: black
33-
- repo: https://github.com/asottile/blacken-docs
34-
rev: 1.16.0
35-
hooks:
36-
- id: blacken-docs
37-
additional_dependencies: [black]
3820
- repo: https://github.com/astral-sh/ruff-pre-commit
39-
rev: v0.0.291
21+
rev: v0.4.1
4022
hooks:
4123
- id: ruff
24+
- id: ruff-format
4225
- repo: https://github.com/executablebooks/mdformat
4326
rev: 0.7.17
4427
hooks:
@@ -49,35 +32,16 @@ repos:
4932
]
5033
args: [--wrap, "88"]
5134
files: (README\.md)
52-
- repo: https://github.com/econchick/interrogate
53-
rev: 1.5.0
54-
hooks:
55-
- id: interrogate
56-
args: [-v, --fail-under=40, src, tests]
5735
- repo: https://github.com/codespell-project/codespell
58-
rev: v2.2.5
36+
rev: v2.2.6
5937
hooks:
6038
- id: codespell
61-
- repo: https://github.com/pre-commit/mirrors-mypy
62-
rev: 'v1.5.1'
63-
hooks:
64-
- id: mypy
65-
args: [
66-
--no-strict-optional,
67-
--ignore-missing-imports,
68-
]
69-
additional_dependencies: [
70-
types-attrs,
71-
types-click,
72-
types-setuptools
73-
]
74-
pass_filenames: false
7539
- repo: https://github.com/mgedmin/check-manifest
7640
rev: "0.49"
7741
hooks:
7842
- id: check-manifest
7943
args: [--no-build-isolation]
80-
additional_dependencies: [setuptools-scm, toml]
44+
additional_dependencies: [setuptools-scm, wheel, toml]
8145
- repo: meta
8246
hooks:
8347
- id: check-hooks-apply

pyproject.toml

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
33
build-backend = "setuptools.build_meta"
44

5-
65
[tool.setuptools_scm]
76
write_to = "src/latex_dependency_scanner/_version.py"
87

9-
108
[tool.mypy]
119
files = ["src", "tests"]
1210
check_untyped_defs = true
@@ -17,45 +15,28 @@ no_implicit_optional = true
1715
warn_redundant_casts = true
1816
warn_unused_ignores = true
1917

20-
2118
[[tool.mypy.overrides]]
2219
module = "tests.*"
2320
disallow_untyped_defs = false
2421
ignore_errors = true
2522

26-
2723
[tool.ruff]
2824
target-version = "py38"
29-
select = ["ALL"]
3025
fix = true
26+
unsafe-fixes = true
27+
28+
[tool.ruff.lint]
3129
extend-ignore = [
32-
# Numpy docstyle
33-
"D107",
34-
"D203",
35-
"D212",
36-
"D213",
37-
"D402",
38-
"D404",
39-
"D413",
40-
"D415",
41-
"D416",
42-
"D417",
43-
# Others.
44-
"RET504", # unnecessary variable assignment before return.
45-
"S101", # raise errors for asserts.
46-
"B905", # strict parameter for zip that was implemented in py310.
47-
"I", # ignore isort
48-
"ANN101", # type annotating self
49-
"ANN102", # type annotating cls
50-
"FBT", # flake8-boolean-trap
51-
"EM", # flake8-errmsg
52-
"ANN401", # flake8-annotate typing.Any
53-
"PD", # pandas-vet
54-
"UP", # pyupgrade is too aggressive for py<3.10
55-
"COM812", # trailing comma missing, but black takes care of that
56-
"TRY003", # avoid long exception messages
30+
"COM812", # Comply with ruff-format
31+
"ISC001", # Comply with ruff-format
5732
]
33+
select = ["ALL"]
34+
35+
[tool.ruff.lint.per-file-ignores]
36+
"tests/*" = ["ANN", "D", "S101"]
5837

38+
[tool.ruff.lint.isort]
39+
force-single-line = true
5940

60-
[tool.ruff.per-file-ignores]
61-
"tests/*" = ["D", "ANN"]
41+
[tool.ruff.lint.pydocstyle]
42+
convention = "numpy"

src/latex_dependency_scanner/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The name space for the package."""
2+
23
from __future__ import annotations
34

45
from latex_dependency_scanner.compile import compile_pdf

src/latex_dependency_scanner/compile.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
"""This module provides the means to compile a LaTeX document to a desired location.
1+
"""Provides the means to compile a LaTeX document to a desired location.
22
33
The function is mainly used in testing to validate the provided examples, but can also
44
be used by users to compile their documents.
55
66
"""
7+
78
from __future__ import annotations
89

910
import os
@@ -12,7 +13,6 @@
1213
from pathlib import Path
1314
from subprocess import CompletedProcess
1415

15-
1616
DEFAULT_OPTIONS = ["--pdf", "--interaction=nonstopmode", "--synctex=1", "--cd"]
1717

1818

@@ -23,7 +23,8 @@ def compile_pdf(
2323
) -> CompletedProcess[bytes]:
2424
"""Generate a PDF from LaTeX document."""
2525
if shutil.which("latexmk") is None:
26-
raise RuntimeError("'latexmk' must be on PATH to compile a LaTeX document.")
26+
msg = "'latexmk' must be on PATH to compile a LaTeX document."
27+
raise RuntimeError(msg)
2728

2829
cmd = _prepare_cmd_options(latex_document, compiled_document, args)
2930
return subprocess.run(cmd, check=True) # noqa: S603

src/latex_dependency_scanner/scanner.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""Includes the ability to scan a LaTeX document."""
2+
23
from __future__ import annotations
34

45
import re
56
from pathlib import Path
67
from typing import Generator
78

8-
99
COMMON_TEX_EXTENSIONS = [".ltx", ".tex"]
1010
"""List[str]: List of typical file extensions that contain latex"""
1111

@@ -163,9 +163,11 @@ def yield_nodes_from_node( # noqa: C901, PLR0912
163163

164164
if not found_some_file:
165165
possible_paths = (
166-
(relative_to / path).resolve().with_suffix(suffix)
167-
if suffix
168-
else (relative_to / path).resolve()
166+
(
167+
(relative_to / path).resolve().with_suffix(suffix)
168+
if suffix
169+
else (relative_to / path).resolve()
170+
)
169171
for suffix in common_extensions
170172
)
171173
yield from possible_paths

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
"""Configuration file for pytest."""
2+
23
from __future__ import annotations
34

45
import shutil
56
from pathlib import Path
67

78
import pytest
89

9-
1010
needs_latexmk = pytest.mark.skipif(
1111
shutil.which("latexmk") is None, reason="latexmk needs to be installed."
1212
)

tests/test_regex.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test regular expressions."""
2+
23
from __future__ import annotations
34

45
import pytest

tests/test_scan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from latex_dependency_scanner.scanner import COMMON_GRAPHICS_EXTENSIONS
99
from latex_dependency_scanner.scanner import scan
1010

11-
from tests.conftest import needs_latexmk
1211
from tests.conftest import TEST_RESOURCES
12+
from tests.conftest import needs_latexmk
1313

1414

1515
@needs_latexmk

0 commit comments

Comments
 (0)