Skip to content

Commit 87e355d

Browse files
committed
Merge remote-tracking branch 'upstream/master' into windows-testing
2 parents b959f54 + 7649798 commit 87e355d

File tree

287 files changed

+61042
-54582
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

287 files changed

+61042
-54582
lines changed

.github/workflows/main.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ jobs:
5151
name: Docutils HEAD
5252

5353
steps:
54+
- name: Install epubcheck
55+
run: |
56+
mkdir /tmp/epubcheck && cd /tmp/epubcheck
57+
wget https://github.com/w3c/epubcheck/releases/download/v5.1.0/epubcheck-5.1.0.zip
58+
unzip epubcheck-5.1.0.zip
5459
- uses: actions/checkout@v4
5560
- name: Set up Python
5661
uses: actions/setup-python@v5
@@ -70,3 +75,55 @@ jobs:
7075
run: python -m pytest -vv
7176
env:
7277
PYTHONWARNINGS: "error" # treat all warnings as errors
78+
DO_EPUBCHECK: "1"
79+
EPUBCHECK_PATH: "/tmp/epubcheck/epubcheck-5.1.0/epubcheck.jar"
80+
81+
latex:
82+
runs-on: ubuntu-latest
83+
name: LaTeX
84+
container:
85+
image: ghcr.io/sphinx-doc/sphinx-ci
86+
87+
steps:
88+
- uses: actions/checkout@v4
89+
- name: Set up Python
90+
uses: actions/setup-python@v5
91+
with:
92+
python-version: "3"
93+
- name: Check Python version
94+
run: python --version --version
95+
- name: Install dependencies
96+
run: |
97+
python -m pip install --upgrade pip
98+
python -m pip install .[test]
99+
- name: Test with pytest
100+
run: python -m pytest -vv --durations 25
101+
env:
102+
PYTHONWARNINGS: "error" # treat all warnings as errors
103+
DO_EPUBCHECK: "1"
104+
105+
coverage:
106+
if: github.event_name == 'push' && github.repository_owner == 'sphinx-doc'
107+
runs-on: ubuntu-latest
108+
name: Coverage
109+
110+
steps:
111+
- uses: actions/checkout@v4
112+
- name: Set up Python
113+
uses: actions/setup-python@v5
114+
with:
115+
python-version: "3"
116+
- name: Check Python version
117+
run: python --version --version
118+
- name: Install graphviz
119+
run: sudo apt-get install graphviz
120+
- name: Install dependencies
121+
run: |
122+
python -m pip install --upgrade pip
123+
python -m pip install .[test] pytest-cov
124+
- name: Test with pytest
125+
run: python -m pytest -vv --cov . --cov-append --cov-config pyproject.toml
126+
env:
127+
VIRTUALENV_SYSTEM_SITE_PACKAGES: "1"
128+
- name: codecov
129+
uses: codecov/codecov-action@v4

.ruff.toml

Lines changed: 47 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,34 @@ target-version = "py39" # Pin Ruff to Python 3.9
22
line-length = 95
33
output-format = "full"
44

5-
[lint]
6-
preview = true
7-
exclude = [
8-
".git",
9-
".tox",
10-
".venv",
5+
extend-exclude = [
116
"tests/roots/*",
127
"build/*",
138
"doc/_build/*",
149
"sphinx/search/*",
1510
"doc/usage/extensions/example*.py",
1611
]
12+
13+
[lint]
14+
preview = true
1715
ignore = [
16+
# flake8-annotations
1817
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in `{name}`
18+
# pycodestyle
1919
"E741", # Ambiguous variable name: `{name}`
20+
# pyflakes
2021
"F841", # Local variable `{name}` is assigned to but never used
22+
# refurb
2123
"FURB101", # `open` and `read` should be replaced by `Path(...).read_text(...)`
24+
"FURB103", # `open` and `write` should be replaced by `Path(...).write_text(...)`
25+
# pylint
2226
"PLC1901", # simplify truthy/falsey string comparisons
27+
# flake8-simplify
2328
"SIM102", # Use a single `if` statement instead of nested `if` statements
2429
"SIM108", # Use ternary operator `{contents}` instead of `if`-`else`-block
30+
# pyupgrade
2531
"UP031", # Use format specifiers instead of percent format
2632
"UP032", # Use f-string instead of `format` call
27-
2833
]
2934
external = [ # Whitelist for RUF100 unknown code warnings
3035
"E704",
@@ -35,7 +40,8 @@ select = [
3540
# NOT YET USED
3641
# airflow ('AIR')
3742
# Airflow is not used in Sphinx
38-
"ANN", # flake8-annotations ('ANN')
43+
# flake8-annotations ('ANN')
44+
"ANN",
3945
# flake8-unused-arguments ('ARG')
4046
"ARG004", # Unused static method argument: `{name}`
4147
# flake8-async ('ASYNC')
@@ -106,9 +112,7 @@ select = [
106112
# pycodestyle ('E')
107113
"E",
108114
# flake8-errmsg ('EM')
109-
"EM101", # Exception must not use a string literal, assign to variable first
110-
"EM102", # Exception must not use an f-string literal, assign to variable first
111-
"EM103", # Exception must not use a `.format()` string directly, assign to variable first
115+
"EM",
112116
# eradicate ('ERA')
113117
# NOT YET USED
114118
# flake8-executable ('EXE')
@@ -122,11 +126,12 @@ select = [
122126
# flake8-fixme ('FIX')
123127
# NOT YET USED
124128
# flynt ('FLY')
125-
# NOT YET USED
126-
"FURB", # refurb
129+
"FLY",
130+
# refurb ('FURB')
131+
"FURB",
127132
# flake8-logging-format ('G')
128133
"G001", # Logging statement uses `str.format`
129-
# "G002", # Logging statement uses `%`
134+
"G002", # Logging statement uses `%`
130135
# "G003", # Logging statement uses `+`
131136
"G004", # Logging statement uses f-string
132137
"G010", # Logging statement uses `warn` instead of `warning`
@@ -135,20 +140,16 @@ select = [
135140
"G202", # Logging statement has redundant `exc_info`
136141
# isort ('I')
137142
"I",
143+
# flake8-import-conventions ('ICN')
138144
"ICN", # flake8-import-conventions
139145
# flake8-no-pep420 ('INP')
140146
"INP",
141147
# flake8-gettext ('INT')
142-
"INT001", # f-string is resolved before function call; consider `_("string %s") % arg`
143-
"INT002", # `format` method argument is resolved before function call; consider `_("string %s") % arg`
144-
"INT003", # printf-style format is resolved before function call; consider `_("string %s") % arg`
148+
"INT",
145149
# flake8-implicit-str-concat ('ISC')
146150
# NOT YET USED
147151
# flake8-logging ('LOG')
148-
"LOG001", # Use `logging.getLogger()` to instantiate loggers
149-
"LOG002", # Use `__name__` with `logging.getLogger()`
150-
"LOG007", # Use of `logging.exception` with falsy `exc_info`
151-
"LOG009", # Use of undocumented `logging.WARN` constant
152+
"LOG",
152153
# pep8-naming ('N')
153154
# NOT YET USED
154155
# numpy-specific rules ('NPY')
@@ -176,9 +177,15 @@ select = [
176177
"PLC0105", # `{kind}` name "{param_name}" does not reflect its {variance}; consider renaming it to "{replacement_name}"
177178
"PLC0131", # `{kind}` cannot be both covariant and contravariant
178179
"PLC0132", # `{kind}` name `{param_name}` does not match assigned variable name `{var_name}`
179-
# "PLC0205", # Class `__slots__` should be a non-string iterable
180-
# "PLC0208", # Use a sequence type instead of a `set` when iterating over values
180+
"PLC0205", # Class `__slots__` should be a non-string iterable
181+
"PLC0208", # Use a sequence type instead of a `set` when iterating over values
181182
"PLC0414", # Import alias does not rename original package
183+
# "PLC0415", # `import` should be at the top-level of a file
184+
"PLC1901", # `{existing}` can be simplified to `{replacement}` as an empty string is falsey
185+
"PLC2401", # {kind} name `{name}` contains a non-ASCII character, consider renaming it
186+
"PLC2403", # Module alias `{name}` contains a non-ASCII character, use an ASCII-only alias
187+
# "PLC2701", # Private name import `{name}` from external module `{module}`
188+
"PLC2801", # Unnecessary dunder call to `{method}`. {replacement}.
182189
"PLC3002", # Lambda expression called directly. Execute the expression inline instead.
183190
# pylint ('PLE')
184191
"PLE0100", # `__init__` method is a generator
@@ -326,16 +333,19 @@ select = [
326333
"S612", # Use of insecure `logging.config.listen` detected
327334
# "S701", # Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function.
328335
# "S702", # Mako templates allow HTML and JavaScript rendering by default and are inherently open to XSS attacks
336+
# flake8-simplify ('SIM')
329337
"SIM", # flake8-simplify
330338
# flake8-self ('SLF')
331339
# NOT YET USED
332-
"SLOT", # flake8-slots
340+
# flake8-slots ('SLOT')
341+
"SLOT",
333342
# flake8-debugger ('T10')
334343
"T100", # Trace found: `{name}` used
335344
# flake8-print ('T20')
336345
"T201", # `print` found
337346
"T203", # `pprint` found
338-
"TCH", # flake8-type-checking
347+
# flake8-type-checking ('TCH')
348+
"TCH",
339349
# flake8-todos ('TD')
340350
# "TD001", # Invalid TODO tag: `{tag}`
341351
# "TD003", # Missing issue link on the line following this TODO
@@ -351,14 +361,10 @@ select = [
351361
# Trio is not used in Sphinx
352362
# tryceratops ('TRY')
353363
# NOT YET USED
354-
"UP001", # pyupgrade
364+
# pyupgrade ('UP')
365+
"UP",
355366
# pycodestyle ('W')
356-
"W191", # Indentation contains tabs
357-
# "W291", # Trailing whitespace
358-
"W292", # No newline at end of file
359-
"W293", # Blank line contains whitespace
360-
"W505", # Doc line too long ({width} > {limit} characters)
361-
"W605", # Invalid escape sequence: `\{char}`
367+
"W",
362368
# flake8-2020 ('YTT')
363369
"YTT",
364370
]
@@ -370,7 +376,10 @@ select = [
370376
"doc/conf.py" = ["INP001", "W605"]
371377
"doc/development/tutorials/examples/*" = ["INP001"]
372378
# allow print() in the tutorial
373-
"doc/development/tutorials/examples/recipe.py" = ["T201"]
379+
"doc/development/tutorials/examples/recipe.py" = [
380+
"FURB118",
381+
"T201"
382+
]
374383
"sphinx/domains/**" = ["FURB113"]
375384
"tests/test_domains/test_domain_cpp.py" = ["FURB113"]
376385

@@ -386,7 +395,7 @@ select = [
386395
"sphinx/environment/adapters/toctree.py" = ["B026"]
387396

388397
# whitelist ``print`` for stdout messages
389-
"sphinx/ext/intersphinx.py" = ["T201"]
398+
"sphinx/ext/intersphinx/_cli.py" = ["T201"]
390399

391400
# whitelist ``print`` for stdout messages
392401
"sphinx/testing/fixtures.py" = ["T201"]
@@ -494,7 +503,10 @@ exclude = [
494503
"sphinx/ext/mathjax.py",
495504
"sphinx/ext/doctest.py",
496505
"sphinx/ext/autosectionlabel.py",
497-
"sphinx/ext/intersphinx.py",
506+
"sphinx/ext/intersphinx/__init__.py",
507+
"sphinx/ext/intersphinx/_cli.py",
508+
"sphinx/ext/intersphinx/_load.py",
509+
"sphinx/ext/intersphinx/_resolve.py",
498510
"sphinx/ext/duration.py",
499511
"sphinx/ext/imgconverter.py",
500512
"sphinx/ext/imgmath.py",

0 commit comments

Comments
 (0)