Skip to content
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

Don't embed Python packages in workerd. #1580

Merged
merged 2 commits into from
Jan 29, 2024

Conversation

dom96
Copy link
Collaborator

@dom96 dom96 commented Jan 26, 2024

Just a simple way to disable embedding of Python packages only in workerd to reduce its binary size.

@dom96 dom96 requested review from a team as code owners January 26, 2024 14:46
@dom96 dom96 requested review from mikea, jasnell and hoodmane January 26, 2024 14:46
Copy link
Contributor

@hoodmane hoodmane left a comment

Choose a reason for hiding this comment

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

LGTM

src/pyodide/python-entrypoint-helper.js Show resolved Hide resolved
@dom96 dom96 force-pushed the dominik/unembed-python-packages-in-workerd branch from 1d8c348 to f8d4b49 Compare January 26, 2024 16:22
@hoodmane
Copy link
Contributor

When I run this, it seems that it entirely breaks package loading in workerd. But this is probably acceptable in the short term to get the binary size down. I can manually revert this to do my tests...

@dom96 dom96 force-pushed the dominik/unembed-python-packages-in-workerd branch from f8d4b49 to abb41c6 Compare January 26, 2024 19:23
@dom96
Copy link
Collaborator Author

dom96 commented Jan 26, 2024

@hoodmane can you try again?

@hoodmane
Copy link
Contributor

I added an extra commit which fixes all the examples.

@@ -23,7 +23,8 @@ const config :Workerd.Config = (
const mainWorker :Workerd.Worker = (
modules = [
(name = "worker", pythonModule = embed "./worker.py"),
(name = "fastapi", pythonRequirement = "fastapi"),
(name = "fastapi==0.103.2", pythonRequirement = ""),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will merge this, but I don't think we want to support version numbers and operators in here

@dom96 dom96 merged commit fa6bac1 into main Jan 29, 2024
11 checks passed
@hoodmane hoodmane deleted the dominik/unembed-python-packages-in-workerd branch January 29, 2024 15:27
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.

4 participants