workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

Support version upload for Python Workers

Open penalosa opened this issue 5 months ago • 3 comments

Previously, Python Workers couldn't be used with version upload because there was a difference in module type detection between deploy and version upload. This PR fixes that bug and unifies the two code paths.

After banging my head against the wall trying to figure out how to nicely test this, this PR also introduces a test helper for making assertions against the content of HTTP requests that Wrangler makes. This will work in tandem with MSW (which provides the mock APIs). The issue with our current setup (MSW interceptors making assertions on the content of requests) is that 1) MSW strongly recommends against this style, and 2) probably because MSW recommends against it, it works pretty badly (in particular, stack traces and mismatches in assertions show up strangely)


  • Tests
    • [ ] TODO (before merge)
    • [x] Tests included
    • [ ] Tests not necessary because:
  • Wrangler / Vite E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • [ ] I don't know
    • [ ] Required
    • [x] Not required because: covered by unit tests
  • Public documentation
    • [ ] TODO (before merge)
    • [ ] Cloudflare docs PR(s):
    • [x] Documentation not necessary because: bugfix
  • Wrangler V3 Backport
    • [x] TODO (before merge)
    • [ ] Wrangler PR:
    • [ ] Not necessary because:

penalosa avatar Jun 17 '25 12:06 penalosa

🦋 Changeset detected

Latest commit: a77361a91400ec0196dcc86be2aae1ce5fa61c4a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
wrangler Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

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

changeset-bot[bot] avatar Jun 17 '25 12:06 changeset-bot[bot]

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@9626
@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@9626
miniflare

npm i https://pkg.pr.new/miniflare@9626
@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@9626
@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@9626
@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@9626
@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@9626
@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@9626
wrangler

npm i https://pkg.pr.new/wrangler@9626

commit: a77361a

pkg-pr-new[bot] avatar Jun 17 '25 12:06 pkg-pr-new[bot]

Failed to automatically backport this PR's changes to Wrangler v3. Please manually create a PR targeting the v3-maintenance branch with your changes. Thank you for helping us keep Wrangler v3 supported!

Depending on your changes, running git rebase --onto v3-maintenance main penalosa/python-versions might be a good starting point.

Notes:

  • your PR branch should be named v3-backport-9626
  • add the skip-v3-pr label to the current PR to stop this workflow from failing

github-actions[bot] avatar Jun 17 '25 12:06 github-actions[bot]