Skip to content

Commit

Permalink
Merge pull request numpy#26320 from arunppsg/nep-links
Browse files Browse the repository at this point in the history
DOC: Add replacement NEP links in superseded, replaced-by fields
  • Loading branch information
mattip authored Apr 23, 2024
2 parents ef5f10d + 46d7293 commit f8392ce
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 14 deletions.
3 changes: 2 additions & 1 deletion doc/neps/nep-0000.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ thread in the mailing list archives.

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

Process NEPs may also have a status of ``Active`` if they are never
meant to be completed, e.g. NEP 0 (this NEP).
Expand Down
2 changes: 1 addition & 1 deletion doc/neps/nep-0030-duck-array-protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ NEP 30 — Duck typing for NumPy arrays - implementation
:Author: Peter Andreas Entschev <[email protected]>
:Author: Stephan Hoyer <[email protected]>
:Status: Superseded
:Replaced-By: 56
:Replaced-By: :ref:`NEP56`
:Type: Standards Track
:Created: 2019-07-31
:Updated: 2019-07-31
Expand Down
2 changes: 1 addition & 1 deletion doc/neps/nep-0031-uarray.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ NEP 31 — Context-local and global overrides of the NumPy API
:Author: Ralf Gommers <[email protected]>
:Author: Peter Bell <[email protected]>
:Status: Superseded
:Replaced-By: 56
:Replaced-By: :ref:`NEP56`
:Type: Standards Track
:Created: 2019-08-22
:Resolution: https://mail.python.org/archives/list/[email protected]/message/Z6AA5CL47NHBNEPTFWYOTSUVSRDGHYPN/
Expand Down
2 changes: 1 addition & 1 deletion doc/neps/nep-0037-array-module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ NEP 37 — A dispatch protocol for NumPy-like modules
:Author: Hameer Abbasi
:Author: Sebastian Berg
:Status: Superseded
:Replaced-By: 56
:Replaced-By: :ref:`NEP56`
:Type: Standards Track
:Created: 2019-12-29
:Resolution: https://mail.python.org/archives/list/[email protected]/message/Z6AA5CL47NHBNEPTFWYOTSUVSRDGHYPN/
Expand Down
2 changes: 1 addition & 1 deletion doc/neps/nep-0047-array-api-standard.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ NEP 47 — Adopting the array API standard
:Author: Stephan Hoyer <[email protected]>
:Author: Aaron Meurer <[email protected]>
:Status: Superseded
:Replaced-By: 56
:Replaced-By: :ref:`NEP56`
:Type: Standards Track
:Created: 2021-01-21
:Resolution: https://mail.python.org/archives/list/[email protected]/message/Z6AA5CL47NHBNEPTFWYOTSUVSRDGHYPN/
Expand Down
2 changes: 1 addition & 1 deletion doc/neps/nep-0056-array-api-main-namespace.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ NEP 56 — Array API standard support in NumPy's main namespace
:Author: Mateusz Sokół <[email protected]>
:Author: Nathan Goldbaum <[email protected]>
:Status: Final
:Replaces: 30, 31, 37, 47
:Replaces: :ref:`NEP30`, :ref:`NEP31`, :ref:`NEP37`, :ref:`NEP47`
:Type: Standards Track
:Created: 2023-12-19
:Resolution: https://mail.python.org/archives/list/[email protected]/message/Z6AA5CL47NHBNEPTFWYOTSUVSRDGHYPN/
Expand Down
11 changes: 3 additions & 8 deletions doc/neps/tools/build_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def nep_metadata():
f'NEP {nr} has been Superseded, but has no Replaced-By tag'
)

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

if not 'Replaces' in replacement_nep:
Expand Down Expand Up @@ -105,13 +105,8 @@ def nep_metadata():

def parse_replaces_metadata(replacement_nep):
"""Handle :Replaces: as integer or list of integers"""
replaces = replacement_nep['Replaces']
if ' ' in replaces:
# Replaces multiple NEPs, should be comma-separated ints
replaced_neps = [int(s) for s in replaces.split(', ')]
else:
replaced_neps = [int(replaces)]

replaces = re.findall(r'\d+', replacement_nep['Replaces'])
replaced_neps = [int(s) for s in replaces]
return replaced_neps


Expand Down

0 comments on commit f8392ce

Please sign in to comment.