Skip to content

Change Python package resolution to use the PyPA simple api on PyPI#1950

Draft
abstractedfox wants to merge 9 commits into
cloudflare:mainfrom
abstractedfox:python-package/pypi-simple-api
Draft

Change Python package resolution to use the PyPA simple api on PyPI#1950
abstractedfox wants to merge 9 commits into
cloudflare:mainfrom
abstractedfox:python-package/pypi-simple-api

Conversation

@abstractedfox

Copy link
Copy Markdown
Member

Builds on #1945 (so diffs will look excessive until it's merged) and implements feedback from @ryanking13 on #1881. Because this is part of ongoing work on this feature, new components have been added in the interest of keeping changes more incremental, thus not all aspects of the implementation are fully complete (this should be mentioned in the comments where it's relevant, but do say so if there are any gaps). Much of this is generated code.

@changeset-bot

changeset-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9e21086

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 15, 2026

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@1950

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@1950

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@1950

create-think

npm i https://pkg.pr.new/create-think@1950

hono-agents

npm i https://pkg.pr.new/hono-agents@1950

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@1950

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@1950

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@1950

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@1950

commit: fec9c92

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

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

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

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
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

1st pass moving to 'simple API' on PyPI

A fair amount of this is AI code, a beautification pass would be beneficial

Merge from python-package-resolution

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

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

Clear warning

There were warnings in the console about a binary/octet-stream response being parsed as text. Since
the response actually is text, this avoids that warning.

Change return type
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

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

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

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
@abstractedfox
abstractedfox force-pushed the python-package/pypi-simple-api branch from 17e3c03 to 6a8c4e3 Compare July 24, 2026 04:20
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.

1 participant