41
41
* save volunteer maintainers' time
42
42
43
43
We propose that PEPs are accessed through `peps.python.org `_ at the top-level
44
- namespace (for example `peps.python.org/pep-0008 `_), and that all custom
45
- tooling to support rendering PEPs is hosted in the `python/peps `_ repository.
44
+ (for example `peps.python.org/pep-0008 `_), and that all custom tooling to
45
+ support rendering PEPs is hosted in the `python/peps `_ repository.
46
46
47
47
48
48
Rationale
@@ -56,9 +56,9 @@ to create a full local instance of the `python.org`_ website and run a number
56
56
of disparate scripts, following `documentation `_ that lives outside of the
57
57
`python/peps `_ repository.
58
58
59
- The proposed implementation provides a single `Makefile `_ and a Python script
60
- to render all PEP files, with options to target a web server or local
61
- filesystem environment .
59
+ By contrast, the proposed implementation provides a single `Makefile `_ and a
60
+ Python script to render all PEP files, with options to target a web- server or
61
+ the local filesystem .
62
62
63
63
Using a single repository to host all tooling will clarify where to raise
64
64
issues, reducing volunteer time spent in triage.
@@ -81,18 +81,20 @@ There are several requests for additional features in reading PEPs, such as:
81
81
* intersphinx functionality [6 ]_
82
82
83
83
These are "easy wins" from this proposal, and would serve to improve the
84
- quality-of-life for consumers of PEPs (including reviewers and writers). For
85
- example, the reference implementation no longer requires a scheduled render
86
- process to run, instead initiating rendering on every commit to the
87
- `python/peps `_ repository.
84
+ quality-of-life for consumers of PEPs (including reviewers and writers).
85
+
86
+ For example, the current (as of November 2021) system runs periodically on a
87
+ schedule. This means that updates to PEPs cannot be circulated immediately,
88
+ reducing productivity. The reference implementation renders and publishes all
89
+ PEPs on every commit to the repository, solving the issue by design.
88
90
89
- Equally, there are a small number of broken items, for example list styles not
90
- being respected or support for updating images being challenging with the
91
- system [7 ]_. These would be solved by default in the proposal.
91
+ The reference implementation fixes several issues [7 ]_. For example:
92
92
93
- Commercial providers such as `Read the Docs `_ can additionally enhance this
94
- experience, for example by providing rendered previews of changes in pull
95
- requests.
93
+ * list styles are currently not respected by `python.org `_'s stylesheets
94
+ * support for updating images in PEPs is challenging in `python.org `_
95
+
96
+ Third-party providers such as `Read the Docs `_ or `Netlify `_ can enhance this
97
+ experience with features such as automatic rendering of pull requests.
96
98
97
99
98
100
Specification
@@ -101,17 +103,18 @@ Specification
101
103
The proposed specification for rendering the PEP files to HTML is as per the
102
104
`reference implementation `_.
103
105
104
- That the HTML files should be made available under `peps.python.org `_. The
105
- rendered files may be hosted just as static files, and behind a content
106
- delivery network (CDN).
106
+ The rendered PEPs MUST be available at `peps.python.org `_. These SHOULD be
107
+ hosted as static files, and MAY be behind a content delivery network (CDN).
107
108
108
- The following redirect rules must be created from the `python.org `_ domain:
109
+ The following redirect rules MUST be created for the `python.org `_ domain:
109
110
110
111
* ``/peps/ `` -> https://peps.python.org/
111
112
* ``/dev/peps/ `` -> https://peps.python.org/
112
113
* ``/peps/(.*)\.html `` -> https://peps.python.org/$1
113
114
* ``/dev/peps/(.*) `` -> https://peps.python.org/$1
114
115
116
+ The following nginx configuration would achieve this:
117
+
115
118
.. code-block :: nginx
116
119
117
120
location ~ ^/dev/peps/?(.*)$ {
@@ -126,66 +129,71 @@ The following redirect rules must be created from the `python.org`_ domain:
126
129
return 308 https://peps.python.org/;
127
130
}
128
131
129
- Redirects must be implemented to preserve `URL fragments `_ for backward
132
+ Redirects MUST be implemented to preserve `URL fragments `_ for backward
130
133
compatibility purposes.
131
134
132
135
133
136
Backwards Compatibility
134
137
=======================
135
138
136
- Due to server-side redirects to new canonical URLs, there are no backwards
137
- compatibility concerns. Links in previously published materials referring to
138
- any old URL scheme will be guaranteed to work.
139
+ Due to server-side redirects to the new canonical URLs, links in previously
140
+ published materials referring to the old URL schemes will be guaranteed to work.
141
+ All PEPs will continue to render correctly, and a custom stylesheet in the
142
+ reference implementation improves presentation for some elements (most notably
143
+ code blocks and block quotes). Therefore, this PEP presents no backwards
144
+ compatibility issues.
139
145
140
146
141
147
Security Implications
142
148
=====================
143
149
144
- No security implications, and the main `python.org `_ website will no longer
145
- take raw HTML uploads, closing a potential threat vector.
150
+ The main `python.org `_ website will no longer process raw HTML uploads,
151
+ closing a potential threat vector. PEP rendering and deployment processes will
152
+ use modern, well-maintained code and secure automated platforms, further
153
+ reducing the potential attack surface. Therefore, we see no negative security
154
+ impact.
146
155
147
156
148
157
How to Teach This
149
158
=================
150
159
151
160
The new canonical URLs will be publicised in the documentation. However, this
152
161
is mainly a backend infrastructure change, and there should be minimal
153
- end-user impact.
162
+ end-user impact. PEP 1 and PEP 12 will be updated as needed.
154
163
155
164
156
165
Reference Implementation
157
166
========================
158
167
159
168
The proposed implementation has been merged into the `python/peps `_ repository
160
- in a series of pull requests [8 ]_. This automatically renders all PEPs on every
161
- commit.
169
+ in a series of pull requests [8 ]_. It uses the `Sphinx `_ documentation system
170
+ with a custom theme and extensions.
171
+
172
+ This already automatically renders all PEPs on every commit, and publishes them
173
+ to `python.github.io/peps `_.
162
174
163
175
164
176
Rejected Ideas
165
177
==============
166
178
167
179
It would likely be possible to amend the current (as of November 2021)
168
- rendering process to include a lot of the quality-of-life improvements and
180
+ rendering process to include a subset of the quality-of-life improvements and
169
181
issue mitigations mentioned above. However, we do not believe that this would
170
182
solve the distributed tooling issue.
171
183
172
184
It would be possible to use the output from the proposed rendering system and
173
- import it into `python.org `_. We would argue however that this would be the
174
- worst of both worlds, as a great deal of complexity is added, and none is
175
- removed.
176
-
177
-
178
- Open Issues
179
- ===========
180
-
181
- None.
185
+ import it into `python.org `_. We would argue that this would be the worst of
186
+ both worlds, as a great deal of complexity is added whilst none is removed.
182
187
183
188
184
189
Acknowledgements
185
190
================
186
191
187
- Thanks to Hugo van Kemenade, Pablo Galindo Salgado, and Éric Araujo for support
188
- since April 2020.
192
+ - Hugo van Kemenade
193
+ - Pablo Galindo Salgado
194
+ - Éric Araujo
195
+ - Mariatta
196
+ - C.A.M. Gerlach
189
197
190
198
191
199
Footnotes
@@ -194,12 +202,15 @@ Footnotes
194
202
.. _documentation : https://pythondotorg.readthedocs.io/pep_generation.html
195
203
.. _docutils : https://docutils.sourceforge.io
196
204
.. _Makefile : https://www.gnu.org/software/make/manual/make.html#Introduction
205
+ .. _Netlify : https://www.netlify.com/
197
206
.. _peps.python.org : https://peps.python.org/
198
- .. _peps.python.org/pep-0008/ : https://peps.python.org/pep-0008/
207
+ .. _peps.python.org/pep-0008 : https://peps.python.org/pep-0008/
208
+ .. _python.github.io/peps : https://python.github.io/peps
199
209
.. _python.org : https://www.python.org
200
210
.. _python/peps : https://github.com/python/peps
201
211
.. _Read the Docs : https://readthedocs.org
202
212
.. _reStructuredText : https://docutils.sourceforge.io/rst.html
213
+ .. _Sphinx : https://www.sphinx-doc.org/en/master/
203
214
.. _URL fragments : https://url.spec.whatwg.org/#concept-url-fragment
204
215
205
216
.. [1 ] For example,
0 commit comments