Skip to content

Commit 2a5f278

Browse files
committed
DOC: address all comments, add sections for limited C API and header-only support
[skip actions] [skip azp] [skip cirrus]
1 parent 0206af4 commit 2a5f278

File tree

1 file changed

+36
-10
lines changed

1 file changed

+36
-10
lines changed

doc/neps/roadmap.rst

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ towards support for newer SIMD instruction sets, like SVE on arm64, is ongoing.
4949

5050
Other performance improvement ideas include:
5151

52-
- A better story around parallel execution.
52+
- A better story around parallel execution (related is support for free-threaded
53+
CPython, see further down).
5354
- Optimizations in individual functions.
5455

5556
Furthermore we would like to improve the benchmarking system, in terms of coverage,
@@ -84,8 +85,8 @@ Extensibility
8485
We aim to continue making it easier to extend NumPy. The primary topic here is to
8586
improve the dtype system - see for example :ref:`NEP41` and related NEPs linked
8687
from it. In NumPy 2.0, a `new C API for user-defined dtypes <https://numpy.org/devdocs/reference/c-api/array.html#custom-data-types>`__
87-
was made public. We aim
88-
to encourage its usage and improve this API further.
88+
was made public. We aim to encourage its usage and improve this API further,
89+
including support for writing a dtype in Python.
8990

9091
Ideas for new dtypes that may be developed outside of the main NumPy repository
9192
first, and that could potentially be upstreamed into NumPy later, include:
@@ -121,6 +122,8 @@ We intend to write a NEP covering the support levels we provide and what is
121122
required for a platform to move to a higher tier of support, similar to
122123
`PEP 11 <https://peps.python.org/pep-0011/>`__.
123124

125+
Support for free-threaded CPython
126+
`````````````````````````````````
124127
CPython 3.13 will be the first release to offer a free-threaded build (i.e.,
125128
a CPython build with the GIL disabled). Work is in progress to support this
126129
well in NumPy. After that is stable and complete, there may be opportunities to
@@ -131,14 +134,37 @@ Binary size reduction
131134
`````````````````````
132135
The number of downloads of NumPy from PyPI and other platforms continues to
133136
increase - as of May 2024 we're at >200 million downloads/month from PyPI
134-
alone). Reducing the size of an installed NumPy package has many benefits:
137+
alone. Reducing the size of an installed NumPy package has many benefits:
135138
faster installs, lower disk space usage, smaller load on PyPI, less
136-
environmental impact, easier to fit more packages on top of NumPy into an AWS
137-
Lambda layer, lower latency for Pyodide users, and so on. We aim for
138-
significant reductions, as well as making it easier for end users and packagers
139-
to produce smaller custom builds (e.g., we added support for stripping tests
140-
before 2.1.0). See `gh-25737 <https://github.com/numpy/numpy/issues/25737>`__
141-
for details.
139+
environmental impact, easier to fit more packages on top of NumPy in
140+
resource-constrained environments and platforms like AWS Lambda, lower latency
141+
for Pyodide users, and so on. We aim for significant reductions, as well as
142+
making it easier for end users and packagers to produce smaller custom builds
143+
(e.g., we added support for stripping tests before 2.1.0). See
144+
`gh-25737 <https://github.com/numpy/numpy/issues/25737>`__ for details.
145+
146+
Support use of CPython's limited C API
147+
``````````````````````````````````````
148+
Use of the CPython limited C API, allowing producing ``abi3`` wheels that use
149+
the stable ABI and are hence independent of CPython feature releases, has
150+
benefits for both downstream packages that use NumPy's C API and for NumPy
151+
itself. In NumPy 2.0, work was done to enable using the limited C API with
152+
the Cython support in NumPy (see `gh-25531 <https://github.com/numpy/numpy/pull/25531`__).
153+
More work and testing is needed to ensure full support for downstream packages.
154+
155+
We also want to explore what is needed for NumPy itself to use the limited
156+
C API - this would make testing new CPython dev and pre-release versions across
157+
the ecosystem easier, and significantly reduce the maintenance effort for CI
158+
jobs in NumPy itself.
159+
160+
Create a header-only package for NumPy
161+
``````````````````````````````````````
162+
We have reduced the platform-dependent content in the public NumPy headers to
163+
almost nothing. It is now feasible to create a separate package with only
164+
NumPy headers and a discovery mechanism for them, in order to enable downstream
165+
packages to build against the NumPy C API without having NumPy installed.
166+
This will make it easier/cheaper to use NumPy's C API, especially on more
167+
niche platforms for which we don't provide wheels.
142168

143169

144170
NumPy 2.0 stabilization & downstream usage

0 commit comments

Comments
 (0)