Skip to content

Preload python packages in workerd like in EW.#4190

Merged
dom96 merged 1 commit intomainfrom
dominik/preload-packages-workerd
Jun 19, 2025
Merged

Preload python packages in workerd like in EW.#4190
dom96 merged 1 commit intomainfrom
dominik/preload-packages-workerd

Conversation

@dom96
Copy link
Contributor

@dom96 dom96 commented May 22, 2025

This PR was implemented with the help of Windsurf.

This PR changes how workerd downloads Python packages. Instead of downloading them inside the worker using fetch, the packages are downloaded prior to isolate startup. This allows workerd to share the same startup code path as EW.

There are two left over tasks after this PR, but which are too big for this PR:

  • Tracing still requires IO, so we cannot init Python while tracing is on. It would be nice to avoid this, though I'm not sure how realistic that is.
  • The DiskCache class continues to exist, it is currently only used to save snapshot to disk for testing (and manual generation) purposes.

Test Plan

bazel run @workerd//src/workerd/server/tests/python:python-rpc_development@

@dom96 dom96 force-pushed the dominik/preload-packages-workerd branch 7 times, most recently from 72b0646 to 4ea7502 Compare May 23, 2025 14:53
@dom96 dom96 force-pushed the dominik/preload-packages-workerd branch from 4ea7502 to 5e83346 Compare May 23, 2025 15:10
@github-actions
Copy link

github-actions bot commented May 23, 2025

The generated output of @cloudflare/workers-types matches the snapshot in types/generated-snapshot 🎉

@dom96 dom96 force-pushed the dominik/preload-packages-workerd branch from 5e83346 to 6ce3338 Compare May 23, 2025 15:20
@dom96 dom96 force-pushed the dominik/preload-packages-workerd branch 3 times, most recently from 6bf70d6 to 83a00ab Compare May 23, 2025 15:54
@dom96 dom96 marked this pull request as ready for review May 23, 2025 16:01
@dom96 dom96 requested review from a team as code owners May 23, 2025 16:01
@dom96 dom96 requested a review from hoodmane May 23, 2025 16:02
@dom96 dom96 force-pushed the dominik/preload-packages-workerd branch 2 times, most recently from d8cad85 to 1e3c987 Compare May 23, 2025 16:20
@claude

This comment was marked as duplicate.

@dom96 dom96 force-pushed the dominik/preload-packages-workerd branch from 11f7657 to ac4fdb0 Compare June 12, 2025 15:56
@claude

This comment was marked as duplicate.

@dom96 dom96 force-pushed the dominik/preload-packages-workerd branch from ac4fdb0 to e2415ab Compare June 12, 2025 17:55
@claude

This comment was marked as duplicate.

@dom96 dom96 force-pushed the dominik/preload-packages-workerd branch from e2415ab to f75e2ad Compare June 13, 2025 10:45
@dom96 dom96 force-pushed the dominik/preload-packages-workerd branch 13 times, most recently from 4e4b0c6 to 6685441 Compare June 16, 2025 18:21
@dom96 dom96 force-pushed the dominik/preload-packages-workerd branch 5 times, most recently from 1fba18a to bfd3c47 Compare June 19, 2025 15:47
@dom96 dom96 force-pushed the dominik/preload-packages-workerd branch from bfd3c47 to c332b2f Compare June 19, 2025 16:29
@dom96 dom96 merged commit f63be49 into main Jun 19, 2025
20 of 21 checks passed
@dom96 dom96 deleted the dominik/preload-packages-workerd branch June 19, 2025 17:13
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.

5 participants