Adding a command to convert a project for use offline #149
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 is a command to convert an existing pyscript project for use offline. It depends on pyscript/pyscript#2077 to pull the correct files via a tarball of built files.
The project path is passed through the first and only required argument,
It downloads the following resources:
pyscriptfiles frompyscript.netpyodidefiles from Githubmicropythonfiles fromcdn.jsdelivr.netThe option is available to download the entire
pyodidelibrary via thedownload-full-pyodideflag.All relevant HTML files are also updated to point to the local
/pyscript/directory instead ofhttps://pyscript.net....Since there's not an easy way to retrieve all the active configuration files in use,
config-filesis a comma-separated list of files to be passed in. The script then loops through those files and updates the interpreter to the local one based on what is passed through the--interpreteroption (defaults topyodide, which may or may not be a good idea).Finally, it also warns the user if any
<py-config>or<mypy-config>tags are found, as it doesn't update the interpreter in those tags.Written at PyCon US 2024 sprints.