-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Implements wrangler deploy/dev support for Python. #4896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implements wrangler deploy/dev support for Python. #4896
Conversation
🦋 Changeset detectedLatest commit: f5c8c9e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
530812b to
fe727ae
Compare
|
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7745519897/npm-package-wrangler-4896You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/4896/npm-package-wrangler-4896Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7745519897/npm-package-wrangler-4896 dev path/to/script.jsAdditional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7745519897/npm-package-create-cloudflare-4896 --no-auto-updatenpm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7745519897/npm-package-miniflare-4896npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7745519897/npm-package-cloudflare-pages-shared-4896Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
1058e74 to
c76123b
Compare
c3eb465 to
de2da45
Compare
de2da45 to
f5c8c9e
Compare
| })); | ||
| }); | ||
|
|
||
| it.only("can run and modify python worker during dev session (local)", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| it.only("can run and modify python worker during dev session (local)", async () => { | |
| it("can run and modify python worker during dev session (local)", async () => { |
| * The type of Worker | ||
| */ | ||
| export type CfScriptFormat = "modules" | "service-worker"; | ||
| export type CfScriptFormat = "modules" | "service-worker" | "python"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is quite right—a python worker should still be a modules worker, I think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it really depends what the meaning for this type is. I think differentiating module (JS) vs. modules (Python) makes sense since the code which reads these ultimately does a completely different thing depending on its value. Maybe renaming "python" to "modules-python" would be best?
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #4896 +/- ##
==========================================
+ Coverage 70.64% 70.66% +0.01%
==========================================
Files 292 292
Lines 15178 15204 +26
Branches 3860 3870 +10
==========================================
+ Hits 10723 10744 +21
- Misses 4455 4460 +5
|
|
This should probably include a default module rule mapping |
|
@penalosa can you elaborate on this? Where do I add it and what effect will it have? |
|
Closing in favour of #4901 |
What this PR solves / how to test:
This PR implements
wrangler deploy index.pyandwrangler deploy(with a wrangler.toml that definesmain = "index.py"). This means Python Workers can be deployed using Wrangler.Tested manually via:
Also using tests:
I included an e2e test for
devbut I couldn't run it locally. Other e2e tests fail locally for me too so I guess I just have something misconfigured. Help appreciated in getting it working.Author has addressed the following:
Note for PR author:
We want to celebrate and highlight awesome PR review! If you think this PR received a particularly high-caliber review, please assign it the label
highlight pr reviewso future reviewers can take inspiration and learn from it.