litellm - 💡(How to fix) Fix Docs: Clear guide for testing local code changes in Docker (UI + backend) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#25362Fetched 2026-04-09 07:52:32
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Root Cause

The official image installs litellm from a wheel (/app/litellm-*.whl) into site-packages, but the package root resolves to /app/litellm/ because Python uses the working directory (/app) as the first entry in sys.path. This makes it non-obvious which path to target with volume mounts, and the behavior differs from a standard pip install layout.

RAW_BUFFERClick to expand / collapse

Feature Request

What is the motivation / use case for this feature?

When developing and testing local code fixes (e.g. a one-line bug fix in litellm/main.py or a UI change), it's very unclear how to get those changes running inside the official Docker image without a full rebuild.

The current documentation doesn't cover:

  1. How to mount local Python source files into a running container so changes take effect without rebuilding the image
  2. Whether to mount into /app/litellm/ or /usr/lib/python3.13/site-packages/litellm/ (they differ depending on how the image was built)
  3. How .pyc bytecode caching interacts with volume mounts (stale bytecode can silently mask file changes)
  4. How to rebuild and mount the Next.js UI build into the container
  5. The correct PYTHONDONTWRITEBYTECODE=1 flag and when it's needed
  6. How to run prisma migrate inside the container for schema changes

What is your proposed solution?

Add a "Local Development with Docker" section to the docs that covers:

  • Dockerfile structure: where litellm is installed (/app/litellm/ vs site-packages)
  • Volume-mounting individual .py files for quick iteration (with caveats about __pycache__)
  • Building a full local image with docker build for deeper testing
  • UI development: how to build the Next.js dashboard and serve it from the container
  • Common pitfalls (bytecode caching, migration drift, import path resolution)

Additional context

The official image installs litellm from a wheel (/app/litellm-*.whl) into site-packages, but the package root resolves to /app/litellm/ because Python uses the working directory (/app) as the first entry in sys.path. This makes it non-obvious which path to target with volume mounts, and the behavior differs from a standard pip install layout.

This causes significant friction when trying to test a simple bug fix locally before opening a PR.

extent analysis

TL;DR

Mounting local Python source files into a running container and understanding the interaction with bytecode caching can help resolve the issue.

Guidance

  • To mount local Python source files, consider using the -v flag with Docker run, targeting the correct path (either /app/litellm/ or /usr/lib/python3.13/site-packages/litellm/) based on the image build process.
  • Be aware of the difference in behavior between installing from a wheel versus a standard pip install layout, and how this affects volume mounts.
  • Use the PYTHONDONTWRITEBYTECODE=1 flag to prevent bytecode caching from masking file changes when using volume mounts.
  • Consider adding a "Local Development with Docker" section to the documentation to cover these topics and provide clarity for developers.

Example

docker run -v /local/path/to/litellm:/app/litellm -e PYTHONDONTWRITEBYTECODE=1 myimage

This example mounts the local litellm directory into the container at /app/litellm and prevents bytecode caching.

Notes

The exact solution may depend on the specific Docker image build process and the desired development workflow. The proposed documentation addition can help clarify these details for developers.

Recommendation

Apply a workaround by using volume mounts and the PYTHONDONTWRITEBYTECODE=1 flag to test local changes without rebuilding the image, and consider adding documentation to cover these topics for future reference.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING