8000 Begin making pyscript.py into a Python package by hoodmane · Pull Request #1232 · pyscript/pyscript · GitHub
[go: up one dir, main page]

Skip to content

Begin making pyscript.py into a Python package #1232

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

Merged
merged 2 commits into from
Mar 2, 2023

Conversation

hoodmane
Copy link
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.

@@ -213,7 +213,8 @@ export class PyScriptApp {
logger.info('importing pyscript');

// Save and load pyscript.py from FS
interpreter.interface.FS.writeFile('pyscript.py', pyscript, { encoding: 'utf8' });
Copy link
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
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
Copy link
Contributor Author
hoodmane commented Mar 2, 2023

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
Contributor

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

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

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
0