8000 Make `pyscript.py` into a Python package · Issue #1226 · pyscript/pyscript · GitHub
[go: up one dir, main page]

Skip to content

Make pyscript.py into a Python package #1226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hoodmane opened this issue Feb 26, 2023 · 2 comments · Fixed by #1309
Closed

Make pyscript.py into a Python package #1226

hoodmane opened this issue Feb 26, 2023 · 2 comments · Fixed by #1309
Labels
type: bug Something isn't working

Comments

@hoodmane
Copy link
Contributor
hoodmane commented Feb 26, 2023

pyscript.py has a bunch of unrelated logic in it, some of which should probably be private. There should be a pyscript package with an __init__.py and multiple submodules with related logic. There are several ways to do this, personally I like taring the package folder and then loading the tar file with fetch and pyodide.unpackArchive. But you could also use rollup.

@hoodmane hoodmane added needs-triage Issue needs triage type: bug Something isn't working labels Feb 26, 2023
@marimeireles marimeireles removed the needs-triage Issue needs triage label Mar 6, 2023
@marimeireles
Copy link
Contributor

Did you attend to this already @hoodmane?
I've seen a related PR a few days ago.
Cheers.

@hoodmane
Copy link
Contributor Author
hoodmane commented Mar 6, 2023

I did a little bit of this. The next step is to make adjustments to rollup.config.js, which was somewhat untidily formatted. So I got distracted with setting up prettier.

hoodmane added a commit to hoodmane/pyscript that referenced this issue Mar 8, 2023
Followup to pyscript#1232. Closes pyscript#1226.

Use node to make a manifest of the src/python dir and then use terser
to inject it into the bundle as a variable called pyscript_package.
This means we need to always use the terser plugin even when not minifying.
In the non-minify case, we disable terser minification and mangling and
enable terser beautification. Note that we bundle mangled versions of many
upstream npm dependencies, so even in debug/nonminified builds, these do
not include symbol names.
hoodmane added a commit to hoodmane/pyscript that referenced this issue Mar 8, 2023
Followup to pyscript#1232. Closes pyscript#1226.

Use node to make a manifest of the src/python dir and then use terser
to inject it into the bundle as a variable called pyscript_package.
This means we need to always use the terser plugin even when not minifying.
In the non-minify case, we disable terser minification and mangling and
enable terser beautification. Note that we bundle mangled versions of many
upstream npm dependencies, so even in debug/nonminified builds, these do
not include symbol names.
hoodmane added a commit to hoodmane/pyscript that referenced this issue Mar 25, 2023
Followup to pyscript#1232. Closes pyscript#1226.

Use node to make a manifest of the src/python dir and then use an esbuild
plugin to resolve an import called `pyscript_python_package.esbuild_injected.json`
to an object indicating the directories and files in the package folder.
This object is then used to govern runtime installation of the package.
hoodmane added a commit to hoodmane/pyscript that referenced this issue Mar 25, 2023
Followup to pyscript#1232. Closes pyscript#1226.

Use node to make a manifest of the src/python dir and then use an esbuild
plugin to resolve an import called `pyscript_python_package.esbuild_injected.json`
to an object indicating the directories and files in the package folder.
This object is then used to govern runtime installation of the package.
hoodmane added a commit to hoodmane/pyscript that referenced this issue Mar 27, 2023
Followup to pyscript#1232. Closes pyscript#1226.

Use node to make a manifest of the src/python dir and then use an esbuild
plugin to resolve an import called `pyscript_python_package.esbuild_injected.json`
to an object indicating the directories and files in the package folder.
This object is then used to govern runtime installation of the package.
hoodmane added a commit that referenced this issue Mar 29, 2023
Followup to #1232. Closes #1226.

Use node to make a manifest of the src/python dir and then use an esbuild
plugin to resolve an import called `pyscript_python_package.esbuild_injected.json`
to an object indicating the directories and files in the package folder.
This object is then used to govern runtime installation of the package.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
2 participants
0