diff --git a/src/content/docs/workers/wrangler/configuration.mdx b/src/content/docs/workers/wrangler/configuration.mdx index 31d4bd437d52b8..54b611c5c6c952 100644 --- a/src/content/docs/workers/wrangler/configuration.mdx +++ b/src/content/docs/workers/wrangler/configuration.mdx @@ -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: + + + +```toml title="wrangler.toml" +python_modules_excludes = ["**/*.pyc", "**/__pycache__"] +``` + + + +This will exclude any .pyc files and `__pycache__` directories inside any subdirectory in `python_modules`. + ## Local development settings :::note