From: "Thomas Roos" <roosesweb@gmail.com>
To: openembedded-devel@lists.openembedded.org
Cc: Thomas Roos <thomas@roosesweb.de>
Subject: [meta-python][PATCH 3/6] python3-haversine: keep working when numba fails to import
Date: Sun, 8 Nov 2026 20:25:46 +0100 [thread overview]
Message-ID: <20261108192549.1082715-4-thomas@roosesweb.de> (raw)
In-Reply-To: <20261108192549.1082715-1-thomas@roosesweb.de>
numba is optional for haversine, but haversine only catches
ModuleNotFoundError. With the NumPy 2.5 from OE-Core, numba 0.66 (as in
meta-python-ai) raises
ImportError: Numba needs NumPy 2.4 or less. Got NumPy 2.5.
which makes "import haversine" fail. Catch ImportError instead.
AI-Generated: Claude Code, Claude Opus 5.5
Signed-off-by: Thomas Roos <thomas@roosesweb.de>
---
...-pure-Python-kernels-if-numba-fails-.patch | 40 +++++++++++++++++++
.../python/python3-haversine_2.9.0.bb | 1 +
2 files changed, 41 insertions(+)
create mode 100644 meta-python/recipes-devtools/python/python3-haversine/0001-Fall-back-to-the-pure-Python-kernels-if-numba-fails-.patch
diff --git a/meta-python/recipes-devtools/python/python3-haversine/0001-Fall-back-to-the-pure-Python-kernels-if-numba-fails-.patch b/meta-python/recipes-devtools/python/python3-haversine/0001-Fall-back-to-the-pure-Python-kernels-if-numba-fails-.patch
new file mode 100644
index 0000000000..6e20534799
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-haversine/0001-Fall-back-to-the-pure-Python-kernels-if-numba-fails-.patch
@@ -0,0 +1,40 @@
+From 5f199ca92d651d653cb26b4fb6c48ba91137bec5 Mon Sep 17 00:00:00 2001
+From: Thomas Roos <thomas@roosesweb.de>
+Date: Sat, 7 Nov 2026 11:45:31 +0100
+Subject: [PATCH] Fall back to the pure Python kernels if numba fails to import
+
+numba is an optional accelerator, but importing it can fail with an
+ImportError other than ModuleNotFoundError, for instance when the
+installed NumPy is newer than numba supports:
+
+ ImportError: Numba needs NumPy 2.4 or less. Got NumPy 2.5.
+
+That error escaped and made "import haversine" fail. Catch ImportError,
+which also covers ModuleNotFoundError, so haversine keeps working
+without numba.
+
+Upstream-Status: Submitted [https://github.com/mapado/haversine/pull/91]
+AI-Generated: Claude Code, Claude Opus 5.5
+Signed-off-by: Thomas Roos <thomas@roosesweb.de>
+---
+ haversine/haversine.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/haversine/haversine.py b/haversine/haversine.py
+index a731188..687b602 100755
+--- a/haversine/haversine.py
++++ b/haversine/haversine.py
+@@ -176,7 +176,9 @@ try:
+ _inverse_haversine_kernel_vector = numba.njit(fastmath=True)(_inverse_haversine_kernel_vector)
+ _haversine_kernel = numba.njit(_haversine_kernel)
+ _inverse_haversine_kernel = numba.njit(_inverse_haversine_kernel)
+-except ModuleNotFoundError:
++except ImportError:
++ # numba is optional. Besides being absent, it can refuse to import, e.g.
++ # "Numba needs NumPy 2.4 or less", which must not break haversine.
+ pass
+
+
+--
+2.56.0
+
diff --git a/meta-python/recipes-devtools/python/python3-haversine_2.9.0.bb b/meta-python/recipes-devtools/python/python3-haversine_2.9.0.bb
index 2dfb3356a7..439ff98371 100644
--- a/meta-python/recipes-devtools/python/python3-haversine_2.9.0.bb
+++ b/meta-python/recipes-devtools/python/python3-haversine_2.9.0.bb
@@ -2,6 +2,7 @@ SUMMARY = "Calculate the distance between 2 points on Earth"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=20a52d2c688975e989fcbee3e6c8d1a1"
+SRC_URI += "file://0001-Fall-back-to-the-pure-Python-kernels-if-numba-fails-.patch"
SRC_URI[sha256sum] = "1103d7e1f0f108c25b31b63452c54d9d6f29389a70de7dd75fd4b908329b6fcf"
inherit pypi setuptools3
--
2.56.0
next prev parent reply other threads:[~2026-11-08 19:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 19:25 [meta-python][PATCH 0/6] Fixes for pika, pint, haversine and httpx2 Thomas Roos
2026-11-08 19:25 ` [meta-python][PATCH 1/6] python3-pika: build the 1.4.4 release Thomas Roos
2026-11-08 19:25 ` [meta-python][PATCH 2/6] python3-pint: add missing runtime dependencies Thomas Roos
2026-11-08 19:25 ` Thomas Roos [this message]
2026-11-08 19:25 ` [meta-python][PATCH 4/6] python3-truststore: add recipe Thomas Roos
2026-11-08 19:25 ` [meta-python][PATCH 5/6] python3-httpcore2: " Thomas Roos
2026-11-08 19:25 ` [meta-python][PATCH 6/6] python3-httpx2: add missing runtime dependencies Thomas Roos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261108192549.1082715-4-thomas@roosesweb.de \
--to=roosesweb@gmail.com \
--cc=openembedded-devel@lists.openembedded.org \
--cc=thomas@roosesweb.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.