Skip to contentSkip to conversation

Fixes for pika, pint, haversine and httpx2

PATCH New Thomas Roos 1 participant 7 messages Nov 8

lore
Share & tools
lore
#0 lore raw

cover Fixes for pika, pint, haversine and httpx2

Four recipes in meta-python install broken or wrong code. I found them while upgrading meta-homeassistant to Home Assistant 2026.11, but the fixes do not depend on that:

- python3-pika: the 1.4.4 upgrade only changed the unused sha256sum, so SRCREV still pointed at a 1.4.2 era commit and the package installed pika 1.4.2 under version 1.4.4. SRCREV now points at the 1.4.4 tag commit, and tag=${PV} lets the fetcher check that.
- python3-pint: flexcache, flexparser and typing-extensions were only pulled in by the ptest, so "import pint" failed on an image without the ptest. flexcache and flexparser are extended to native and nativesdk like pint; without that, python3-pint-native fails with "Nothing RPROVIDES 'python3-flexcache-native'".
- python3-haversine: numba is optional, but haversine only catches ModuleNotFoundError. numba 0.66 (meta-python-ai) raises ImportError with NumPy 2.5, which broke "import haversine". The patch catches ImportError. Submitted upstream: https://github.com/mapado/haversine/pull/91
- python3-httpx2, with the new python3-truststore and python3-httpcore2:
httpx2 requires httpcore2, anyio and truststore, but did not depend on them, so "import httpx2" failed with "No module named 'httpcore2'".

The series is independent of the "Python updates for Home Assistant 2026.11" series sent at the same time; both apply to master on their own.

Related changes for the Home Assistant 2026.11 upgrade:

- openembedded-core: python3-cython 3.2.9 -> 3.3.1
https://github.com/thomas-roos/openembedded-core/commits/ha-2026.11
- meta-openembedded (meta-python): this series and the updates series
https://github.com/thomas-roos/meta-openembedded/commits/ha-2026.11
- meta-python-ai: 7 upgrades
https://github.com/zboszor/meta-python-ai/pull/46
- meta-homeassistant: Home Assistant 2026.3.1 -> 2026.11.0
https://github.com/meta-homeassistant/meta-homeassistant/pull/207

Testing, on top of master b5d60afb63:
- built for qemux86-64 (x86-64-v3), together with meta-homeassistant's core-image-homeassistant (Home Assistant 2026.11)
- ptests pass for flexcache, flexparser and pint
- in the running image, Home Assistant starts (it imports httpx2) and all its integrations import, including the geo_rss_events and geojson based ones that import haversine
- python3-pika: built; the installed dist-info now reports 1.4.4. It is not in a ptest list of meta-python, so its ptest was not run
- checked with bodnuti: patchtest pass, no oelint-adv or shellcheck findings

AI disclosure: the patches, commit messages and this cover letter were written with Claude Code (Claude Opus 5.5), as the AI-Generated tags in each patch say. I reviewed every change, ran the builds and tests above, and can answer for them.

Thomas Roos (6):
python3-pika: build the 1.4.4 release
python3-pint: add missing runtime dependencies
python3-haversine: keep working when numba fails to import
python3-truststore: add recipe
python3-httpcore2: add recipe
python3-httpx2: add missing runtime dependencies

 .../python/python3-flexcache_0.3.bb           |  2 +
 .../python/python3-flexparser_0.4.bb          |  2 +
 ...-pure-Python-kernels-if-numba-fails-.patch | 40 +++++++++++++++++++
 .../python/python3-haversine_2.9.0.bb         |  1 +
 .../python/python3-httpcore2_2.16.0.bb        | 26 ++++++++++++
 .../python/python3-httpx2_2.16.0.bb           |  5 ++-
 .../python/python3-pika_1.4.4.bb              |  6 +--
 .../python/python3-pint_0.26.2.bb             |  5 ++-
 .../python/python3-truststore_0.10.4.bb       | 13 ++++++
 9 files changed, 93 insertions(+), 7 deletions(-)
 create mode 100644 meta-python/recipes-devtools/python/python3-haversine/0001-Fall-back-to-the-pure-Python-kernels-if-numba-fails-.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-httpcore2_2.16.0.bb
 create mode 100644 meta-python/recipes-devtools/python/python3-truststore_0.10.4.bb
Signature · 1 line
2.56.0
#1 lore raw

PATCH 1/6 python3-pika: build the 1.4.4 release

The upgrade to 1.4.4 only changed SRC_URI[sha256sum], which is unused since the recipe fetches from git, so SRCREV still pointed at a 1.4.2 era commit and the package installed pika 1.4.2 under version 1.4.4.

Point SRCREV at the 1.4.4 tag commit and drop the unused checksum. Add tag=${PV} to SRC_URI so that the fetcher checks that SRCREV is the commit of the release tag.

AI-Generated: Claude Code, Claude Opus 5.5

---
 meta-python/recipes-devtools/python/python3-pika_1.4.4.bb | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
meta-python/recipes-devtools/python/python3-pika_1.4.4.bb +2 -4
index 2c18659eab..c4c1bae8fe 100644
@@ -8,13 +8,11 @@ HOMEPAGE = "https://pika.readthedocs.io"
 LICENSE = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=678ec81495ba50edf81e84e4f1aa69f3"
 
-SRC_URI[sha256sum] = "8cfc8b33a5cb16e733bd60cffca9732c0d1d761ecd80a89f34ed7df2cd38d6d6"
-
 # The PyPI package omits some files for testing like tests/__init__.py
 # so use the GitHub source instead.
-SRCREV = "3c9b50d4167e436c73cecae8127e3c5b266b2fce"
+SRCREV = "60fee4203a30d5dfa0500857cea6a65ef571d46c"
 SRC_URI = "\
-    git://github.com/pika/pika;branch=1.4.x;protocol=https \
+    git://github.com/pika/pika;branch=1.4.x;protocol=https;tag=${PV} \
     file://run-ptest \
 "
 
Signature · 1 line
2.56.0
#2 lore raw

PATCH 2/6 python3-pint: add missing runtime dependencies

In reply to Thomas Roos

pint requires flexcache, flexparser and typing-extensions, but only the ptest package pulled in flexcache and flexparser, so "import pint" fails with "No module named 'flexcache'" on an image without the ptest.

pint is extended to native and nativesdk, so flexcache and flexparser are as well.

AI-Generated: Claude Code, Claude Opus 5.5

---
 meta-python/recipes-devtools/python/python3-flexcache_0.3.bb | 2 ++
 .../recipes-devtools/python/python3-flexparser_0.4.bb        | 2 ++
 meta-python/recipes-devtools/python/python3-pint_0.26.2.bb   | 5 +++--
 3 files changed, 7 insertions(+), 2 deletions(-)
meta-python/recipes-devtools/python/python3-flexcache_0.3.bb +2 -0
index d46f9eb16f..efdeaabf1b 100644
@@ -18,3 +18,5 @@ RDEPENDS:${PN} += " \
 	python3-pickle \
 	python3-typing-extensions \
 "
+
+BBCLASSEXTEND = "native nativesdk"
meta-python/recipes-devtools/python/python3-flexparser_0.4.bb +2 -0
index e4e15d1a35..7ab1c713f9 100644
@@ -18,3 +18,5 @@ RDEPENDS:${PN} += " \
 	python3-email \
 	python3-logging \
 "
+
+BBCLASSEXTEND = "native nativesdk"
meta-python/recipes-devtools/python/python3-pint_0.26.2.bb +3 -2
index f370da6a57..dba437a0dd 100644
@@ -17,15 +17,16 @@ BBCLASSEXTEND = "native nativesdk"
 PTEST_PYTEST_DIR = "pint"
 
 RDEPENDS:${PN} += " \
+	python3-flexcache \
+	python3-flexparser \
 	python3-packaging \
 	python3-platformdirs \
+	python3-typing-extensions \
 "
 # python3-misc for timeit.py
 RDEPENDS:${PN}-ptest += " \
 	python3-appdirs \
 	python3-attrs \
-	python3-flexcache \
-	python3-flexparser \
 	python3-misc \
 	python3-pytest-benchmark \
 	python3-pytest-subtests \
Signature · 1 line
2.56.0
#3 lore raw

PATCH 3/6 python3-haversine: keep working when numba fails to import

In reply to Thomas Roos

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

---
 ...-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
meta-python/recipes-devtools/python/python3-haversine/0001-Fall-back-to-the-pure-Python-kernels-if-numba-fails-.patch new file +40 -0
new file mode 100644
index 0000000000..6e20534799
@@ -0,0 +1,40 @@
+From 5f199ca92d651d653cb26b4fb6c48ba91137bec5 Mon Sep 17 00:00:00 2001
+From: Thomas Roos <[email protected]>
+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 <[email protected]>
+---
+ 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
+
meta-python/recipes-devtools/python/python3-haversine_2.9.0.bb +1 -0
index 2dfb3356a7..439ff98371 100644
@@ -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
Signature · 1 line
2.56.0
#4 lore raw

PATCH 4/6 python3-truststore: add recipe

In reply to Thomas Roos

httpx2 and httpcore2 require truststore. Home Assistant 2026.11 pins truststore 0.10.4.

AI-Generated: Claude Code, Claude Opus 5.5

---
 .../python/python3-truststore_0.10.4.bb             | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-truststore_0.10.4.bb
meta-python/recipes-devtools/python/python3-truststore_0.10.4.bb new file +13 -0
new file mode 100644
index 0000000000..1d778a8642
@@ -0,0 +1,13 @@
+SUMMARY = "Verify certificates using native system trust stores"
+DESCRIPTION = "Truststore is a library which exposes native system \
+    certificate stores (ie \"trust stores\") through an ssl.SSLContext-like \
+    API."
+HOMEPAGE = "https://github.com/sethmlarson/truststore"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=74420fc3965c4558a4a1529e63c2867f"
+
+SRC_URI[sha256sum] = "9d91bd436463ad5e4ee4aba766628dd6cd7010cf3e2461756b3303710eebc301"
+
+inherit pypi python_flit_core
+
+RDEPENDS:${PN} += "python3-io"
Signature · 1 line
2.56.0
#5 lore raw

PATCH 5/6 python3-httpcore2: add recipe

In reply to Thomas Roos

httpx2 imports httpcore2, which is released as a separate package from the same repository and with the same version.

AI-Generated: Claude Code, Claude Opus 5.5

---
 .../python/python3-httpcore2_2.16.0.bb        | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-httpcore2_2.16.0.bb
meta-python/recipes-devtools/python/python3-httpcore2_2.16.0.bb new file +26 -0
new file mode 100644
index 0000000000..03718729c1
@@ -0,0 +1,26 @@
+SUMMARY = "A minimal low-level HTTP client"
+DESCRIPTION = "The HTTP core package of httpx2: connection pooling, \
+    HTTP/1.1 and HTTP/2 transport and proxy support."
+HOMEPAGE = "https://github.com/pydantic/httpx2"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE.md;md5=77c5a523c15d4a5887b081bba41ca110"
+
+SRC_URI[sha256sum] = "c72cd0413563b17e1cd8354677dff887466f8ec2551679759e93126534428643"
+
+inherit pypi python_hatchling
+
+DEPENDS += "\
+    python3-uv-dynamic-versioning-native \
+    python3-hatch-fancy-pypi-readme-native \
+    python3-jinja2-native \
+    python3-tomlkit-native \
+    python3-dunamai-native \
+"
+
+# anyio comes from the "asyncio" extra, which httpx2 needs for its async
+# client.
+RDEPENDS:${PN} += "\
+    python3-anyio \
+    python3-h11 \
+    python3-truststore \
+"
Signature · 1 line
2.56.0
#6 lore raw

PATCH 6/6 python3-httpx2: add missing runtime dependencies

In reply to Thomas Roos

httpx2 requires httpcore2, anyio and truststore, so "import httpx2" fails with "No module named 'httpcore2'". Home Assistant 2026.11 imports httpx2 at startup and does not start without them.

AI-Generated: Claude Code, Claude Opus 5.5

---
 meta-python/recipes-devtools/python/python3-httpx2_2.16.0.bb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meta-python/recipes-devtools/python/python3-httpx2_2.16.0.bb +4 -1
index fe4919bff2..5478522592 100644
@@ -15,8 +15,11 @@ DEPENDS += " \
 "
 
 RDEPENDS:${PN} += " \
+    python3-anyio \
     python3-core \
-    python3-logging \
     python3-h2 \
+    python3-httpcore2 \
     python3-idna \
+    python3-logging \
+    python3-truststore \
 "
Signature · 1 line
2.56.0