recipes: zeroconf 0.150.0 + ifaddr 0.2.0 - #112
Merged
Merged
Conversation
Pure-Python interface enumerator (ctypes getifaddrs), the sole runtime dep of zeroconf. Needs a recipe despite being pure Python because upstream picks the BSD-vs-Linux sockaddr ctypes layout via platform.system() == "Darwin", and Flet's iOS runtime reports "iOS" (PEP 730) — the Linux layout on a Darwin ABI parses zero adapters, so get_adapters() returns an empty list and any consumer (zeroconf: 'RuntimeError: No interfaces to listen on') breaks on iOS. One patch extends the check to iOS/iPadOS; no upstream fix exists. setup.py-only sdist, so requirements.build seeds setuptools. The platform- tagged wheel outranks PyPI's py3-none-any at equal version, delivering the fix transparently. On-device: iOS sim 2/2; android exercises the unchanged Linux path (validated transitively via the zeroconf recipe-tester run).
mDNS/DNS-SD (flet-dev/flet discussion #6738). Cython-accelerated pure-Python package: the 18 accelerator modules are compiled from the runtime .py files themselves (pure-Python-mode Cython, plain self-contained C, no external libs). First poetry-core-backend recipe in the repo — PythonPackageBuilder handles it unchanged. Upstream's build swallows extension-compile errors even with REQUIRE_CYTHON set, so a broken cross-compile would silently ship a pure-Python wheel; the recipe sets REQUIRE_CYTHON=1 plus a 2-line fail-loud patch, and the test suite asserts the compiled modules are real extensions (including zeroconf/_services/__init__ — a native subpackage __init__, which serious-python loads fine on both platforms). Requires-Dist: ifaddr, shipped as a sibling recipe (iOS sockaddr-layout fix). On-device recipe-tester: 6/6 EXIT 0 on android arm64-v8a emulator AND iOS simulator, including a real in-process register+browse loopback discovery round-trip. [skip ci]: runtime chain — zeroconf's mobile test needs the patched ifaddr wheel in its find-links (else pip silently pulls unpatched PyPI ifaddr and the iOS leg fails); dispatched instead with prebuild_recipes=ifaddr.
Same Python set as 20260720 (3.12.13 / 3.13.14 / 3.14.6, same ABIs) — the delta is Apple signing/provenance hardening (provider-signed XCFrameworks, signed inner .framework bundles, OpenSSL privacy manifest for _ssl/_hashlib, Xcode build-provenance keys in framework Info.plists) and dart_bridge 1.7.1. Local note: the downloads/ tarball cache and extracted support trees are keyed by Python version, not release — a same-version release bump silently reuses stale trees, so purge downloads/python-*-mobile-forge-* (tarballs + support dirs) and re-run setup.sh. Also source setup.sh from bash: zsh's no-word-splitting makes the per-ABI android support check false-fail. Validated locally: zeroconf iphonesimulator:arm64 + android:arm64-v8a clean rebuilds against the fresh 20260730 trees.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds zeroconf 0.150.0 (mDNS/DNS-SD, requested in flet-dev/flet#6738 and ifaddr 0.2.0, its only runtime dependency, which needs a one-line iOS fix despite being pure Python.
zeroconf — Cython-accelerated pure-Python package: 18 accelerator modules compiled from the runtime
.pyfiles themselves (pure-Python-mode Cython, self-contained C, no external libs). First poetry-core-backend recipe;PythonPackageBuilderhandles it unchanged. Upstream'sbuild_ext.pyswallows extension-compile errors even withREQUIRE_CYTHONset, so the recipe setsREQUIRE_CYTHON=1plus a 2-line fail-loud patch, and the tests assert the compiled modules are real extensions (includingzeroconf/_services/__init__— a native subpackage__init__, which serious-python loads correctly on both platforms).ifaddr — selects its BSD-vs-Linux
sockaddrctypes layout viaplatform.system() == "Darwin"; the flet iOS runtime reports"iOS"(PEP 730), so on iOS it parses with the Linux layout on a Darwin ABI andget_adapters()silently returns an empty list, which breaksZeroconf()("No interfaces to listen on"). One patch extends the check toiOS/iPadOS. The platform-tagged wheel outranks PyPI'spy3-none-anyat equal version, so the fix reaches consumers transparently. setup.py-only sdist →requirements.build: [setuptools].Consumer notes (usage & recommendations)
zeroconfgives your Flet app mDNS service discovery and advertising (the protocol behind AirPlay/Chromecast/HomeAssistant device discovery) — find services on the local Wi-Fi, and/or announce your app so others can find it. Fully offline: it talks only to the local network, no internet needed.Installation
Just add
zeroconfto your dependencies. On Android you'll also want pyjnius (see why below):(
android.permission.INTERNETis a Flet default. Both Android permissions are install-time, no runtime prompt.)Minimal example
Registers a service and browses for that type, so it always discovers at least itself and the list is never empty:
To be discoverable by other devices, advertise your device's real LAN address instead of
127.0.0.1(e.g. open a UDP socket to8.8.8.8and readgetsockname()[0]). There's also a fully async API (zeroconf.asyncio.AsyncZeroconf) if you prefer it inside Flet's async apps.Android notes
CHANGE_WIFI_MULTICAST_STATEcombo above is not optional for discovery: skipping it doesn't raise — packets just never arrive on most devices, and "discovery finds nothing" is the only symptom.iOS notes
com.apple.developer.networking.multicastentitlement for the raw multicast sockets python-zeroconf uses (requested from Apple per developer account); without it, sends fail withOSError: [Errno 65] No route to host. On top of that, the entitlement must be added to the app's signing —flet buildcurrently has no way to add iOS entitlements, so you'd need a forked build template or post-build Xcode edits, plus the capability on your provisioning profile. The Info.plist keys above (settable via[tool.flet.ios.info]) cover the user-consent prompt, but they do not replace the entitlement.NSNetServiceBrowserviapyobjus, or a Flutter plugin) — those need only the two Info.plist keys and no special entitlement.