Skip to content

Commit f8392ce

Browse files
authored
Merge pull request numpy#26320 from arunppsg/nep-links
DOC: Add replacement NEP links in superseded, replaced-by fields
2 parents ef5f10d + 46d7293 commit f8392ce

7 files changed

+10
-14
lines changed

doc/neps/nep-0000.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ thread in the mailing list archives.
146146

147147
NEPs can also be ``Superseded`` by a different NEP, rendering the
148148
original obsolete. The ``Replaced-By`` and ``Replaces`` headers
149-
should be added to the original and new NEPs respectively.
149+
containing references to the original and new NEPs, like
150+
``:ref:`NEP#number``` should be added respectively.
150151

151152
Process NEPs may also have a status of ``Active`` if they are never
152153
meant to be completed, e.g. NEP 0 (this NEP).

doc/neps/nep-0030-duck-array-protocol.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ NEP 30 — Duck typing for NumPy arrays - implementation
77
:Author: Peter Andreas Entschev <[email protected]>
88
:Author: Stephan Hoyer <[email protected]>
99
:Status: Superseded
10-
:Replaced-By: 56
10+
:Replaced-By: :ref:`NEP56`
1111
:Type: Standards Track
1212
:Created: 2019-07-31
1313
:Updated: 2019-07-31

doc/neps/nep-0031-uarray.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ NEP 31 — Context-local and global overrides of the NumPy API
88
:Author: Ralf Gommers <[email protected]>
99
:Author: Peter Bell <[email protected]>
1010
:Status: Superseded
11-
:Replaced-By: 56
11+
:Replaced-By: :ref:`NEP56`
1212
:Type: Standards Track
1313
:Created: 2019-08-22
1414
:Resolution: https://mail.python.org/archives/list/[email protected]/message/Z6AA5CL47NHBNEPTFWYOTSUVSRDGHYPN/

doc/neps/nep-0037-array-module.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ NEP 37 — A dispatch protocol for NumPy-like modules
88
:Author: Hameer Abbasi
99
:Author: Sebastian Berg
1010
:Status: Superseded
11-
:Replaced-By: 56
11+
:Replaced-By: :ref:`NEP56`
1212
:Type: Standards Track
1313
:Created: 2019-12-29
1414
:Resolution: https://mail.python.org/archives/list/[email protected]/message/Z6AA5CL47NHBNEPTFWYOTSUVSRDGHYPN/

doc/neps/nep-0047-array-api-standard.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ NEP 47 — Adopting the array API standard
88
:Author: Stephan Hoyer <[email protected]>
99
:Author: Aaron Meurer <[email protected]>
1010
:Status: Superseded
11-
:Replaced-By: 56
11+
:Replaced-By: :ref:`NEP56`
1212
:Type: Standards Track
1313
:Created: 2021-01-21
1414
:Resolution: https://mail.python.org/archives/list/[email protected]/message/Z6AA5CL47NHBNEPTFWYOTSUVSRDGHYPN/

doc/neps/nep-0056-array-api-main-namespace.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ NEP 56 — Array API standard support in NumPy's main namespace
88
:Author: Mateusz Sokół <[email protected]>
99
:Author: Nathan Goldbaum <[email protected]>
1010
:Status: Final
11-
:Replaces: 30, 31, 37, 47
11+
:Replaces: :ref:`NEP30`, :ref:`NEP31`, :ref:`NEP37`, :ref:`NEP47`
1212
:Type: Standards Track
1313
:Created: 2023-12-19
1414
:Resolution: https://mail.python.org/archives/list/[email protected]/message/Z6AA5CL47NHBNEPTFWYOTSUVSRDGHYPN/

doc/neps/tools/build_index.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def nep_metadata():
7575
f'NEP {nr} has been Superseded, but has no Replaced-By tag'
7676
)
7777

78-
replaced_by = int(tags['Replaced-By'])
78+
replaced_by = int(re.findall(r'\d+', tags['Replaced-By'])[0])
7979
replacement_nep = neps[replaced_by]
8080

8181
if not 'Replaces' in replacement_nep:
@@ -105,13 +105,8 @@ def nep_metadata():
105105

106106
def parse_replaces_metadata(replacement_nep):
107107
"""Handle :Replaces: as integer or list of integers"""
108-
replaces = replacement_nep['Replaces']
109-
if ' ' in replaces:
110-
# Replaces multiple NEPs, should be comma-separated ints
111-
replaced_neps = [int(s) for s in replaces.split(', ')]
112-
else:
113-
replaced_neps = [int(replaces)]
114-
108+
replaces = re.findall(r'\d+', replacement_nep['Replaces'])
109+
replaced_neps = [int(s) for s in replaces]
115110
return replaced_neps
116111

117112

0 commit comments

Comments
 (0)