Skip to content

Commit

Permalink
PEP 612: Mark as Final (#3575)
Browse files Browse the repository at this point in the history
Co-authored-by: Hugo van Kemenade <[email protected]>
  • Loading branch information
hugovk and hugovk committed Jan 12, 2024
1 parent 6b226b1 commit f7f9f2d
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE/Mark a PEP Final.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ If you're unsure about something, just leave it blank and we'll take a look.
* [ ] Any substantial changes since the accepted version approved by the SC/PEP delegate
* [ ] Pull request title in appropriate format (``PEP 123: Mark Final``)
* [ ] ``Status`` changed to ``Final`` (and ``Python-Version`` is correct)
* [ ] Canonical docs/spec linked with a ``canonical-doc`` directive (or ``canonical-pypa-spec``, for packaging PEPs)
* [ ] Canonical docs/spec linked with a ``canonical-doc`` directive
(or ``canonical-pypa-spec`` for packaging PEPs,
or ``canonical-typing-spec`` for typing PEPs)
2 changes: 2 additions & 0 deletions pep_sphinx_extensions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def setup(app: Sphinx) -> dict[str, bool]:
"canonical-doc", pep_banner_directive.CanonicalDocBanner)
app.add_directive(
"canonical-pypa-spec", pep_banner_directive.CanonicalPyPASpecBanner)
app.add_directive(
"canonical-typing-spec", pep_banner_directive.CanonicalTypingSpecBanner)

# Register event callbacks
app.connect("builder-inited", _update_config_for_builder) # Update configuration values for builder used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from docutils.parsers import rst

PYPA_SPEC_BASE_URL = "https://packaging.python.org/en/latest/specifications/"
TYPING_SPEC_BASE_URL = "https://typing.readthedocs.io/en/latest/spec/"


class PEPBanner(rst.Directive):
Expand All @@ -24,7 +25,6 @@ class PEPBanner(rst.Directive):
admonition_class = nodes.important
css_classes = []


def run(self) -> list[nodes.admonition]:

if self.arguments:
Expand Down Expand Up @@ -81,7 +81,6 @@ class CanonicalDocBanner(PEPBanner):
css_classes = ["canonical-doc", "sticky-banner"]



class CanonicalPyPASpecBanner(PEPBanner):
"""Insert a specialized admonition for PyPA packaging specifications."""

Expand All @@ -103,3 +102,26 @@ class CanonicalPyPASpecBanner(PEPBanner):
admonition_class = nodes.attention

css_classes = ["canonical-pypa-spec", "sticky-banner"]


class CanonicalTypingSpecBanner(PEPBanner):
"""Insert a specialized admonition for the typing specification."""

admonition_pre_template = (
"This PEP is a historical document. "
"The up-to-date, canonical spec, {link_content}, is maintained on "
f"the `typing specs site <{TYPING_SPEC_BASE_URL}>`__."
)
admonition_pre_text = (
"This PEP is a historical document. "
"The up-to-date, canonical specifications are maintained on "
f"the `typing specs site <{TYPING_SPEC_BASE_URL}>`__."
)
admonition_post_text = (
"See the `typing specification update process "
"<https://typing.readthedocs.io/en/latest/spec/meta.html>`__ "
"for how to propose changes."
)
admonition_class = nodes.attention

css_classes = ["canonical-typing-spec", "sticky-banner"]
1 change: 1 addition & 0 deletions peps/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'packaging': ('https://packaging.python.org/en/latest/', None),
'typing': ('https://typing.readthedocs.io/en/latest/', None),
'devguide': ('https://devguide.python.org/', None),
'py3.11': ('https://docs.python.org/3.11/', None),
'py3.12': ('https://docs.python.org/3.12/', None),
Expand Down
8 changes: 5 additions & 3 deletions peps/pep-0012.rst
Original file line number Diff line number Diff line change
Expand Up @@ -653,9 +653,11 @@ Canonical Documentation and Intersphinx
As :pep:`PEP 1 describes <1#pep-maintenance>`,
PEPs are considered historical documents once marked Final,
and their canonical documentation/specification should be moved elsewhere.
To indicate this, use the ``canonical-docs`` directive
or an appropriate subclass
(currently ``canonical-pypa-spec`` for packaging standards).
To indicate this, use the ``canonical-doc`` directive
or an appropriate subclass:

* ``canonical-pypa-spec`` for packaging standards
* ``canonical-typing-spec`` for typing standards

Furthermore, you can use
`Intersphinx references
Expand Down
4 changes: 2 additions & 2 deletions peps/pep-0612.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ Author: Mark Mendoza <[email protected]>
Sponsor: Guido van Rossum <[email protected]>
BDFL-Delegate: Guido van Rossum <[email protected]>
Discussions-To: [email protected]
Status: Accepted
Status: Final
Type: Standards Track
Topic: Typing
Content-Type: text/x-rst
Created: 18-Dec-2019
Python-Version: 3.10
Post-History: 18-Dec-2019, 13-Jul-2020

.. canonical-typing-spec:: :ref:`typing:paramspec`

Abstract
--------
Expand Down

0 comments on commit f7f9f2d

Please sign in to comment.