Skip to content

Commit

Permalink
Add python support for remote dev (#5119)
Browse files Browse the repository at this point in the history
* Add python support for remote dev

* adapt sourceURL to support Python entry points

* run prettier

* small fixes
  • Loading branch information
garrettgu10 authored Mar 4, 2024
1 parent 9d1d11c commit b0bd413
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/kind-ducks-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": minor
---

feature: Python support for remote dev
4 changes: 3 additions & 1 deletion packages/wrangler/src/deployment-bundle/source-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export function withSourceURLs(
modules: CfModule[]
): { entrypointSource: string; modules: CfModule[] } {
let entrypointSource = fs.readFileSync(entrypointPath, "utf8");
entrypointSource = withSourceURL(entrypointSource, entrypointPath);
if (!entrypointPath.endsWith(".py")) {
entrypointSource = withSourceURL(entrypointSource, entrypointPath);
}

modules = modules.map((module) => {
if (
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/dev/remote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ async function createRemoteWorkerInit(props: {
main: {
name: path.basename(props.bundle.path),
filePath: props.bundle.path,
type: getBundleType(props.format),
type: getBundleType(props.format, path.basename(props.bundle.path)),
content,
},
modules,
Expand Down

0 comments on commit b0bd413

Please sign in to comment.