Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infra: Add Python version to PEP 0 tables #3434

Merged
merged 9 commits into from
Sep 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add Python version to PEP 0 tables
hugovk committed Sep 15, 2023
commit 656b2dad48044a03d9448df12c6e31f7bd993ac6
1 change: 1 addition & 0 deletions pep_sphinx_extensions/pep_zero_generator/parser.py
Original file line number Diff line number Diff line change
@@ -140,6 +140,7 @@ def details(self) -> dict[str, str | int]:
"shorthand": self.shorthand,
# the author list as a comma-separated with only last names
"authors": ", ".join(author.full_name for author in self.authors),
"python_version": self.python_version or "",
hugovk marked this conversation as resolved.
Show resolved Hide resolved
}

@property
17 changes: 15 additions & 2 deletions pep_sphinx_extensions/pep_zero_generator/writer.py
Original file line number Diff line number Diff line change
@@ -74,12 +74,19 @@ def emit_author_table_separator(self, max_name_len: int) -> None:
self.output.append(author_table_separator)

def emit_pep_row(
self, *, shorthand: str, number: int, title: str, authors: str
self,
*,
shorthand: str,
number: int,
title: str,
authors: str,
python_version: str,
) -> None:
self.emit_text(f" * - {shorthand}")
self.emit_text(f" - :pep:`{number} <{number}>`")
self.emit_text(f" - :pep:`{title.replace('`', '')} <{number}>`")
self.emit_text(f" - {authors}")
self.emit_text(f" - {python_version}")

def emit_column_headers(self) -> None:
"""Output the column headers for the PEP indices."""
@@ -92,6 +99,7 @@ def emit_column_headers(self) -> None:
self.emit_text(" - PEP")
self.emit_text(" - Title")
self.emit_text(" - Authors")
self.emit_text(" - Python")
AA-Turner marked this conversation as resolved.
Show resolved Hide resolved

def emit_title(self, text: str, *, symbol: str = "=") -> None:
self.output.append(text)
@@ -112,6 +120,7 @@ def emit_pep_category(self, category: str, peps: list[PEP]) -> None:
self.emit_text(" -")
self.emit_text(" -")
self.emit_text(" -")
self.emit_text(" -")
self.emit_newline()

def write_pep0(
@@ -192,7 +201,11 @@ def write_pep0(
self.emit_column_headers()
for number, claimants in sorted(self.RESERVED.items()):
self.emit_pep_row(
shorthand="", number=number, title="RESERVED", authors=claimants
shorthand="",
number=number,
title="RESERVED",
authors=claimants,
python_version="",
)

self.emit_newline()
Original file line number Diff line number Diff line change
@@ -48,6 +48,7 @@ def test_pep_details(monkeypatch):
"number": 8,
"shorthand": ":abbr:`PA (Process, Active)`",
"title": "Style Guide for Python Code",
"python_version": "",
}