cloudflare / cloudflare/workers-py

When deploying a python worker from a directory that has a `.venv`, it also gets uploaded into the work

Open
#92 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
103
Forks
22
Avg merge
2d 1h
Merged PRs (30d)
30

Description

### What versions & operating system are you using?

System:
OS: macOS 15.7.4
CPU: (14) arm64 Apple M3 Max
Memory: 711.94 MB / 96.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.20.0 - /Users/adamgs/.local/state/fnm_multishells/99190_1776451940127/bin/node
npm: 10.9.3 - /Users/adamgs/.local/state/fnm_multishells/99190_1776451940127/bin/npm
pnpm: 10.15.1 - /Users/adamgs/Library/pnpm/pnpm
bun: 1.3.10 - /Users/adamgs/.bun/bin/bun

pywrangler 1.9.2

### Please provide a link to a minimal reproduction

https://github.com/AdamGS/cloudflare-repro

### Describe the Bug

If I run `uv sync` (for example - in order to pull dev dependencies), the virtual env that `uv` creates ends up in worker, making it both much larger than it needs to be and potentially uploading really wasteful stuff (like linters).

This is much more easily triggered in the free tier with the lower size limit on workers.

### Please provide any relevant error logs

For a worker that fails to build, I end up seeing stuff like the following:
```
─┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/progress.py │ python │ 58.98 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/progress_bar.py │ python │ 7.97 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/prompt.py │ python │ 12.16 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/protocol.py │ python │ 1.32 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/region.py │ python │ 0.16 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/repr.py │ python │ 4.33 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/rule.py │ python │ 4.48 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/scope.py │ python │ 3.16 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/screen.py │ python │ 1.54 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/segment.py │ python │ 25.14 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/spinner.py │ python │ 4.12 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/status.py │ python │ 4.32 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/style.py │ python │ 26.43 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/styled.py │ python │ 1.21 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/syntax.py │ python │ 35.45 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/table.py │ python │ 39.09 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/terminal_theme.py │ python │ 3.29 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/text.py │ python │ 46.54 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/theme.py │ python │ 3.69 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/themes.py │ python │ 0.10 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/traceback.py │ python │ 36.66 KiB │
├──────────────────────────────────────────────────────────────────────────────────────┼───────────────┼──────────────┤
│ .venv/lib/python3.12/site-packages/rich/tree.py │ python │ 9.17 KiB │
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.