Skip to content

Commit

Permalink
PEP 1 and 12: Document Topic header (python#2995)
Browse files Browse the repository at this point in the history
Co-authored-by: C.A.M. Gerlach <[email protected]>
  • Loading branch information
hugovk and CAM-Gerlach authored Feb 3, 2023
1 parent 7e1d4a5 commit e92c4d6
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ RENDER_COMMAND=$(VENVDIR)/bin/python3 build.py -j $(JOBS) -o $(OUTPUT_DIR)
html: venv
$(RENDER_COMMAND)

## htmlview to open the index page built by the html target in your browser
.PHONY: htmlview
htmlview: html
$(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('build/index.html'))"

## dirhtml to render PEPs to "index.html" files within "pep-NNNN" directories
.PHONY: dirhtml
dirhtml: venv rss
Expand Down
11 changes: 11 additions & 0 deletions infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ resource "fastly_service_vcl" "peps" {
EOT
}

snippet {
name = "topics"
type = "recv"
content = <<-EOT
if (req.url ~ "^/topics($|/)") {
set req.http.Location = regsub(req.http.Location, "^/topics/?", "/topic/");
error 618;
}
EOT
}

snippet {
name = "redirect"
type = "error"
Expand Down
5 changes: 5 additions & 0 deletions pep-0001.txt
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ optional and are described below. All other headers are required.
Status: <Draft | Active | Accepted | Provisional | Deferred | Rejected |
Withdrawn | Final | Superseded>
Type: <Standards Track | Informational | Process>
* Topic: <Governance | Packaging | Release | Typing>
* Content-Type: text/x-rst
* Requires: <pep numbers>
Created: <date created on, in dd-mmm-yyyy format>
Expand Down Expand Up @@ -659,6 +660,10 @@ archives, rather than just a mailto: or hyperlink to the list itself.
The Type header specifies the type of PEP: Standards Track,
Informational, or Process.

The optional Topic header lists the special topic, if any,
the PEP belongs under.
See the :ref:`topic-index` for the existing topics.

The format of a PEP is specified with a Content-Type header.
All PEPs must use reStructuredText (see :pep:`12`),
and have a value of ``text/x-rst``, the default.
Expand Down
4 changes: 4 additions & 0 deletions pep-0012.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ directions below.
Python-Version: 2.2
- Add a Topic header if the PEP belongs under one shown at the :ref:`topic-index`.
Most PEPs don't.

- Leave Post-History alone for now; you'll add dates and corresponding links
to this header each time you post your PEP to the designated discussion forum
(and update the Discussions-To header with said link, as above).
Expand Down Expand Up @@ -174,6 +177,7 @@ your PEP):
Discussions-To: [URL]
Status: Draft
Type: [Standards Track | Informational | Process]
Topic: *[Governance | Packaging | Release | Typing]
Content-Type: text/x-rst
Requires: *[NNN]
Created: [DD-MMM-YYYY]
Expand Down
1 change: 1 addition & 0 deletions pep-0012/pep-NNNN.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ PEP-Delegate: <PEP delegate's real name>
Discussions-To: <REQUIRED: URL of current canonical discussion thread>
Status: <REQUIRED: Draft | Active | Accepted | Provisional | Deferred | Rejected | Withdrawn | Final | Superseded>
Type: <REQUIRED: Standards Track | Informational | Process>
Topic: <Governance | Packaging | Release | Typing>
Content-Type: text/x-rst
Requires: <pep numbers>
Created: <date created on, in dd-mmm-yyyy format>
Expand Down
2 changes: 2 additions & 0 deletions pep_sphinx_extensions/pep_zero_generator/subindices.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def generate_subindices(

def generate_topic_contents(docnames: list[str], env: BuildEnvironment):
update_sphinx("topic/index", """\
.. _topic-index:
Topic Index
***********
Expand Down

0 comments on commit e92c4d6

Please sign in to comment.