Skip to content

Commit 3e66308

Browse files
hugovkCAM-Gerlach
andauthored
Infra: Add directives to show warning banner for deprecated PEPs (#3682)
Co-authored-by: C.A.M. Gerlach <[email protected]>
1 parent 71e8fd3 commit 3e66308

21 files changed

+121
-198
lines changed

pep_sphinx_extensions/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ def setup(app: Sphinx) -> dict[str, bool]:
7575
"canonical-pypa-spec", pep_banner_directive.CanonicalPyPASpecBanner)
7676
app.add_directive(
7777
"canonical-typing-spec", pep_banner_directive.CanonicalTypingSpecBanner)
78+
app.add_directive("rejected", pep_banner_directive.RejectedBanner)
79+
app.add_directive("superseded", pep_banner_directive.SupersededBanner)
80+
app.add_directive("withdrawn", pep_banner_directive.WithdrawnBanner)
7881

7982
# Register event callbacks
8083
app.connect("builder-inited", _update_config_for_builder) # Update configuration values for builder used

pep_sphinx_extensions/pep_processor/parsing/pep_banner_directive.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,34 @@ class CanonicalTypingSpecBanner(PEPBanner):
125125
admonition_class = nodes.attention
126126

127127
css_classes = ["canonical-typing-spec", "sticky-banner"]
128+
129+
130+
class DeprecatedBanner(PEPBanner):
131+
"""Generic admonition for deprecated PEPs."""
132+
133+
admonition_class = nodes.warning
134+
admonition_pre_template = "{link_content}"
135+
admonition_pre_text = "This PEP has been deprecated."
136+
css_classes = ["sticky-banner", "deprecated"]
137+
138+
139+
class RejectedBanner(DeprecatedBanner):
140+
"""Insert an admonition for rejected PEPs."""
141+
142+
admonition_pre_text = "This PEP has been rejected."
143+
css_classes = ["sticky-banner", "deprecated", "rejected"]
144+
145+
146+
class SupersededBanner(PEPBanner):
147+
"""Insert an admonition for superseded PEPs."""
148+
149+
admonition_pre_template = "This PEP has been superseded by :pep:`{link_content}`."
150+
admonition_pre_text = "This PEP has been superseded."
151+
css_classes = ["sticky-banner", "deprecated", "superseded"]
152+
153+
154+
class WithdrawnBanner(PEPBanner):
155+
"""Insert an admonition for withdrawn PEPs."""
156+
157+
admonition_pre_text = "This PEP has been withdrawn."
158+
css_classes = ["sticky-banner", "deprecated", "withdrawn"]

peps/pep-0003.rst

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,16 @@ Title: Guidelines for Handling Bug Reports
33
Author: Jeremy Hylton <[email protected]>
44
Status: Withdrawn
55
Type: Process
6-
Content-Type: text/x-rst
76
Created: 25-Sep-2000
87
Post-History:
98

10-
11-
Introduction
12-
============
13-
14-
This PEP contained guidelines for handling bug reports in the Python
15-
bug tracker. It has been replaced by the Developer's Guide
16-
description of issue triaging at
17-
18-
::
19-
20-
https://docs.python.org/devguide/triaging.html
21-
22-
Guidelines for people submitting Python bugs are at
23-
24-
::
25-
26-
http://docs.python.org/bugs.html
9+
.. withdrawn::
10+
This PEP contained guidelines for handling bug reports in the Python
11+
bug tracker. It has been replaced by the
12+
`Developer's Guide description of issue triaging
13+
<https://devguide.python.org/triage/triaging/index.html>`_.
14+
Guidelines for people submitting Python bugs are `in the Python docs
15+
<http://docs.python.org/bugs.html>`__.
2716

2817
Original Guidelines
2918
===================

peps/pep-0009.rst

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
PEP: 9
22
Title: Sample Plaintext PEP Template
3-
Version: $Revision$
4-
Last-Modified: $Date$
53
Author: Barry Warsaw <[email protected]>
64
Status: Withdrawn
75
Type: Process
8-
Content-Type: text/x-rst
96
Created: 14-Aug-2001
107
Post-History:
118
Resolution: https://mail.python.org/archives/list/[email protected]/thread/2YMHVPRDWGQLA5A2FKXE2JMLM2HQEEGW/
129

10+
.. withdrawn::
11+
As of 05-Jan-2016, this PEP is officially deprecated and replaced
12+
by :pep:`12`. All PEPs should now use the reStructuredText format
13+
described by :pep:`12`, and plaintext PEPs will no longer be
14+
accepted.
1315

1416
::
1517

16-
Update
17-
18-
As of 05-Jan-2016, this PEP is officially deprecated and replaced
19-
by PEP 12. All PEPs should now use the reStructuredText format
20-
described by PEP 12, and plaintext PEPs will no longer be
21-
accepted.
22-
2318
Abstract
2419

2520
This PEP provides a boilerplate or sample template for creating
@@ -225,14 +220,3 @@ Resolution: https://mail.python.org/archives/list/[email protected]/thread/2
225220
Copyright
226221

227222
This document has been placed in the public domain.
228-
229-
230-
231-
..
232-
Local Variables:
233-
mode: indented-text
234-
indent-tabs-mode: nil
235-
sentence-end-double-space: t
236-
fill-column: 70
237-
coding: utf-8
238-
End:

peps/pep-0042.rst

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
PEP: 42
22
Title: Feature Requests
3-
Version: $Revision$
4-
Last-Modified: $Date$
53
Author: Jeremy Hylton <[email protected]>
64
Status: Withdrawn
75
Type: Process
8-
Content-Type: text/x-rst
96
Created: 12-Sep-2000
107
Post-History:
118

12-
13-
.. note:: This PEP has been `withdrawn as obsolete`_.
9+
.. withdrawn::
10+
This PEP has been `withdrawn as obsolete`_.
1411
All new feature requests should either go to the `Python bug tracker`_
15-
for very simple requests or the `python-ideas`_ mailing list for
12+
for very simple requests or the `Ideas Discourse category`_ for
1613
everything else. The rest of this document is retained for historical
1714
purposes only.
1815

@@ -332,13 +329,6 @@ Building and Installing
332329

333330
http://bugs.python.org/issue588756
334331

335-
.. _`Python bug tracker`: https://bugs.python.org
336-
.. _`python-ideas`: https://mail.python.org/mailman/listinfo/python-ideas
332+
.. _`Python bug tracker`: https://github.com/python/cpython/issues
333+
.. _`Ideas Discourse category`: https://discuss.python.org/c/ideas/6
337334
.. _`withdrawn as obsolete`: https://github.com/python/peps/pull/108#issuecomment-249603204
338-
339-
340-
..
341-
Local Variables:
342-
mode: indented-text
343-
indent-tabs-mode: nil
344-
End:

peps/pep-0103.rst

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
PEP: 103
22
Title: Collecting information about git
3-
Version: $Revision$
4-
Last-Modified: $Date$
53
Author: Oleg Broytman <[email protected]>
64
Status: Withdrawn
75
Type: Informational
8-
Content-Type: text/x-rst
96
Created: 01-Jun-2015
107
Post-History: 12-Sep-2015
118

12-
Withdrawal
13-
==========
9+
.. withdrawn::
10+
This PEP was withdrawn as it's too generic and doesn't really deals
11+
with Python development. It is no longer updated.
1412

15-
This PEP was withdrawn as it's too generic and doesn't really deals
16-
with Python development. It is no longer updated.
13+
The content was moved to `Python Wiki`_. Make further updates in the
14+
wiki.
1715

18-
The content was moved to `Python Wiki`_. Make further updates in the
19-
wiki.
20-
21-
.. _`Python Wiki`: https://wiki.python.org/moin/Git
16+
.. _`Python Wiki`: https://wiki.python.org/moin/Git
2217

2318
Abstract
2419
========
@@ -1076,15 +1071,3 @@ Copyright
10761071
=========
10771072

10781073
This document has been placed in the public domain.
1079-
1080-
1081-
1082-
..
1083-
Local Variables:
1084-
mode: indented-text
1085-
indent-tabs-mode: nil
1086-
sentence-end-double-space: t
1087-
fill-column: 70
1088-
coding: utf-8
1089-
End:
1090-
vim: set fenc=us-ascii tw=70 :

peps/pep-0204.rst

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,21 @@ Title: Range Literals
33
Author: Thomas Wouters <[email protected]>
44
Status: Rejected
55
Type: Standards Track
6-
Content-Type: text/x-rst
76
Created: 14-Jul-2000
87
Python-Version: 2.0
98
Post-History:
109

10+
.. rejected::
11+
After careful consideration, and a period of meditation, this
12+
proposal has been rejected. The open issues, as well as some
13+
confusion between ranges and slice syntax, raised enough questions
14+
for Guido not to accept it for Python 2.0, and later to reject the
15+
proposal altogether. The new syntax and its intentions were deemed
16+
not obvious enough.
17+
18+
[ TBD: Guido, amend/confirm this, please. Preferably both; this
19+
is a PEP, it should contain *all* the reasons for rejection
20+
and/or reconsideration, for future reference. ]
1121

1222
Introduction
1323
============
@@ -270,21 +280,6 @@ Open issues
270280
made private functions?
271281

272282

273-
Rejection
274-
=========
275-
276-
After careful consideration, and a period of meditation, this
277-
proposal has been rejected. The open issues, as well as some
278-
confusion between ranges and slice syntax, raised enough questions
279-
for Guido not to accept it for Python 2.0, and later to reject the
280-
proposal altogether. The new syntax and its intentions were deemed
281-
not obvious enough.
282-
283-
[ TBD: Guido, amend/confirm this, please. Preferably both; this
284-
is a PEP, it should contain *all* the reasons for rejection
285-
and/or reconsideration, for future reference. ]
286-
287-
288283
Copyright
289284
=========
290285

peps/pep-0206.rst

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
PEP: 206
22
Title: Python Advanced Library
3-
Version: $Revision$
4-
Last-Modified: $Date$
53
Author: A.M. Kuchling <[email protected]>
64
Status: Withdrawn
75
Type: Informational
8-
Content-Type: text/x-rst
96
Created: 14-Jul-2000
107
Post-History:
118

9+
.. withdrawn::
1210

1311
Introduction
1412
============
@@ -119,10 +117,3 @@ Acknowledgements
119117

120118
The PEP is based on an earlier draft PEP by Moshe Zadka, titled
121119
"2.0 Batteries Included."
122-
123-
124-
..
125-
Local Variables:
126-
mode: indented-text
127-
indent-tabs-mode: nil
128-
End:

peps/pep-0209.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ Title: Multi-dimensional Arrays
33
Author: Paul Barrett <[email protected]>, Travis Oliphant <[email protected]>
44
Status: Withdrawn
55
Type: Standards Track
6-
Content-Type: text/x-rst
76
Created: 03-Jan-2001
87
Python-Version: 2.2
98
Post-History:
109

10+
.. withdrawn::
1111

1212
Abstract
1313
========

peps/pep-0210.rst

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,8 @@ Title: Decoupling the Interpreter Loop
33
Author: David Ascher <[email protected]>
44
Status: Rejected
55
Type: Standards Track
6-
Content-Type: text/x-rst
76
Created: 15-Jul-2000
87
Python-Version: 2.1
98
Post-History:
109

11-
12-
13-
..
14-
Local Variables:
15-
mode: indented-text
16-
indent-tabs-mode: nil
17-
End:
10+
.. rejected::

peps/pep-0211.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ Title: Adding A New Outer Product Operator
33
Author: Greg Wilson <[email protected]>
44
Status: Rejected
55
Type: Standards Track
6-
Content-Type: text/x-rst
76
Created: 15-Jul-2000
87
Python-Version: 2.1
98
Post-History:
109

1110

12-
.. note::
13-
11+
.. rejected::
1412
The approach in the later :pep:`465` was eventually accepted
1513
in lieu of this PEP. The :pep:`Rejected Ideas
1614
<465#rejected-alternatives-to-adding-a-new-operator>`

peps/pep-0215.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ Title: String Interpolation
33
Author: Ka-Ping Yee <[email protected]>
44
Status: Superseded
55
Type: Standards Track
6-
Content-Type: text/x-rst
76
Created: 24-Jul-2000
87
Python-Version: 2.1
98
Post-History:
109
Superseded-By: 292
1110

11+
.. superseded:: 292
1212

1313
Abstract
1414
========

peps/pep-0216.rst

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
PEP: 216
22
Title: Docstring Format
33
Author: Moshe Zadka <[email protected]>
4-
Status: Rejected
4+
Status: Withdrawn
55
Type: Informational
6-
Content-Type: text/x-rst
76
Created: 31-Jul-2000
87
Post-History:
98
Superseded-By: 287
109

1110

12-
Notice
13-
======
14-
15-
This PEP is rejected by the author. It has been superseded by PEP
16-
287.
11+
.. withdrawn::
12+
This PEP is withdrawn by the author. It has been superseded by :pep:`287`.
1713

1814

1915
Abstract

peps/pep-0220.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ Title: Coroutines, Generators, Continuations
33
Author: Gordon McMillan <[email protected]>
44
Status: Rejected
55
Type: Informational
6-
Content-Type: text/x-rst
76
Created: 14-Aug-2000
87
Post-History:
98

9+
.. rejected::
1010

1111
Abstract
1212
========

0 commit comments

Comments
 (0)