Problem
bjdata 0.6.6 ships an sdist only (no binary wheels on PyPI), so the
_bjdata C extension is compiled from source on every install. Its build pins:
# pyproject.toml
[build-system]
requires = ["setuptools>=40", "wheel", "oldest-supported-numpy"]
build-backend = "setuptools.build_meta"
oldest-supported-numpy is deprecated and forces building against
NumPy 1.x. NumPy 2.0 changed the C-ABI: an extension compiled against
NumPy 1.x, when imported under NumPy 2.x, makes NumPy print a multi-line
diagnostic to stderr and disables the extension's NumPy integration:
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.4.x as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
...
from _bjdata import dump, dumpb, load, loadb
AttributeError: _ARRAY_API not found
import bjdata still succeeds and the plain (non-NumPy) UBJSON encode/decode
paths work; only bjdata's NumPy-NDArray (de)serialization is broken. But the
stderr diagnostic is alarming and pollutes the output of any application that
imports bjdata under NumPy 2.x (which is now the default NumPy).
Reproduction
python -m venv /tmp/v && /tmp/v/bin/pip install -U pip "numpy>=2" bjdata==0.6.6
/tmp/v/bin/python -c "import bjdata" # prints the NumPy 1.x/2.x notice to stderr
Suggested fix
- Build against NumPy 2.x: replace
oldest-supported-numpy with
numpy>=2.0 in [build-system].requires. A C extension built against
NumPy 2.0 is compatible with both NumPy 1.x and 2.x at runtime, which is
the documented migration path
(https://numpy.org/devdocs/dev/depending_on_numpy.html#numpy-2-abi-handling).
- Publish binary wheels (manylinux / macOS / Windows, per supported
CPython) so users don't recompile from sdist on every install (and so the
correct NumPy-2-built binary is what they get).
- (Optional) If the NumPy dependency is only needed for the optional NDArray
feature, consider making numpy an optional/extra dependency so pure-UBJSON
users don't pull NumPy at all.
Context
This surfaced via the WAMP/Autobahn ecosystem: autobahn 26.6.x uses bjdata
as the backend for its optional "ubjson" WAMP serializer (replacing the
unmaintained py-ubjson), and downstream crossbar users see the notice on
startup under NumPy 2.x.
(Note: distinct from #6.)
Problem
bjdata0.6.6 ships an sdist only (no binary wheels on PyPI), so the_bjdataC extension is compiled from source on every install. Its build pins:oldest-supported-numpyis deprecated and forces building againstNumPy 1.x. NumPy 2.0 changed the C-ABI: an extension compiled against
NumPy 1.x, when imported under NumPy 2.x, makes NumPy print a multi-line
diagnostic to stderr and disables the extension's NumPy integration:
import bjdatastill succeeds and the plain (non-NumPy) UBJSON encode/decodepaths work; only bjdata's NumPy-NDArray (de)serialization is broken. But the
stderr diagnostic is alarming and pollutes the output of any application that
imports bjdata under NumPy 2.x (which is now the default NumPy).
Reproduction
Suggested fix
oldest-supported-numpywithnumpy>=2.0in[build-system].requires. A C extension built againstNumPy 2.0 is compatible with both NumPy 1.x and 2.x at runtime, which is
the documented migration path
(https://numpy.org/devdocs/dev/depending_on_numpy.html#numpy-2-abi-handling).
CPython) so users don't recompile from sdist on every install (and so the
correct NumPy-2-built binary is what they get).
feature, consider making
numpyan optional/extra dependency so pure-UBJSONusers don't pull NumPy at all.
Context
This surfaced via the WAMP/Autobahn ecosystem:
autobahn26.6.x usesbjdataas the backend for its optional "ubjson" WAMP serializer (replacing the
unmaintained
py-ubjson), and downstreamcrossbarusers see the notice onstartup under NumPy 2.x.
(Note: distinct from #6.)