There will be a NumPy Community meeting Wednesday December 8th at
19:00 UTC. Everyone is invited and encouraged to join in and edit the
work-in-progress meeting topics and notes at:
PS: 19:00 UTC is 11am Pacific time
Setuptools is going to re-enable a setting which makes it prefer its
vendored copy of distutils over the distutils code in the stdlib in two
weeks. If you only use setuptools and not numpy.distutils directly, then
you're probably fine. If you do use numpy.distutils, then your build may
break. It's recommended you test this now - see
https://twitter.com/jaraco/status/1467660250954317827 for how.
Note that it's not possible to avoid/fix this kind of breakage in a
sensible fashion before it happens. Setuptools is going to be making
significant backwards-incompatible changes to distutils, so if you are
using numpy.distutils then you should be prepared for regular breakage. If
you release your package regularly, then it's recommended you always pin
setuptools in your pyproject.toml to the last version that's known to work.
Setuptools typically just works and the pin will only affect your own
from-source installs. The reason not to pin is if you release very
irregularly - your package may then need a newer setuptools for Python 3.11
support in Oct'22 for example. It's a trade-off between avoiding breakage
and not getting support for new Python versions and bug fixes.
Also note the tracking issues for this build system interaction are at:
It would be nice to be able to use the Python syntax we already use to
format the precision of floating numbers in numpy:
>>> a = np.array([-np.pi, np.pi])
This is particularly useful when you have large arrangements. The problem
is that if you want to do it today, it is not implemented:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported format string passed to numpy.ndarray.__format__
In this PR (https://github.com/numpy/numpy/pull/19550) I propose a very
basic formatting implementation for numeric numbers that uses
`array2string` just like it currently does `str`
At first, since we are only considering formatting the numeric type,
floating numbers specifically, we are only interested in being able to
change the precision, the sign, and possibly the rounding or truncation.
Since the `array2string` function already does everything we need, we only
need to implement the` __format__` function of the `ndarray` class which
parses a predefined format (similar to the one already used by Python for
built-in data types) to indicate the parameters before said.
I propose a mini format specification inspired in the [Format Specification
format_spec ::= [sign][.precision][type]
sign ::= "+" | "-" | " "
precision ::= [0-9]+
type ::= "f" | "e"
We are going to consider only 3 arguments of the `array2string` function:`
precision`, `suppress_small`,` sign`. In particular, the `type` token sets
the` suppress_small` argument to True when the type is `f` and False when
it is `e`. This is in order to mimic Python's behavior in truncating
decimals when using the fixed-point notation.
As @brandon-rhodes said in gh-5543, the behavior when you try to format an
array containing Python objects, the behavior should be the same as Python
has implemented by default in the `object` class: ` format (a, "") ` should
be equivalent to `str (a)` and `format(a, "not empty")` should raise an
What remains to be defined is the behavior when trying to format an array
with a non-numeric data type (`np.numeric`) other than `np.object_`. Should
we raise an exception? In my opinion yes, since in the future formatting is
extended -- for example, for dates -- people are aware that before that was
I'm open to suggestions.
NumExpr 2.8.0 is released. This is mostly a version bump. We now support
and support for 2.7 and 3.5 has been discontinued.
Project documentation is available at:
Changes from 2.7.3 to 2.8.0
* Wheels for Python 3.10 are now provided.
* Support for Python 2.7 and 3.5 has been discontinued.
* All residual support for Python 2.X syntax has been removed, and
the setup build no longer makes calls to the `2to3` script. The
has been refactored to be more modern.
* The examples on how to link into Intel VML/MKL/oneAPI now use the dynamic
Numexpr is a fast numerical expression evaluator for NumPy. With it,
expressions that operate on arrays (like "3*a+4*b") are accelerated
and use less memory than doing the same calculation in Python.
It has multi-threaded capabilities, as well as support for Intel's
MKL (Math Kernel Library), which allows an extremely fast evaluation
of transcendental functions (sin, cos, tan, exp, log...) while
squeezing the last drop of performance out of your multi-core
processors. Look here for a some benchmarks of numexpr using MKL:
Its only dependency is NumPy (MKL is optional), so it works well as an
easy-to-deploy, easy-to-use, computational engine for projects that
don't want to adopt other solutions requiring more heavy dependencies.
Where I can find Numexpr?
The project is hosted at GitHub in:
You can get the packages from PyPI as well (but not for RC releases):
Documentation is hosted at:
Share your experience
Let us know of any bugs, suggestions, gripes, kudos, etc. you may
Our bi-weekly triage-focused NumPy development meeting is Wednesday,
December 1st at 16:30 UTC (8:30am Pacific Time).
Everyone is invited to join in and edit the work-in-progress meeting
topics and notes:
I encourage everyone to notify us of issues or PRs that you feel should
be prioritized, discussed, or reviewed.