Pyodide Conversion: fix requirements handling #6859
+255
−106
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.
This fixes: #6787 AND #4164 and adjusts the documentation
Why both? adding custom wheels as requirements requires making those available to the Pyodide environment at runtime. One could place them into the output structure as wheels to be served with the app, but this might clutter it a lot if there are many wheels (and also clash with any bundling system to be implemented). Also semantics with this solution seem clearer: you convert a panel app requiring custom wheels, you get a zip with dependencies and you distribute the app and the zip-file.
As the infrastructure for fixing #4164 was in place with this solution, I then also added a
--resources
-flag to the convert-command to include custom resources (such as template files/data files/...) required by the custom-python-portion of the panel app. Everything is packed into a single zipfile, because that's easiest to use with thepyscript
config
(which only allows to uncompress one zip to a specific wildcard-location); also I bumped the pyscript version, because that feature only got added with one of the small releases.Currently BROKEN: on main, someone updated the version number in
package.json
which is used for getting theCDN_DIST
-url. I thinkPY_VERSION
inpanel/io/convert.py
(which references a python__version__
should also be updated accordingly and possibly also be acquired from a single-source-of-truth!Reasons for restructuring:
collect_python_requirements
(finding the requirements or parsing the requirements-file) and some code rewriting/collecting filesystem-URLs.script_to_html
now takes a micropip-ready list of package-specifications!Small things:
MIN_VERSIONS
for this reason. Once pyodide implements proper requirements handling this should be put into the requirements-file like for every other project.