Skip to content

Commit e92c4d6

Browse files
hugovkCAM-Gerlach
andauthored
PEP 1 and 12: Document Topic header (python#2995)
Co-authored-by: C.A.M. Gerlach <[email protected]>
1 parent 7e1d4a5 commit e92c4d6

File tree

6 files changed

+28
-0
lines changed

6 files changed

+28
-0
lines changed

Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ RENDER_COMMAND=$(VENVDIR)/bin/python3 build.py -j $(JOBS) -o $(OUTPUT_DIR)
1111
html: venv
1212
$(RENDER_COMMAND)
1313

14+
## htmlview to open the index page built by the html target in your browser
15+
.PHONY: htmlview
16+
htmlview: html
17+
$(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('build/index.html'))"
18+
1419
## dirhtml to render PEPs to "index.html" files within "pep-NNNN" directories
1520
.PHONY: dirhtml
1621
dirhtml: venv rss

infra/main.tf

+11
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ resource "fastly_service_vcl" "peps" {
3939
EOT
4040
}
4141

42+
snippet {
43+
name = "topics"
44+
type = "recv"
45+
content = <<-EOT
46+
if (req.url ~ "^/topics($|/)") {
47+
set req.http.Location = regsub(req.http.Location, "^/topics/?", "/topic/");
48+
error 618;
49+
}
50+
EOT
51+
}
52+
4253
snippet {
4354
name = "redirect"
4455
type = "error"

pep-0001.txt

+5
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ optional and are described below. All other headers are required.
605605
Status: <Draft | Active | Accepted | Provisional | Deferred | Rejected |
606606
Withdrawn | Final | Superseded>
607607
Type: <Standards Track | Informational | Process>
608+
* Topic: <Governance | Packaging | Release | Typing>
608609
* Content-Type: text/x-rst
609610
* Requires: <pep numbers>
610611
Created: <date created on, in dd-mmm-yyyy format>
@@ -659,6 +660,10 @@ archives, rather than just a mailto: or hyperlink to the list itself.
659660
The Type header specifies the type of PEP: Standards Track,
660661
Informational, or Process.
661662

663+
The optional Topic header lists the special topic, if any,
664+
the PEP belongs under.
665+
See the :ref:`topic-index` for the existing topics.
666+
662667
The format of a PEP is specified with a Content-Type header.
663668
All PEPs must use reStructuredText (see :pep:`12`),
664669
and have a value of ``text/x-rst``, the default.

pep-0012.rst

+4
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ directions below.
121121
122122
Python-Version: 2.2
123123
124+
- Add a Topic header if the PEP belongs under one shown at the :ref:`topic-index`.
125+
Most PEPs don't.
126+
124127
- Leave Post-History alone for now; you'll add dates and corresponding links
125128
to this header each time you post your PEP to the designated discussion forum
126129
(and update the Discussions-To header with said link, as above).
@@ -174,6 +177,7 @@ your PEP):
174177
Discussions-To: [URL]
175178
Status: Draft
176179
Type: [Standards Track | Informational | Process]
180+
Topic: *[Governance | Packaging | Release | Typing]
177181
Content-Type: text/x-rst
178182
Requires: *[NNN]
179183
Created: [DD-MMM-YYYY]

pep-0012/pep-NNNN.rst

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ PEP-Delegate: <PEP delegate's real name>
66
Discussions-To: <REQUIRED: URL of current canonical discussion thread>
77
Status: <REQUIRED: Draft | Active | Accepted | Provisional | Deferred | Rejected | Withdrawn | Final | Superseded>
88
Type: <REQUIRED: Standards Track | Informational | Process>
9+
Topic: <Governance | Packaging | Release | Typing>
910
Content-Type: text/x-rst
1011
Requires: <pep numbers>
1112
Created: <date created on, in dd-mmm-yyyy format>

pep_sphinx_extensions/pep_zero_generator/subindices.py

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def generate_subindices(
5757

5858
def generate_topic_contents(docnames: list[str], env: BuildEnvironment):
5959
update_sphinx("topic/index", """\
60+
.. _topic-index:
61+
6062
Topic Index
6163
***********
6264

0 commit comments

Comments
 (0)