Skip to content

Commit 117e8bf

Browse files
committed
FIx.
1 parent 82698f0 commit 117e8bf

File tree

6 files changed

+19
-76
lines changed

6 files changed

+19
-76
lines changed

.pre-commit-config.yaml

+2-38
Original file line numberDiff line numberDiff line change
@@ -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.12.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.5.0
27-
hooks:
28-
- id: setup-cfg-fmt
29-
- repo: https://github.com/psf/black
30-
rev: 24.4.0
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
3921
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.7.0
54-
hooks:
55-
- id: interrogate
56-
args: [-v, --fail-under=40, src, tests]
5735
- repo: https://github.com/codespell-project/codespell
5836
rev: v2.2.6
5937
hooks:
6038
- id: codespell
61-
- repo: https://github.com/pre-commit/mirrors-mypy
62-
rev: 'v1.9.0'
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

+13-32
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/compile.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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.
@@ -13,7 +13,6 @@
1313
from pathlib import Path
1414
from subprocess import CompletedProcess
1515

16-
1716
DEFAULT_OPTIONS = ["--pdf", "--interaction=nonstopmode", "--synctex=1", "--cd"]
1817

1918

@@ -24,7 +23,8 @@ def compile_pdf(
2423
) -> CompletedProcess[bytes]:
2524
"""Generate a PDF from LaTeX document."""
2625
if shutil.which("latexmk") is None:
27-
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)
2828

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

src/latex_dependency_scanner/scanner.py

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from pathlib import Path
77
from typing import Generator
88

9-
109
COMMON_TEX_EXTENSIONS = [".ltx", ".tex"]
1110
"""List[str]: List of typical file extensions that contain latex"""
1211

tests/conftest.py

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import pytest
99

10-
1110
needs_latexmk = pytest.mark.skipif(
1211
shutil.which("latexmk") is None, reason="latexmk needs to be installed."
1312
)

tests/test_scan.py

+1-1
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)