Skip to content

Commit 0548c93

Browse files
committed
Adds docs for python_module_excludes.
1 parent c6639da commit 0548c93

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/content/docs/workers/wrangler/configuration.mdx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ The following options are available:
992992
- To specify a custom instance type, see [here](#custom-instance-types).
993993

994994
- `max_instances` <Type text="string" /> <MetaInfo text="optional" />
995-
- The maximum number of concurrent container instances you want to run at any given moment. Stopped containers do not count towards this - you may have more container instances than this number overall, but only this many actively running containers at once. If a request to start a container will exceed this limit, that request will error.
995+
- The maximum number of concurrent container instances you want to run at any given moment. Stopped containers do not count towards this - you may have more container instances than this number overall, but only this many actively running containers at once. If a request to start a container will exceed this limit, that request will error.
996996

997997
- Defaults to 20.
998998

@@ -1128,6 +1128,28 @@ Any files that match `rules` will also be included as unbundled, external module
11281128

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

1131+
### Python Workers
1132+
1133+
By default, Python Workers bundle the files and folders in `python_modules` at the root of your Worker (alongside your wrangler config file).
1134+
The files in this directory represent your vendored packages and is where the pywrangler tool copies packages into. In some cases, you
1135+
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
1136+
no reason.
1137+
1138+
To fix this, you can exclude certain files from being included. To do this use the `python_modules.excludes` option, for example:
1139+
1140+
<WranglerConfig>
1141+
1142+
```toml title="wrangler.toml"
1143+
[python_modules]
1144+
excludes = ["**/*.pyc", "**/__pycache__"]
1145+
```
1146+
1147+
</WranglerConfig>
1148+
1149+
This will exclude any .pyc files and `__pycache__` directories inside any subdirectory in `python_modules`.
1150+
1151+
By default, `python_modules.excludes` is set to `["**/*.pyc"]`, so be sure to include this when setting it to a different value.
1152+
11311153
## Local development settings
11321154

11331155
:::note

0 commit comments

Comments
 (0)