Skip to content

Begin making pyscript.py into a Python package#1232

Merged
FabioRosado merged 2 commits into
pyscript:mainfrom
hoodmane:pyscript-package
Mar 2, 2023
Merged

Begin making pyscript.py into a Python package#1232
FabioRosado merged 2 commits into
pyscript:mainfrom
hoodmane:pyscript-package

Conversation

@hoodmane

Copy link
Copy Markdown
Contributor

This doesn't quite do the full job because we also need to make sure that the rest of the files in the new pyscript folder also get included. Will do this in a followup.

Comment thread pyscriptjs/src/main.ts
logger.info('importing pyscript');

// Save and load pyscript.py from FS
interpreter.interface.FS.writeFile('pyscript.py', pyscript, { encoding: 'utf8' });

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

writeFile does not take an option called encoding.

@marimeireles

Copy link
Copy Markdown
Contributor

We're getting a bunch of test failing and shouldn't approve this one yet :) I think Hood is still working on it

@hoodmane

hoodmane commented Mar 2, 2023

Copy link
Copy Markdown
Contributor Author

Okay now it's passing. Please merge @FabioRosado. I will open a followup which uses rollup to inject all files in the pyscript directory (currently only the __init__.py file is included).

@FabioRosado FabioRosado merged commit 8665a14 into pyscript:main Mar 2, 2023
@FabioRosado

Copy link
Copy Markdown
Contributor

Sounds good merged, on the follow up can you add an entry in the changelog.md in the docs folder? 😄

@hoodmane

hoodmane commented Mar 2, 2023

Copy link
Copy Markdown
Contributor Author

Okay, will do. Thanks!

@hoodmane hoodmane deleted the pyscript-package branch March 2, 2023 12:34
hoodmane added a commit to hoodmane/pyscript that referenced this pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants