Add pyodide-build as a separate build frontend and update its build verbosity handling - #2609
Conversation
fad4b7d to
ff45d5c
Compare
pyodide-build and pypa/build as build frontendspyodide-build and pypa/build as build frontends when handling build verbosity
|
I don't think this is the right approach at the moment, and I should try another way. What I think happens here is that |
|
What's the status here? |
|
I thought myself and Agriya talked about this but I can't see the convo. As I remember, the environment variable approach won't work due to when/where it's set and read. My feeling is that we should actually split out |
|
I recently implemented build verbosity handling in pyodide-build: pyodide/pyodide-build#363. It landed in 0.35.0, which we already have in our constraints. So this is now easy. |
pyodide-build and pypa/build as build frontends when handling build verbosity
freakboy3742
left a comment
There was a problem hiding this comment.
The parts touching the iOS backend all make sense to me.
The only question this raises for me is the long-term goal of handling cross-platform builds. pyodide-build is obviously the pragmatic approach for pyodide right now; but longer term, there's a lot of shared needs between pyodide, iOS and Android builds, and I think there's an opportunity for us to coordinate those efforts.
I've got a very early stage prototype in the form of xbuild. My intention is to get this working for iOS at least, and submit it for use in cibuildwheel (as a replacement for the vendored shims added in #2857); in my ideal world, it would be usable for Android and Pyodide as well.
It's also been deliberately built as an extension to build so that there's a potential path to eventually upstream the changes into build itself (presumably once we've proven it works cross platform and we've got a PEP detailing what "cross platform builds" actually mean).
I mention this not as a blocker to this PR, but as an indicator of a direction that I'm interested in pursuing, where I think the needs of Pyodide, Android and iOS are aligned.
|
Thanks @freakboy3742. Yes, I believe this is an effort worth coordinating on our side for Pyodide-related aspects. I would be happy to help out with contributing or testing things when it's experimentable. Right now, pyodide-build just passes all the build frontend work to pypa/build, and the WASM sysconfigdata comes pre-registered as a In that sense, the xvenv is analogous to the Pyodide xbuildenvs, but with some differences, in that (i) the semantics of the cross-build environment are not exposed to the user in pyodide-build, and (ii) pyodide-build is called from a conventional system Python. The user does not need to set up a cross-build environment on their own when building a WASM wheel. I recognise that I might be biased by the work we have built to make pyodide-build more mature, but I have developed a propensity for this kind of "plug-and-play" convenience1. One thing that will remain difficult to port to xbuild is pyodide-build's I cannot say what the approach would look like without having played around with xbuild a bit, but whatever leads us to use and maintain less code, and the ecosystem to build a shared standard, is a win :) I will try to spend a weekend sometime to create an issue on the xbuild side outlining what Emscripten support could look like. Footnotes
|
Since #2609, the pyodide platform required the 'pyodide-build' frontend, but a global build-frontend setting (TOML or CIBW_BUILD_FRONTEND) overrides the platform default, so previously-working configs like build-frontend = "build" failed with a ConfigurationError. Even "default" failed, since it was mapped to "build" before the check. Resolve "default" to the platform default, and warn and use pyodide-build when another frontend is set on pyodide, matching pre-#2609 behavior where the frontend name only affected verbosity flags. Assisted-by: ClaudeCode:claude-opus-4.8
See #2605
cc: @AndrewAnnex
See summary by Copilot below, AI-generated, which I edited manually to be more concise 🤖
This PR makes
pyodide-builda distinguished build frontend, which is now the only allowed one for the Pyodide platform:Pyodide build frontend enforcement and support:
pyodide-buildas a valid value forBuildFrontendNameand implemented logic to enforce that the Pyodide platform only supports thepyodide-buildfrontend, raising configuration errors if mismatched.pyodide-buildas the default and only supported frontend for Pyodide, including a new documentation section explaining this restriction.Platform-specific frontend restrictions:
pyodide-buildas a build frontend on all non-Pyodide platforms, raising fatal errors if attempted.Verbosity and CLI argument handling:
pyodide-buildfrontend, capping at-vvsincepyodide builddoes not support higher verbosity. Updated documentation tables accordingly.Testing and validation:
pyodide-buildis accepted on Pyodide, that it is rejected on other platforms, and that CLI arguments and verbosity are handled correctly.Cleanup and removal of obsolete logic:
pip) on Pyodide, as onlypyodide-buildis now allowed.