feat(arcade-cli): deploy Cloudflare Python (Pyodide) workers (PLT-2154)#883
Closed
pmdroid wants to merge 1 commit into
Closed
feat(arcade-cli): deploy Cloudflare Python (Pyodide) workers (PLT-2154)#883pmdroid wants to merge 1 commit into
pmdroid wants to merge 1 commit into
Conversation
Add a --runtime python path to `arcade deploy` that ships a Cloudflare Python worker to the engine. When set, the CLI packages the worker directory as a zip (create_zip_archive, paths relative to the project root so a .py entrypoint resolves), sends CreateDeploymentRequest with host=cloudflare + runtime=python and the .py entrypoint, and skips local CPython validation (a Pyodide worker can't run there) — so --server-name/--server-version are required. The default (--runtime auto) keeps the tar.gz + validate + Porter behavior byte-for-byte (host/runtime sent only via model_dump(exclude_none=True)). Pairs with the engine side (PLT-2153), whose JSON /deployments path already routes by host/runtime and detects Python from the bundle entrypoint.
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the client side of Cloudflare Python (Pyodide) worker deployment. Tracked by PLT-2154.
What's here
A new
--runtime pythonpath onarcade deploy:create_zip_archive) instead of tar.gz. Entries are stored relative to the project root (no top-level dir), so a--entrypoint src/worker.pyresolves inside the archive. The engine detects a Python worker by the zip container and uploads each file as its own Worker module.host=cloudflare+runtime=pythononCreateDeploymentRequest, with the bundleentrypointset to the.pymain module.worker.py(from workers import WorkerEntrypoint) can't run under plain CPython, so the usual "start the server and hit/worker/health" step would always fail.--runtime pythontherefore requires--server-name/--server-version, like--skip-validate.The default (
--runtime auto) is unchanged: tar.gz + local validation + the existing Porter path.host/runtimeare sent only viamodel_dump(exclude_none=True), so the default payload is byte-for-byte identical.# From a Cloudflare Python worker dir (after `pywrangler sync` vendors python_modules/): arcade deploy --runtime python -e src/worker.py --server-name my-worker --server-version 1.0.0Why no engine change here
The engine's JSON
/deploymentscreate path already routes byhost/runtimeand detects Python from the bundle's.pyentrypoint (PLT-2153), so the CLI only needs to produce the right request + zip.Testing
ruff format/ruff check/mypyclean;libs/tests/cli/deploy/test_deploy.pypasses (30 tests). New tests cover the zip archive (relative paths, exclusions, zip magic), the request model (host/runtime omitted by default, included for Cloudflare), and the end-to-enddeploy_server_logicPython path (zips, skips validation, sendshost=cloudflare/runtime=pythonwith the.pyentrypoint). Bumpedarcade-mcpto 1.16.0.Out of scope / follow-ups
wrangler.jsonc(explicit--runtime pythonfor now).python_modules(the user runspywrangler syncfirst; the CLI zips what's present).🐕 Written by Kyoto, an AI agent, on Pascal's behalf —
Note
Medium Risk
New deploy routing and packaging path affects engine integration; default deploy behavior is preserved via exclude_none, but misconfigured Cloudflare deploys could fail at runtime without local validation catching issues.
Overview
Adds
arcade deploy --runtime pythonfor Cloudflare Python (Pyodide) workers, alongside the unchanged defaultautopath (tar.gz + local validation).For
python, the CLI builds a zip with flat paths (via newcreate_zip_archive), skips local health/metadata validation, and on create sendshost=cloudflareandruntime=pythonusingmodel_dump(exclude_none=True)so default deploy payloads stay the same. Tar.gz packaging now shares exclusion logic through_is_excluded_archive_path.main.pyrequires--server-name/--server-versionwhen using--runtime python(same as--skip-validate) and treatssecrets autoasskipin that case. Tests cover zip packaging, request fields, and the end-to-end Cloudflare deploy path;arcade-mcpis bumped to 1.16.0.Reviewed by Cursor Bugbot for commit b11820b. Bugbot is set up for automated code reviews on this repo. Configure here.