Skip to content

Commit 3562b92

Browse files
authored
Merge branch 'main' into pep-694-staged-releases-legacy-entry
2 parents caacbed + ce48c4e commit 3562b92

53 files changed

Lines changed: 5593 additions & 851 deletions

Some content is hidden

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

‎.github/CODEOWNERS‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,8 @@ peps/pep-0819.rst @emmatyping
700700
peps/pep-0820.rst @encukou
701701
peps/pep-0821.rst @JelleZijlstra
702702
peps/pep-0822.rst @methane
703+
peps/pep-0823.rst @gvanrossum
704+
peps/pep-0824.rst @gvanrossum
703705
peps/pep-0825.rst @warsaw @dstufft
704706
peps/pep-0826.rst @savannahostrowski
705707
peps/pep-0827.rst @1st1
@@ -719,6 +721,11 @@ peps/pep-0841.rst @corona10 @sobolevn
719721
peps/pep-0842.rst @ZeroIntensity
720722
peps/pep-0843.rst @ZeroIntensity
721723
peps/pep-0844.rst @warsaw
724+
peps/pep-0845.rst @ethanfurman
725+
peps/pep-0846.rst @JelleZijlstra @johnslavik
726+
peps/pep-0847.rst @dstufft
727+
peps/pep-0848.rst @markshannon
728+
peps/pep-0849.rst @JelleZijlstra
722729
# ...
723730
peps/pep-2026.rst @hugovk
724731
# ...

‎.pre-commit-config.yaml‎

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,40 +54,46 @@ repos:
5454
name: "Format with Black"
5555
args:
5656
- '--target-version=py311'
57-
files: '^(peps/conf\.py|pep_sphinx_extensions/tests/.*)$'
57+
exclude: '^peps/'
5858

5959
- repo: https://github.com/astral-sh/ruff-pre-commit
60-
rev: v0.15.21
60+
rev: v0.16.6
6161
hooks:
6262
- id: ruff-check
6363
name: "Lint with Ruff"
6464
args:
6565
- '--exit-non-zero-on-fix'
66-
files: '^pep_sphinx_extensions/tests/'
67-
- id: ruff-format
68-
name: "Format with Ruff"
69-
args:
70-
- '--check'
71-
files: '^release_management/'
66+
exclude: '^peps/'
7267

7368
- repo: https://github.com/python-jsonschema/check-jsonschema
74-
rev: 0.37.4
69+
rev: 0.38.0
7570
hooks:
7671
- id: check-dependabot
7772
- id: check-github-workflows
73+
- id: check-readthedocs
7874

7975
- repo: https://github.com/rhysd/actionlint
8076
rev: v1.7.12
8177
hooks:
8278
- id: actionlint
8379

8480
- repo: https://github.com/zizmorcore/zizmor-pre-commit
85-
rev: v1.26.1
81+
rev: v1.30.1
8682
hooks:
8783
- id: zizmor
8884

85+
- repo: https://github.com/tox-dev/pyproject-fmt
86+
rev: v2.29.4
87+
hooks:
88+
- id: pyproject-fmt
89+
90+
- repo: https://github.com/abravalheri/validate-pyproject
91+
rev: '0.26'
92+
hooks:
93+
- id: validate-pyproject
94+
8995
- repo: https://github.com/tox-dev/tox-ini-fmt
90-
rev: 1.7.2
96+
rev: 1.9.0
9197
hooks:
9298
- id: tox-ini-fmt
9399
name: "Format tox.ini"
@@ -114,7 +120,7 @@ repos:
114120

115121
# Manual codespell check
116122
- repo: https://github.com/codespell-project/codespell
117-
rev: v2.4.2
123+
rev: v2.4.3
118124
hooks:
119125
- id: codespell
120126
name: "Check for common misspellings in text files"

‎.ruff.toml‎

Lines changed: 0 additions & 15 deletions
This file was deleted.

‎build.py‎

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,33 @@ def create_parser():
1515
parser = argparse.ArgumentParser(description="Build PEP documents")
1616
# alternative builders:
1717
builders = parser.add_mutually_exclusive_group()
18-
builders.add_argument("-l", "--check-links", action="store_const",
19-
dest="builder", const="linkcheck",
20-
help='Check validity of links within PEP sources. '
21-
'Cannot be used with "-f" or "-d".')
22-
builders.add_argument("-f", "--build-files", action="store_const",
23-
dest="builder", const="html",
24-
help='Render PEPs to "pep-NNNN.html" files (default). '
25-
'Cannot be used with "-d" or "-l".')
26-
builders.add_argument("-d", "--build-dirs", action="store_const",
27-
dest="builder", const="dirhtml",
28-
help='Render PEPs to "index.html" files within "pep-NNNN" directories. '
29-
'Cannot be used with "-f" or "-l".')
18+
builders.add_argument(
19+
"-l",
20+
"--check-links",
21+
action="store_const",
22+
dest="builder",
23+
const="linkcheck",
24+
help="Check validity of links within PEP sources. "
25+
'Cannot be used with "-f" or "-d".',
26+
)
27+
builders.add_argument(
28+
"-f",
29+
"--build-files",
30+
action="store_const",
31+
dest="builder",
32+
const="html",
33+
help='Render PEPs to "pep-NNNN.html" files (default). '
34+
'Cannot be used with "-d" or "-l".',
35+
)
36+
builders.add_argument(
37+
"-d",
38+
"--build-dirs",
39+
action="store_const",
40+
dest="builder",
41+
const="dirhtml",
42+
help='Render PEPs to "index.html" files within "pep-NNNN" directories. '
43+
'Cannot be used with "-f" or "-l".',
44+
)
3045

3146
parser.add_argument(
3247
"-o",
@@ -46,7 +61,8 @@ def create_index_file(html_root: Path, builder: str) -> None:
4661
except FileNotFoundError:
4762
return None
4863
if builder == "dirhtml":
49-
pep_zero_text = pep_zero_text.replace('="../', '="') # remove relative directory links
64+
# remove relative directory links
65+
pep_zero_text = pep_zero_text.replace('="../', '="')
5066
html_root.joinpath("index.html").write_text(pep_zero_text, encoding="utf-8")
5167

5268

‎check-peps.py‎

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"Title",
4242
"Author",
4343
"Sponsor",
44-
"BDFL-Delegate", "PEP-Delegate",
44+
"BDFL-Delegate",
45+
"PEP-Delegate",
4546
"Discussions-To",
4647
"Status",
4748
"Type",
@@ -57,18 +58,20 @@
5758
REQUIRED_HEADERS = frozenset({"PEP", "Title", "Author", "Status", "Type", "Created"})
5859

5960
# See PEP 1 for the full list
60-
ALL_STATUSES = frozenset({
61-
"Accepted",
62-
"Active",
63-
"April Fool!",
64-
"Deferred",
65-
"Draft",
66-
"Final",
67-
"Provisional",
68-
"Rejected",
69-
"Superseded",
70-
"Withdrawn",
71-
})
61+
ALL_STATUSES = frozenset(
62+
{
63+
"Accepted",
64+
"Active",
65+
"April Fool!",
66+
"Deferred",
67+
"Draft",
68+
"Final",
69+
"Provisional",
70+
"Rejected",
71+
"Superseded",
72+
"Withdrawn",
73+
}
74+
)
7275

7376
# PEPs that are allowed to link directly to PEPs
7477
SKIP_DIRECT_PEP_LINK_CHECK = frozenset({"0009", "0287", "0676", "0684", "8001"})
@@ -86,8 +89,12 @@
8689
DISCOURSE_POST_PATTERN = re.compile(r"([\w\-]+/)?\d+(/\d+)?", DEFAULT_FLAGS)
8790

8891
MAILMAN_2_PATTERN = re.compile(r"[\w\-]+/\d{4}-[a-z]+/\d+\.html", DEFAULT_FLAGS)
89-
MAILMAN_3_THREAD_PATTERN = re.compile(r"[\w\-]+@python\.org/thread/[a-z0-9]+/?", DEFAULT_FLAGS)
90-
MAILMAN_3_MESSAGE_PATTERN = re.compile(r"[\w\-]+@python\.org/message/[a-z0-9]+/?(#[a-z0-9]+)?", DEFAULT_FLAGS)
92+
MAILMAN_3_THREAD_PATTERN = re.compile(
93+
r"[\w\-]+@python\.org/thread/[a-z0-9]+/?", DEFAULT_FLAGS
94+
)
95+
MAILMAN_3_MESSAGE_PATTERN = re.compile(
96+
r"[\w\-]+@python\.org/message/[a-z0-9]+/?(#[a-z0-9]+)?", DEFAULT_FLAGS
97+
)
9198

9299
# Controlled by the "--detailed" flag
93100
DETAILED_ERRORS = False
@@ -203,7 +210,9 @@ def check_direct_links(line_num: int, line: str) -> MessageIterator:
203210
yield line_num, "Use the :rfc:`NNN` role to refer to RFCs"
204211

205212

206-
def _output_error(filename: Path, lines: Sequence[str], errors: Iterable[Message]) -> int:
213+
def _output_error(
214+
filename: Path, lines: Sequence[str], errors: Iterable[Message]
215+
) -> int:
207216
relative_filename = filename.relative_to(ROOT_DIR)
208217
err_count = 0
209218
for line_num, msg in errors:
@@ -501,7 +510,14 @@ def _invalid_domain(domain_part: str) -> bool:
501510
return not root.isalnum() or not root.isascii()
502511

503512

504-
def _thread(line_num: int, url: str, prefix: str, *, allow_message: bool = False, discussions_to: bool = False) -> MessageIterator:
513+
def _thread(
514+
line_num: int,
515+
url: str,
516+
prefix: str,
517+
*,
518+
allow_message: bool = False,
519+
discussions_to: bool = False,
520+
) -> MessageIterator:
505521
if allow_message and discussions_to:
506522
msg = "allow_message and discussions_to cannot both be True"
507523
raise ValueError(msg)
@@ -523,7 +539,7 @@ def _thread(line_num: int, url: str, prefix: str, *, allow_message: bool = False
523539

524540
# We use ``str.rpartition`` as the topic name is optional
525541
topic_name, _, topic_id = remainder.rpartition("/")
526-
if topic_name == '' and _is_digits(topic_id):
542+
if topic_name == "" and _is_digits(topic_id):
527543
return
528544
topic_name = topic_name.replace("-", "0").replace("_", "0")
529545
# the topic name must not be entirely numeric

‎pep_sphinx_extensions/__init__.py‎

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from pep_sphinx_extensions.generate_rss import (
1313
create_rss_feed,
1414
get_from_doctree,
15-
pep_abstract,
1615
)
1716
from pep_sphinx_extensions.pep_processor.html import (
1817
pep_html_builder,
@@ -23,8 +22,7 @@
2322
pep_parser,
2423
pep_role,
2524
)
26-
from pep_sphinx_extensions.pep_processor.transforms import pep_footer
27-
from pep_sphinx_extensions.pep_processor.transforms import pep_references
25+
from pep_sphinx_extensions.pep_processor.transforms import pep_footer, pep_references
2826
from pep_sphinx_extensions.pep_zero_generator.pep_index_generator import create_pep_zero
2927

3028
if TYPE_CHECKING:
@@ -85,35 +83,46 @@ def setup(app: Sphinx) -> dict[str, bool]:
8583

8684
app.add_source_parser(pep_parser.PEPParser) # Add PEP transforms
8785

88-
app.set_translator("html", pep_html_translator.PEPTranslator) # Docutils Node Visitor overrides (html builder)
89-
app.set_translator("dirhtml", pep_html_translator.PEPTranslator) # Docutils Node Visitor overrides (dirhtml builder)
86+
app.set_translator(
87+
"html", pep_html_translator.PEPTranslator
88+
) # Docutils Node Visitor overrides (html builder)
89+
app.set_translator(
90+
"dirhtml", pep_html_translator.PEPTranslator
91+
) # Docutils Node Visitor overrides (dirhtml builder)
9092

91-
app.add_role("pep", pep_role.PEPRole(), override=True) # Transform PEP references to links
93+
app.add_role(
94+
"pep", pep_role.PEPRole(), override=True
95+
) # Transform PEP references to links
9296

9397
app.add_post_transform(pep_references.PEPReferenceRoleTitleText)
98+
app.add_post_transform(pep_references.PEPIntersphinxTitleText)
9499

95100
# Register custom directives
101+
app.add_directive("pep-banner", pep_banner_directive.PEPBanner)
102+
app.add_directive("canonical-doc", pep_banner_directive.CanonicalDocBanner)
96103
app.add_directive(
97-
"pep-banner", pep_banner_directive.PEPBanner)
104+
"canonical-pypa-spec", pep_banner_directive.CanonicalPyPASpecBanner
105+
)
98106
app.add_directive(
99-
"canonical-doc", pep_banner_directive.CanonicalDocBanner)
100-
app.add_directive(
101-
"canonical-pypa-spec", pep_banner_directive.CanonicalPyPASpecBanner)
102-
app.add_directive(
103-
"canonical-typing-spec", pep_banner_directive.CanonicalTypingSpecBanner)
107+
"canonical-typing-spec", pep_banner_directive.CanonicalTypingSpecBanner
108+
)
104109
app.add_directive("rejected", pep_banner_directive.RejectedBanner)
105110
app.add_directive("superseded", pep_banner_directive.SupersededBanner)
106111
app.add_directive("withdrawn", pep_banner_directive.WithdrawnBanner)
107112

108113
# Register event callbacks
109-
app.connect("builder-inited", _update_config_for_builder) # Update configuration values for builder used
114+
app.connect(
115+
"builder-inited", _update_config_for_builder
116+
) # Update configuration values for builder used
110117
app.connect("env-before-read-docs", create_pep_zero) # PEP 0 hook
111-
app.connect('html-page-context', set_description)
118+
app.connect("html-page-context", set_description)
112119

113120
# Mathematics rendering
114121
inline_maths = HTMLTranslator.visit_math, None
115122
block_maths = HTMLTranslator.visit_math_block, None
116-
app.add_html_math_renderer("maths_to_html", inline_maths, block_maths) # Render maths to HTML
123+
app.add_html_math_renderer(
124+
"maths_to_html", inline_maths, block_maths
125+
) # Render maths to HTML
117126

118127
# Parallel safety: https://www.sphinx-doc.org/en/master/extdev/index.html#extension-metadata
119128
return {"parallel_read_safe": True, "parallel_write_safe": True}

‎pep_sphinx_extensions/generate_rss.py‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
def _format_rfc_2822(datetime: dt.datetime) -> str:
22-
datetime = datetime.replace(tzinfo=dt.timezone.utc)
22+
datetime = datetime.replace(tzinfo=dt.UTC)
2323
return format_datetime(datetime, usegmt=True)
2424

2525

@@ -64,14 +64,18 @@ def pep_abstract(document: nodes.document) -> str:
6464
return para_node.astext().strip().replace("\n", " ")
6565
return ""
6666
if title_node.astext() == "Introduction":
67-
introduction = node.next_node(nodes.paragraph).astext().strip().replace("\n", " ")
67+
introduction = (
68+
node.next_node(nodes.paragraph).astext().strip().replace("\n", " ")
69+
)
6870

6971
return introduction
7072

7173

7274
def _generate_items(doctree_dir: Path):
7375
# get list of peps with creation time (from "Created:" string in pep source)
74-
peps_with_dt = sorted((pep_creation(path), path) for path in doctree_dir.glob("pep-????.doctree"))
76+
peps_with_dt = sorted(
77+
(pep_creation(path), path) for path in doctree_dir.glob("pep-????.doctree")
78+
)
7579

7680
# generate rss items for 10 most recent peps (in reverse order)
7781
for datetime, full_path in reversed(peps_with_dt[-10:]):
@@ -86,7 +90,9 @@ def _generate_items(doctree_dir: Path):
8690
author = get_from_doctree(full_path, "Author")
8791
if "@" in author or " at " in author:
8892
parsed_authors = getaddresses([author])
89-
joined_authors = ", ".join(f"{name} ({email_address})" for name, email_address in parsed_authors)
93+
joined_authors = ", ".join(
94+
f"{name} ({email_address})" for name, email_address in parsed_authors
95+
)
9096
else:
9197
joined_authors = author
9298

@@ -104,7 +110,7 @@ def _generate_items(doctree_dir: Path):
104110

105111
def create_rss_feed(doctree_dir: Path, output_dir: Path):
106112
# The rss envelope
107-
last_build_date = _format_rfc_2822(dt.datetime.now(dt.timezone.utc))
113+
last_build_date = _format_rfc_2822(dt.datetime.now(dt.UTC))
108114
items = "\n".join(_generate_items(Path(doctree_dir)))
109115
output = f"""\
110116
<?xml version='1.0' encoding='UTF-8'?>

0 commit comments

Comments
 (0)