diff options
Diffstat (limited to 'doc/neps')
-rw-r--r-- | doc/neps/.gitignore | 1 | ||||
-rw-r--r-- | doc/neps/Makefile | 9 | ||||
-rw-r--r-- | doc/neps/index.rst.tmpl (renamed from doc/neps/index.rst) | 31 | ||||
-rw-r--r-- | doc/neps/nep-0000.rst | 15 | ||||
-rw-r--r-- | doc/neps/nep-0001-npy-format.rst | 7 | ||||
-rw-r--r-- | doc/neps/nep-0002-warnfix.rst | 39 | ||||
-rw-r--r-- | doc/neps/nep-0003-math_config_clean.rst | 1 | ||||
-rw-r--r-- | doc/neps/nep-0004-datetime-proposal3.rst | 2 | ||||
-rw-r--r-- | doc/neps/nep-0005-generalized-ufuncs.rst | 2 | ||||
-rw-r--r-- | doc/neps/nep-0006-newbugtracker.rst | 1 | ||||
-rw-r--r-- | doc/neps/nep-0007-datetime-proposal.rst | 2 | ||||
-rw-r--r-- | doc/neps/nep-0008-groupby_additions.rst | 18 | ||||
-rw-r--r-- | doc/neps/nep-0009-structured_array_extensions.rst | 2 | ||||
-rw-r--r-- | doc/neps/nep-0010-new-iterator-ufunc.rst | 1 | ||||
-rw-r--r-- | doc/neps/nep-0011-deferred-ufunc-evaluation.rst | 1 | ||||
-rw-r--r-- | doc/neps/nep-0012-missing-data.rst | 1 | ||||
-rw-r--r-- | doc/neps/nep-0013-ufunc-overrides.rst | 8 | ||||
-rw-r--r-- | doc/neps/nep-0014-dropping-python2.7-proposal.rst | 3 | ||||
-rw-r--r-- | doc/neps/nep-template.rst | 2 | ||||
-rw-r--r-- | doc/neps/tools/build_index.py | 99 |
20 files changed, 176 insertions, 69 deletions
diff --git a/doc/neps/.gitignore b/doc/neps/.gitignore new file mode 100644 index 000000000..04163f707 --- /dev/null +++ b/doc/neps/.gitignore @@ -0,0 +1 @@ +index.rst diff --git a/doc/neps/Makefile b/doc/neps/Makefile index 2d1a063de..3c023ae9b 100644 --- a/doc/neps/Makefile +++ b/doc/neps/Makefile @@ -2,7 +2,7 @@ # # You can set these variables from the command line. -SPHINXOPTS = +SPHINXOPTS = -W SPHINXBUILD = sphinx-build SPHINXPROJ = NumPyEnhancementProposals SOURCEDIR = . @@ -12,9 +12,12 @@ BUILDDIR = _build help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -.PHONY: help Makefile +.PHONY: help Makefile index + +index: + python tools/build_index.py # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile +%: Makefile index @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/doc/neps/index.rst b/doc/neps/index.rst.tmpl index 8a2df4078..8d0c5da77 100644 --- a/doc/neps/index.rst +++ b/doc/neps/index.rst.tmpl @@ -14,9 +14,11 @@ Meta-NEPs (NEPs about NEPs or Processes) .. toctree:: :maxdepth: 1 - nep-0000 - nep-template +{% for nep, tags in neps.items() if tags['Type'] == 'Process' %} + NEP {{ nep }} — {{ tags['Title'] }} <{{ tags['Filename'] }}> +{% endfor %} + nep-template Accepted NEPs, implementation in progress ----------------------------------------- @@ -24,8 +26,9 @@ Accepted NEPs, implementation in progress .. toctree:: :maxdepth: 1 - nep-0014-dropping-python2.7-proposal - +{% for nep, tags in neps.items() if tags['Status'] == 'Accepted' %} + NEP {{ nep }} — {{ tags['Title'] }} <{{ tags['Filename'] }}> +{% endfor %} Implemented NEPs ---------------- @@ -33,12 +36,9 @@ Implemented NEPs .. toctree:: :maxdepth: 1 - nep-0001-npy-format - nep-0005-generalized-ufuncs - nep-0007-datetime-proposal - nep-0010-new-iterator-ufunc - nep-0013-ufunc-overrides - +{% for nep, tags in neps.items() if tags['Status'] == 'Final' %} + NEP {{ nep }} — {{ tags['Title'] }} <{{ tags['Filename'] }}> +{% endfor %} Defunct NEPs ------------ @@ -46,11 +46,6 @@ Defunct NEPs .. toctree:: :maxdepth: 1 - nep-0002-warnfix - nep-0003-math_config_clean - nep-0004-datetime-proposal3 - nep-0006-newbugtracker - nep-0008-groupby_additions - nep-0009-structured_array_extensions - nep-0011-deferred-ufunc-evaluation - nep-0012-missing-data +{% for nep, tags in neps.items() if tags['Status'] == 'Deferred' %} + NEP {{ nep }} — {{ tags['Title'] }} <{{ tags['Filename'] }}> +{% endfor %} diff --git a/doc/neps/nep-0000.rst b/doc/neps/nep-0000.rst index ae8603c62..a7d6d7115 100644 --- a/doc/neps/nep-0000.rst +++ b/doc/neps/nep-0000.rst @@ -1,6 +1,6 @@ -======================= -NEP Purpose and Process -======================= +=================== +Purpose and Process +=================== :Author: Jarrod Millman <millman@berkeley.edu> :Status: Draft @@ -121,9 +121,12 @@ updated accordingly. In addition to updating the status field, at the very least the ``Resolution`` header should be added with a link to the relevant post in the mailing list archives. -NEPs can also be ``Replaced`` by a different NEP, rendering the original -obsolete. Process NEPs may also have a status of -``Active`` if they are never meant to be completed. E.g. NEP 0 (this NEP). +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. + +Process NEPs may also have a status of ``Active`` if they are never +meant to be completed, e.g. NEP 0 (this NEP). Maintenance diff --git a/doc/neps/nep-0001-npy-format.rst b/doc/neps/nep-0001-npy-format.rst index 3f12e1bf1..2057aed83 100644 --- a/doc/neps/nep-0001-npy-format.rst +++ b/doc/neps/nep-0001-npy-format.rst @@ -2,10 +2,9 @@ A Simple File Format for NumPy Arrays ===================================== -Author: Robert Kern <robert.kern@gmail.com> -Status: Draft -Created: 20-Dec-2007 - +:Author: Robert Kern <robert.kern@gmail.com> +:Status: Final +:Created: 20-Dec-2007 Abstract -------- diff --git a/doc/neps/nep-0002-warnfix.rst b/doc/neps/nep-0002-warnfix.rst index 4b0a2a56e..60dc885b2 100644 --- a/doc/neps/nep-0002-warnfix.rst +++ b/doc/neps/nep-0002-warnfix.rst @@ -5,6 +5,7 @@ A proposal to build numpy without warning with a big set of warning flags :Author: David Cournapeau :Contact: david@ar.media.kyoto-u.ac.jp :Date: 2008-09-04 +:Status: Deferred Executive summary ================= @@ -20,13 +21,13 @@ Warning flags ============= Each compiler detects a different set of potential errors. The baseline will -be gcc -Wall -W -Wextra. Ideally, a complete set would be nice: +be gcc -Wall -W -Wextra. Ideally, a complete set would be nice:: --W -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return --Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast --Wwrite-strings " + -W -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return + -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast + -Wwrite-strings " -Intel compiler, VS with /W3 /Wall, Sun compilers have extra warnings too. +Intel compiler, VS with ``/W3 /Wall``, Sun compilers have extra warnings too. Kind of warnings ================ @@ -46,27 +47,29 @@ solve it is to tag the function argument with a macro NPY_UNUSED. This macro uses compiler specific code to tag the variable, and mangle it such as it is not possible to use it accidentally once it is tagged. -The code to apply compiler specific option could be: +The code to apply compiler specific option could be:: -#if defined(__GNUC__) - #define __COMP_NPY_UNUSED __attribute__ ((__unused__)) -# elif defined(__ICC) - #define __COMP_NPY_UNUSED __attribute__ ((__unused__)) -#else - #define __COMP_NPY_UNUSED -#endif + #if defined(__GNUC__) + #define __COMP_NPY_UNUSED __attribute__ ((__unused__)) + # elif defined(__ICC) + #define __COMP_NPY_UNUSED __attribute__ ((__unused__)) + #else + #define __COMP_NPY_UNUSED + #endif -The variable mangling would be: +The variable mangling would be:: -#define NPY_UNUSED(x) (__NPY_UNUSED_TAGGED ## x) __COMP_NPY_UNUSED + #define NPY_UNUSED(x) (__NPY_UNUSED_TAGGED ## x) __COMP_NPY_UNUSED -When applied to a variable, one would get: +When applied to a variable, one would get:: -int foo(int * NPY_UNUSED(dummy)) + int foo(int * NPY_UNUSED(dummy)) expanded to -int foo(int * __NPY_UNUSED_TAGGEDdummy __COMP_NPY_UNUSED) +:: + + int foo(int * __NPY_UNUSED_TAGGEDdummy __COMP_NPY_UNUSED) Thus avoiding any accidental use of the variable. The mangling is pure C, and thuse portable. The per-variable warning disabling is compiler specific. diff --git a/doc/neps/nep-0003-math_config_clean.rst b/doc/neps/nep-0003-math_config_clean.rst index 27c0adfa1..5af907437 100644 --- a/doc/neps/nep-0003-math_config_clean.rst +++ b/doc/neps/nep-0003-math_config_clean.rst @@ -5,6 +5,7 @@ Cleaning the math configuration of numpy.core :Author: David Cournapeau :Contact: david@ar.media.kyoto-u.ac.jp :Date: 2008-09-04 +:Status: Deferred Executive summary ================= diff --git a/doc/neps/nep-0004-datetime-proposal3.rst b/doc/neps/nep-0004-datetime-proposal3.rst index fcfb39e54..46d8e314b 100644 --- a/doc/neps/nep-0004-datetime-proposal3.rst +++ b/doc/neps/nep-0004-datetime-proposal3.rst @@ -7,7 +7,7 @@ :Author: Ivan Vilata i Balaguer :Contact: ivan@selidor.net :Date: 2008-07-30 - +:Status: Deferred Executive summary ================= diff --git a/doc/neps/nep-0005-generalized-ufuncs.rst b/doc/neps/nep-0005-generalized-ufuncs.rst index 98e436990..54b2b370e 100644 --- a/doc/neps/nep-0005-generalized-ufuncs.rst +++ b/doc/neps/nep-0005-generalized-ufuncs.rst @@ -2,6 +2,8 @@ Generalized Universal Functions =============================== +:Status: Final + There is a general need for looping over not only functions on scalars but also over functions on vectors (or arrays), as explained on http://scipy.org/scipy/numpy/wiki/GeneralLoopingFunctions. We propose diff --git a/doc/neps/nep-0006-newbugtracker.rst b/doc/neps/nep-0006-newbugtracker.rst index 5af633552..2b9344ed0 100644 --- a/doc/neps/nep-0006-newbugtracker.rst +++ b/doc/neps/nep-0006-newbugtracker.rst @@ -3,6 +3,7 @@ Replacing Trac with a different bug tracker =========================================== :Author: David Cournapeau, Stefan van der Walt +:Status: Deferred Some release managers of both numpy and scipy are becoming more and more dissatisfied with the current development workflow, in particular for bug diff --git a/doc/neps/nep-0007-datetime-proposal.rst b/doc/neps/nep-0007-datetime-proposal.rst index 76c361f4f..72d48d244 100644 --- a/doc/neps/nep-0007-datetime-proposal.rst +++ b/doc/neps/nep-0007-datetime-proposal.rst @@ -5,6 +5,7 @@ :Author: Travis Oliphant :Contact: oliphant@enthought.com :Date: 2009-06-09 +:Status: Final Revised only slightly from the third proposal by @@ -14,7 +15,6 @@ Revised only slightly from the third proposal by :Contact: ivan@selidor.net :Date: 2008-07-30 - Executive summary ================= diff --git a/doc/neps/nep-0008-groupby_additions.rst b/doc/neps/nep-0008-groupby_additions.rst index a86bdd642..fa02f2f9c 100644 --- a/doc/neps/nep-0008-groupby_additions.rst +++ b/doc/neps/nep-0008-groupby_additions.rst @@ -5,6 +5,7 @@ :Author: Travis Oliphant :Contact: oliphant@enthought.com :Date: 2010-04-27 +:Status: Deferred Executive summary @@ -22,9 +23,9 @@ Example Use Case ================ Suppose you have a NumPy structured array containing information about the number of purchases at several stores over multiple days. To be clear, the -structured array data-type is: +structured array data-type is:: -dt = [('year', i2), ('month', i1), ('day', i1), ('time', float), + dt = [('year', i2), ('month', i1), ('day', i1), ('time', float), ('store', i4), ('SKU', 'S6'), ('number', i4)] Suppose there is a 1-d NumPy array of this data-type and you would like @@ -98,14 +99,5 @@ reduceby:: Functions proposed ================== -segment:: - - -edges:: - - -.. Local Variables: -.. mode: rst -.. coding: utf-8 -.. fill-column: 72 -.. End: +- segment +- edges diff --git a/doc/neps/nep-0009-structured_array_extensions.rst b/doc/neps/nep-0009-structured_array_extensions.rst index a4248362c..695d0d516 100644 --- a/doc/neps/nep-0009-structured_array_extensions.rst +++ b/doc/neps/nep-0009-structured_array_extensions.rst @@ -2,6 +2,8 @@ Structured array extensions =========================== +:Status: Deferred + 1. Create with-style context that makes "named-columns" available as names in the namespace. with np.columns(array): diff --git a/doc/neps/nep-0010-new-iterator-ufunc.rst b/doc/neps/nep-0010-new-iterator-ufunc.rst index 7a9e7627c..7b388a974 100644 --- a/doc/neps/nep-0010-new-iterator-ufunc.rst +++ b/doc/neps/nep-0010-new-iterator-ufunc.rst @@ -5,6 +5,7 @@ Optimizing Iterator/UFunc Performance :Author: Mark Wiebe <mwwiebe@gmail.com> :Content-Type: text/x-rst :Created: 25-Nov-2010 +:Status: Final ***************** Table of Contents diff --git a/doc/neps/nep-0011-deferred-ufunc-evaluation.rst b/doc/neps/nep-0011-deferred-ufunc-evaluation.rst index b00c0dd2d..5f5de3518 100644 --- a/doc/neps/nep-0011-deferred-ufunc-evaluation.rst +++ b/doc/neps/nep-0011-deferred-ufunc-evaluation.rst @@ -5,6 +5,7 @@ Deferred UFunc Evaluation :Author: Mark Wiebe <mwwiebe@gmail.com> :Content-Type: text/x-rst :Created: 30-Nov-2010 +:Status: Deferred ******** Abstract diff --git a/doc/neps/nep-0012-missing-data.rst b/doc/neps/nep-0012-missing-data.rst index 00a6034f4..1553339f4 100644 --- a/doc/neps/nep-0012-missing-data.rst +++ b/doc/neps/nep-0012-missing-data.rst @@ -6,6 +6,7 @@ Missing Data Functionality in NumPy :Copyright: Copyright 2011 by Enthought, Inc :License: CC By-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/) :Date: 2011-06-23 +:Status: Deferred ***************** Table of Contents diff --git a/doc/neps/nep-0013-ufunc-overrides.rst b/doc/neps/nep-0013-ufunc-overrides.rst index 90869e1ac..c97b69023 100644 --- a/doc/neps/nep-0013-ufunc-overrides.rst +++ b/doc/neps/nep-0013-ufunc-overrides.rst @@ -1,5 +1,3 @@ -.. _neps.ufunc-overrides: - ================================= A Mechanism for Overriding Ufuncs ================================= @@ -19,6 +17,8 @@ A Mechanism for Overriding Ufuncs :Author: Stephan Hoyer :Date: 2017-03-31 +:Status: Final + Executive summary ================= @@ -154,8 +154,8 @@ Here: - *ufunc* is the ufunc object that was called. - *method* is a string indicating how the Ufunc was called, either ``"__call__"`` to indicate it was called directly, or one of its - :ref:`methods<ufuncs.methods>`: ``"reduce"``, ``"accumulate"``, - ``"reduceat"``, ``"outer"``, or ``"at"``. + methods: ``"reduce"``, ``"accumulate"``, ``"reduceat"``, ``"outer"``, + or ``"at"``. - *inputs* is a tuple of the input arguments to the ``ufunc`` - *kwargs* contains any optional or keyword arguments passed to the function. This includes any ``out`` arguments, which are always diff --git a/doc/neps/nep-0014-dropping-python2.7-proposal.rst b/doc/neps/nep-0014-dropping-python2.7-proposal.rst index 3cfe50bd0..6cfd4707f 100644 --- a/doc/neps/nep-0014-dropping-python2.7-proposal.rst +++ b/doc/neps/nep-0014-dropping-python2.7-proposal.rst @@ -2,6 +2,9 @@ Plan for dropping Python 2.7 support ==================================== +:Status: Accepted +:Resolution: https://mail.python.org/pipermail/numpy-discussion/2017-November/077419.html + The Python core team plans to stop supporting Python 2 in 2020. The NumPy project has supported both Python 2 and Python 3 in parallel since 2010, and has found that supporting Python 2 is an increasing burden on our limited diff --git a/doc/neps/nep-template.rst b/doc/neps/nep-template.rst index d51ad3688..56b06049e 100644 --- a/doc/neps/nep-template.rst +++ b/doc/neps/nep-template.rst @@ -4,7 +4,7 @@ NEP Template and Instructions :Author: <list of authors' real names and optionally, email addresses> :Status: <Draft | Active | Accepted | Deferred | Rejected | Withdrawn | Final | Superseded> -:Type: <Standards Track | Informational | Process> +:Type: <Standards Track | Process> :Created: <date created on, in yyyy-mm-dd format> diff --git a/doc/neps/tools/build_index.py b/doc/neps/tools/build_index.py new file mode 100644 index 000000000..65225c995 --- /dev/null +++ b/doc/neps/tools/build_index.py @@ -0,0 +1,99 @@ +""" +Scan the directory of nep files and extract their metadata. The +metadata is passed to Jinja for filling out `index.rst.tmpl`. +""" + +import os +import sys +import jinja2 +import glob +import re + + +def render(tpl_path, context): + path, filename = os.path.split(tpl_path) + return jinja2.Environment( + loader=jinja2.FileSystemLoader(path or './') + ).get_template(filename).render(context) + +def nep_metadata(): + ignore = ('nep-template.rst') + sources = sorted(glob.glob(r'nep-*.rst')) + sources = [s for s in sources if not s in ignore] + + meta_re = r':([a-zA-Z\-]*): (.*)' + + neps = {} + print('Loading metadata for:') + for source in sources: + print(f' - {source}') + nr = int(re.match(r'nep-([0-9]{4}).*\.rst', source).group(1)) + + with open(source) as f: + lines = f.readlines() + tags = [re.match(meta_re, line) for line in lines] + tags = [match.groups() for match in tags if match is not None] + tags = {tag[0]: tag[1] for tag in tags} + + # We could do a clever regexp, but for now just assume the title is + # the second line of the document + tags['Title'] = lines[1].strip() + tags['Filename'] = source + + + if tags['Status'] in ('Accepted', 'Rejected', 'Withdrawn'): + if not 'Resolution' in tags: + raise RuntimeError( + f'NEP {nr} is Accepted/Rejected/Withdrawn but ' + 'has no Resolution tag' + ) + + neps[nr] = tags + + # Now that we have all of the NEP metadata, do some global consistency + # checks + + for nr, tags in neps.items(): + if tags['Status'] == 'Superseded': + if not 'Replaced-By' in tags: + raise RuntimeError( + f'NEP {nr} has been Superseded, but has no Replaced-By tag' + ) + + replaced_by = int(tags['Replaced-By']) + replacement_nep = neps[replaced_by] + + if not 'Replaces' in replacement_nep: + raise RuntimeError( + f'NEP {nr} is superseded by {replaced_by}, but that NEP has ' + f"no Replaces tag." + ) + + if not int(replacement_nep['Replaces']) == nr: + raise RuntimeError( + f'NEP {nr} is superseded by {replaced_by}, but that NEP has a ' + f"Replaces tag of `{replacement_nep['Replaces']}`." + ) + + if 'Replaces' in tags: + replaced_nep = int(tags['Replaces']) + replaced_nep_tags = neps[replaced_nep] + if not replaced_nep_tags['Status'] == 'Superseded': + raise RuntimeError( + f'NEP {nr} replaces {replaced_nep}, but that NEP has not ' + f'been set to Superseded' + ) + + return {'neps': neps} + + +infile = 'index.rst.tmpl' +outfile = 'index.rst' + +meta = nep_metadata() + +print(f'Compiling {infile} -> {outfile}') +index = render(infile, meta) + +with open(outfile, 'w') as f: + f.write(index) |