Skip to content

Python package resolution - #4

Merged
abstractedfox merged 2 commits into
mainfrom
python-package-resolution
Jul 24, 2026
Merged

Python package resolution#4
abstractedfox merged 2 commits into
mainfrom
python-package-resolution

Conversation

@abstractedfox

@abstractedfox abstractedfox commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Local PR of cloudflare#1945 so it can be reviewed (@dom96 @ryanking @hoodmane) while waiting for agents cloudflare#1881 to be merged

@dom96 dom96 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Left some comments, but looks like a good iterative improvement to me :)

Comment thread packages/worker-bundler/src/installer.ts
Comment thread packages/worker-bundler/src/installer.ts Outdated
Reconstitute work on this repo

Add index.py as default entry point

Start of basic package support

This is the beginning of work on this feature, it's a little comment-heavy
to that end and has some patterns that may not be permanent (these have
generally been noted as such). As of this commit, there are tests that
start to poke at this, namely the one that brings in fastapi, which currently
fails due to an extension it doesn't like.

Python package proof of concept

Proof of concept for package support in dynamic Python workers.
As of this commit, it can retrieve an sdist with a flat layout from pypi and
install it into the virtual filesystem. It doesn't do dependency resolution,
so the current tests fail when attempting to import FastAPI's deps.

Clarifying comment

Use wheels properly

Used sdists before, now it uses wheels. Pre cleanup commit

Wheel changeover cleanup

Use simpler packages for minimal package support test

This test only needs to confirm that retrieval of a hard list of pure python packages, without
dependency resolution, works.

Move python logic out of 'bundle' path

This seems to be specific to JS packages

Slight cleanup, remove test

More cleanup

Re-add parameter that was mistakenly deleted

Revert "remove dependency that was causing issues"

This dependendency caused issues when working in a container, but its removal
was purely for my sake

This reverts commit 4f8990d.

Order deps alphabetically

Remove unused variable

Make createWorker Python return more uniform with JS

Make createWorker registry pattern more consistent with JS

Also makes PyprojectToml interface less stringent

Small fixes

These got caught by the checks done by `pnpm run check`

Style fixes

Remove parsing for version string

Comment dep version parameter

Compensate for distribution packages' names not matching their imports

Remove default values from test

These are already set implicitly by createWorker

Move Python package metadata collection into its own function

Move Py deps installation into its own function

Account for type checker

Nested dependency installation without version resolution

Undo unintended compat date change

Bump up compatibility date (test)

Prevent adding python and JS deps to the same worker

Implicitly add workers-runtime-sdk package

Remove check for when there are no dependencies, since there will always
be at least one

Add python_workers flag if user-supplied flags exclude it

Typo

Clarifying comment

Include installWarnings with returned object

Type checker fix

Change tests to assert existence of compat flags

Remove redundant compat flag default

This is implicit on Python dynamic workers now

Mark comment as TODO

Change installDependenciesPython to replicate the JS impl's usage of the result object

Finish propagating `result` object and explicitly disable pyproject.toml and package.json in one worker

Add more TODOs

Change return type
@abstractedfox
abstractedfox force-pushed the python-package-resolution branch from d053a65 to 4fa2759 Compare July 23, 2026 23:29
@abstractedfox
abstractedfox merged commit 0b2bd02 into main Jul 24, 2026
2 of 3 checks passed
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.

2 participants