-
-
Notifications
You must be signed in to change notification settings - Fork 483
Description
What is the problem or limitation you are having?
Pyodide maintains a collection of popular Python packages that are compatible with the pyscript runtime.
It is currently difficult to use these packages within the Briefcase web workflows. For example, if you add numpy to the pyproject.toml requires list, and then briefcase run web, Pyodide gives a runtime error "Wheel platform 'win_amd64' is not compatible with Pyodide's platform".
Describe the solution you'd like
Briefcase static web format should support adding Pyodide packages as requirements to the app.
Describe alternatives you've considered
Manually add the needed package to pyscript.toml. This needs to happen each time the app is rebuilt.
packages = [
"/static/wheels/helloworld-0.0.1-py3-none-any.whl",
"/static/wheels/toga_core-0.3.0-py3-none-any.whl",
"/static/wheels/toga_web-0.3.0-py3-none-any.whl",
"/static/wheels/travertino-0.1.3-py3-none-any.whl",
"numpy",
]
See the package loaded in the browser console:
[pyscript/main] Packages to install: (5) ['/static/wheels/helloworld-0.0.1-py3-none-any.whl', '/static/wheels/toga_core-0.3.0-py3-none-any.whl', '/static/wheels/toga_web-0.3.0-py3-none-any.whl', '/static/wheels/travertino-0.1.3-py3-none-any.whl', 'numpy']0: "/static/wheels/helloworld-0.0.1-py3-none-any.whl"1: "/static/wheels/toga_core-0.3.0-py3-none-any.whl"2: "/static/wheels/toga_web-0.3.0-py3-none-any.whl"3: "/static/wheels/travertino-0.1.3-py3-none-any.whl"4: "numpy"]
pyodide.asm.js:10 Loading numpy
pyodide.asm.js:10 Loaded numpy
It does seem eventually that library maintainers will be able to provide packages on PyPI that will be compatible with browser runtimes.
In theory, it should also probably be possible to download Pyodide's numpy wheel but pip gets upset about the platform for the downloaded wheel.
>>> Running Command:
>>> /home/russell/github/beeware/briefcase/venv-3.10-briefcase/bin/python -u -m pip wheel --wheel-dir '/home/russell/tmp/beeware/helloworld/web/static/Hello World/www/static/wheels' -r '/home/russell/tmp/beeware/helloworld/web/static/Hello World/requirements.txt'
>>> Working Directory:
>>> /home/russell/tmp/beeware/helloworld
ERROR: numpy-1.22.4-cp310-cp310-emscripten_3_1_14_wasm32.whl is not a supported wheel on this platform.
