Closed henryiii closed 3 weeks ago
@hoodmane, is there another way to get the emscripten version for a specific pypodide versions, via an API or anything? One that doesn't require installing pyodide-build? Okay if not, but just checking before setting something up. I'd like to be able to quickly get the current pyodide version (can do that with lastversion), and then get the matching emscripten version it requires.
@ryanking13 do we have anything for this? The information is in this file: https://raw.githubusercontent.com/pyodide/pyodide/1196a59a8b58b3e2c3e1a1b5f7fd71b924d3ed92/pyodide-cross-build-environments.json Ideally we should make an http API for this...
@ryanking13 do we have anything for this? The information is in this file: https://raw.githubusercontent.com/pyodide/pyodide/1196a59a8b58b3e2c3e1a1b5f7fd71b924d3ed92/pyodide-cross-build-environments.json
Yes, that file has the python and emscripten version information needed to build targeting a specific pyodide version.
We will try to keep backward compatibility as much as possible, so I guess for now you can use jq
to parse that file.
https://raw.githubusercontent.com/pyodide/pyodide/main/pyodide-cross-build-environments.json doesn't contain 0.26.1 though.
I opened a PR to add 0.26.1 (https://github.com/pyodide/pyodide/pull/4854). The workflow for updating that file is not fully automated yet, but I'm planning to improve it.
# /// script
# dependencies = [ "requests", "packaging", "tomlkit" ]
# ///
from pathlib import Path
import requests
import tomlkit
from packaging.version import Version
URL = "https://raw.githubusercontent.com/pyodide/pyodide/main/pyodide-cross-build-environments.json"
DIR = Path(__file__).parent.resolve()
def main():
response = requests.get(URL)
response.raise_for_status()
pyodide_info = response.json()
current = max(pyodide_info["releases"].values(), key=lambda v: Version(v["version"]))
config_file = DIR.parent / "cibuildwheel/resources/build-platforms.toml"
content = tomlkit.parse(config_file.read_text())
configs = content["pyodide"]["python_configurations"]
for config in configs:
if config["version"].split(".")[1] == current["python_version"].split(".")[1]:
config["version"] = current["python_version"]
config["pyodide_version"] = current["version"]
config["emscripten_version"] = current["emscripten_version"]
config_file.write_text(tomlkit.dumps(content))
if __name__ == "__main__":
main()
Works (well, currently it downgrades pyodide, but that's "working").
Bumping for pyodide 0.26.1, which contains some important fixes.
We should probably automate this. You can get the emscripten version from pyodide build, not sure if there's a better way.