Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/content/docs/workers/wrangler/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,25 @@ Any files that match `rules` will also be included as unbundled, external module

See https://developers.cloudflare.com/workers/wrangler/bundling/ for more details and examples.

### Python Workers

By default, Python Workers bundle the files and folders in `python_modules` at the root of your Worker (alongside your wrangler config file).
The files in this directory represent your vendored packages and is where the pywrangler tool copies packages into. In some cases, you
may find that the files in this folder are too large and if your worker doesn't require them then they just grow your bundle size for
no reason.

To fix this, you can exclude certain files from being included. To do this use the `python_modules_excludes` option, for example:

<WranglerConfig>

```toml title="wrangler.toml"
python_modules_excludes = ["**/*.pyc", "**/__pycache__"]
```

</WranglerConfig>

This will exclude any .pyc files and `__pycache__` directories inside any subdirectory in `python_modules`.

## Local development settings

:::note
Expand Down