Use when initializing or migrating Python package management to uv, including conversion from requirements.txt to pyproject.toml and uv.lock.
requirements.txt to pyproject.toml and uv.lock.venv in the project directoryuv as the package manager for this repo..venv.pyproject.toml as the source of truth for dependencies and uv.lock for the resolved lock state.requirements.txtrequirements.txt, add its contents to the uv project:
uv add --requirements requirements.txt
pyproject.toml and uv.lock are present and correct.uv sync
requirements.txt once the uv files are committed.If you need a clean start instead of migration:
uv init --bare .
uv add fastapi uvicorn
uv sync
requirements.txt and pyproject.toml as competing sources of truth.# Initialize a bare uv project in the current directory
uv init --bare .
# Create a local virtual environment in the repo root
uv venv .venv
# Migrate an existing requirements.txt file into uv metadata
uv add --requirements requirements.txt
# Sync the repo environment from pyproject.toml + uv.lock
uv sync
# Run tests through uv without activating the venv manually
uv run pytest tests -q
pyproject.tomluv.lockREADME.md.github/workflows/run-tests.yml