-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Summary
Summary
When switching extras with uv sync (or uv tool install), packages that provide conflicting files (like typer and typer-slim) can corrupt the venv. Installing typer-slim overwrites typer's files, and uninstalling typer-slim deletes them—leaving uv's metadata incorrectly showing typer as installed while the actual files are gone.
Reproduction
I created a repo with the repro example: https://github.com/pimlock/uv-bug-repro
When this happened in my workflow, the dependency tree was more complex, the base package depended on typer and one of deps defined in extra had typer-slim as a dep few levels deep.
Here's the verbose output when running all the commands with the spot where the "issue" happens being highlighted
Commands:
git clone https://github.com/pimlock/uv-bug-repro
cd uv-bug-repro
uv sync # ✓ works
uv sync --extra extra1 # ✓ works
uv sync --extra extra2 # ✗ ModuleNotFoundError: No module named 'typer'
The package has:
- Base dependency: typer>=0.20.0
- extra1: typer-slim>=0.20.0
- extra2: rich>=13.0.0 (note: what deps extra2 has is irrelevant for this issue)
What happens
uv syncinstalls typer (which doesn't depend ontyper-slim)uv sync --extra extra1addstyper-slimuv sync --extra extra2removestyper-slim, but because they "contribute" the same module in venv, thetyper's files get removed as well.
This issue is likely caused by how typer and typer-slim are set up (i.e. typer doesn't depend on typer-slim), but it may be potentially causing similar issues with other packages (AFAIK pydantic uses the -slim pattern, but in a different way).
- typer requires: click, typing-extensions, shellingham, rich
- typer-slim requires: click, typing-extensions
They conflict because they both install files to the same typer/ directory. So here's what's happening:
- Step 1:
typerinstalled → typer/ directory created - Step 2:
typer-sliminstalled → overwrites typer/ directory - Step 3:
typer-slimuninstalled → deletes typer/ directory
Expected
Base dependency typer>=0.20.0 should always be installed regardless of which extras are selected.
Workaround
uv sync --extra extra2 --reinstall works correctly.
Platform
Darwin 25.2.0 arm64
Version
uv 0.9.26 (ee4f003 2026-01-15)
Python version
CPython 3.14.0