Skip to content

Commit b19de8e

Browse files
committed
👷 Update pre-commit.ci
1 parent d16ad1c commit b19de8e

File tree

10 files changed

+70
-67
lines changed

10 files changed

+70
-67
lines changed

.pre-commit-config.yaml

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.4.0
4+
rev: v4.5.0
55
hooks:
66
- id: check-added-large-files
77
- id: fix-byte-order-marker
@@ -26,7 +26,7 @@ repos:
2626
hooks:
2727
- id: remove-crlf
2828
- repo: https://github.com/codespell-project/codespell
29-
rev: v2.2.5
29+
rev: v2.2.6
3030
hooks:
3131
- id: codespell
3232
additional_dependencies:
@@ -38,23 +38,23 @@ repos:
3838
args:
3939
- --msg-filename
4040
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
41-
rev: 2.7.2
41+
rev: 2.7.3
4242
hooks:
4343
- id: editorconfig-checker
4444
- repo: https://github.com/jumanjihouse/pre-commit-hooks
4545
rev: 3.0.0
4646
hooks:
4747
- id: check-mailmap
4848
- repo: https://github.com/rhysd/actionlint
49-
rev: v1.6.25
49+
rev: v1.6.26
5050
hooks:
5151
- id: actionlint
5252
- repo: https://github.com/adrienverge/yamllint
53-
rev: v1.32.0
53+
rev: v1.35.1
5454
hooks:
5555
- id: yamllint
5656
- repo: https://github.com/executablebooks/mdformat
57-
rev: 0.7.16
57+
rev: 0.7.17
5858
hooks:
5959
- id: mdformat
6060
additional_dependencies:
@@ -64,53 +64,33 @@ repos:
6464
- mdformat-toc
6565
- mdformat-deflist
6666
- mdformat-beautysh
67-
- mdformat-black
67+
- mdformat-ruff
6868
- mdformat-config
69+
- mdformat-web
6970
- repo: https://github.com/DavidAnson/markdownlint-cli2
70-
rev: v0.8.1
71+
rev: v0.12.1
7172
hooks:
7273
- id: markdownlint-cli2
7374
additional_dependencies:
74-
- markdown-it-texmath@0.9.1
75+
- markdown-it-texmath
7576
- repo: https://github.com/Freed-Wu/pre-commit-hooks
7677
rev: 0.0.11
7778
hooks:
7879
- id: update-CITATION.cff
7980
- id: update-pyproject.toml
8081
- repo: https://github.com/perltidy/perltidy
81-
rev: "20230701.02"
82+
rev: "20230912.13"
8283
hooks:
8384
- id: perltidy
84-
- repo: https://github.com/psf/black
85-
rev: 23.7.0
85+
- repo: https://github.com/astral-sh/ruff-pre-commit
86+
rev: v0.2.1
8687
hooks:
87-
- id: black
88-
- repo: https://github.com/PyCQA/isort
89-
rev: 5.12.0
90-
hooks:
91-
- id: isort
92-
- repo: https://github.com/pycqa/pydocstyle
93-
rev: 6.3.0
94-
hooks:
95-
- id: pydocstyle
96-
additional_dependencies:
97-
- tomli
88+
- id: ruff
89+
- id: ruff-format
9890
- repo: https://github.com/kumaraditya303/mirrors-pyright
99-
rev: v1.1.322
91+
rev: v1.1.350
10092
hooks:
10193
- id: pyright
102-
- repo: https://github.com/PyCQA/bandit
103-
rev: 1.7.5
104-
hooks:
105-
- id: bandit
106-
args:
107-
- -cpyproject.toml
108-
additional_dependencies:
109-
- tomli
110-
- repo: https://github.com/nix-community/nixpkgs-fmt
111-
rev: v1.3.0
112-
hooks:
113-
- id: nixpkgs-fmt
11494

11595
ci:
11696
skip:

docs/conf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
33
https://www.sphinx-doc.org/en/master/usage/configuration.html
44
"""
5+
56
import os
67
from datetime import datetime
78

8-
from sphinxcontrib.eval import __version__ as version
9-
109
try:
1110
import tomllib # type: ignore
1211
except ImportError:

pyproject.toml

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ build-backend = "setuptools.build_meta"
66
[project]
77
name = "sphinxcontrib-eval"
88
description = "Evaluate shell command or python code in sphinx and myst"
9-
authors = [{ name = "Wu Zhenyu", email = "[email protected]" }]
109
readme = "README.md"
1110
requires-python = ">= 3.9"
1211
keywords = ["sphinx", "myst", "eval"]
13-
license = { text = "GPL v3" }
1412
classifiers = [
1513
"Development Status :: 3 - Alpha",
1614
"Intended Audience :: Developers",
@@ -25,9 +23,19 @@ classifiers = [
2523
"Programming Language :: Python :: 3.9",
2624
"Programming Language :: Python :: 3.10",
2725
"Programming Language :: Python :: 3.11",
26+
"Programming Language :: Python :: 3.12",
27+
"Programming Language :: Python :: Implementation :: CPython",
28+
"Programming Language :: Python :: Implementation :: PyPy",
2829
]
2930
dynamic = ["version", "dependencies", "optional-dependencies"]
3031

32+
[[project.authors]]
33+
name = "Wu Zhenyu"
34+
35+
36+
[project.license]
37+
text = "GPL v3"
38+
3139
[project.urls]
3240
Homepage = "https://sphinxcontrib-eval.readthedocs.io"
3341
Download = "https://github.com/sphinx-contrib/eval/releases"
@@ -40,8 +48,8 @@ write_to = "src/sphinxcontrib/eval/_version.py"
4048
[tool.setuptools.package-data]
4149
"sphinxcontrib.eval" = ["py.typed"]
4250

43-
[tool.setuptools.dynamic]
44-
dependencies = { file = "requirements.txt" }
51+
[tool.setuptools.dynamic.dependencies]
52+
file = "requirements.txt"
4553

4654
# begin: scripts/update-pyproject.toml.pl
4755
[tool.setuptools.dynamic.optional-dependencies.dev]
@@ -54,25 +62,37 @@ file = "requirements/myst.txt"
5462
[tool.mdformat]
5563
number = true
5664

57-
[tool.black]
58-
line-length = 79
59-
60-
[tool.isort]
61-
line_length = 79
62-
profile = "black"
63-
64-
# https://github.com/PyCQA/pydocstyle/issues/418
65-
[tool.pydocstyle]
66-
add_ignore = "D205, D400"
67-
6865
[tool.doq]
6966
template_path = "templates"
7067

71-
[tool.bandit]
72-
skips = ["B404"]
68+
[tool.ruff]
69+
line-length = 79
7370

74-
[tool.bandit.assert_used]
75-
skips = ["tests/*.py", "*_test.py", "test_*.py"]
71+
[tool.ruff.lint]
72+
select = [
73+
# pycodestyle
74+
"E",
75+
# pyflakes
76+
"F",
77+
# pyupgrade
78+
"UP",
79+
# flake8-bugbear
80+
"B",
81+
# flake8-simplify
82+
"SIM",
83+
# isort
84+
"I",
85+
]
86+
ignore = ["D205", "D400"]
87+
preview = true
88+
89+
[tool.ruff.format]
90+
docstring-code-format = true
91+
preview = true
7692

7793
[tool.coverage.report]
78-
exclude_lines = ["if TYPE_CHECKING:", "if __name__ == .__main__.:"]
94+
exclude_lines = [
95+
"if TYPE_CHECKING:",
96+
"if __name__ == .__main__.:",
97+
"\\s*import tomli as tomllib",
98+
]

src/sphinxcontrib/eval/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Provide ``setup()`` to
22
`sphinx <https://www.sphinx-doc.org/en/master/extdev/index.html>`_.
33
"""
4+
45
from __future__ import annotations
56

67
import io
@@ -12,7 +13,7 @@
1213
if TYPE_CHECKING:
1314
from sphinx.application import Sphinx
1415

15-
from ._version import __version__, __version_tuple__ # type: ignore
16+
from ._version import __version__ # type: ignore
1617
from .rst import RSTEvalParser
1718

1819
SH = os.getenv("SHELL", "sh")

src/sphinxcontrib/eval/myst.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
Provide ``MystEvalParser``.
55
"""
6+
67
from myst_parser.parsers.sphinx_ import MystParser
78

89
from .utils import patch_parser

src/sphinxcontrib/eval/rst.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
Provide ``RSTEvalParser``.
55
"""
6+
67
from sphinx.parsers import RSTParser
78

89
from .utils import patch_parser

src/sphinxcontrib/eval/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
"""Utilities
22
============
33
"""
4+
45
import re
5-
from typing import Callable, Type
6+
from typing import Callable
67

78
from docutils.nodes import document
89
from sphinx.parsers import Parser
@@ -50,7 +51,7 @@ def replace(
5051
return outputstring
5152

5253

53-
def patch_parser(template: str, parser: Type[Parser]) -> Type[Parser]:
54+
def patch_parser(template: str, parser: type[Parser]) -> type[Parser]:
5455
"""Patch parser.
5556
5657
:param template:

tests/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
"""Provide ``AppMixin``."""
2+
23
import os
34
import shutil
45
import tempfile
6+
from contextlib import suppress
57
from functools import update_wrapper
68
from pathlib import Path
79

@@ -62,11 +64,9 @@ def add_node(self, node):
6264
self.nodes.add(node.__name__)
6365

6466
app = App()
65-
try:
67+
# Sphinx 1 doesn't have this
68+
with suppress(AttributeError):
6669
addnodes.setup(app) # type: ignore
67-
except AttributeError:
68-
# Sphinx 1 doesn't have this
69-
pass
7070

7171
return app.nodes
7272

@@ -202,7 +202,6 @@ def ignore_warnings(self):
202202
@Lazy
203203
def doctree(self):
204204
"""Doctree."""
205-
getattr(self, "build_app")
206205
self.build_app = True # type: ignore
207206
app = self.app
208207
return app.env.get_doctree("content/doc") # type: ignore

tests/__init___test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""Test ``__init__.py``."""
2+
23
import sys
34
from shutil import which
45
from unittest import TestCase
56

67
import pytest
7-
88
from sphinxcontrib.eval import eval_bash, eval_python, eval_sh
99

1010
from . import AppMixin

tests/utils_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test utilities."""
2+
23
import re
34

45
from sphinxcontrib.eval.utils import get_lang_map, replace

0 commit comments

Comments
 (0)