Creating a new project
Let’s create a real project with uv:The
.venv folder and uv.lock file are created automatically when you first run uv add to install packages.Understanding pyproject.toml
This is your project’s configuration file:requirements.txtsetup.pysetup.cfg- Multiple config files
Adding packages
Add packages withuv add:
pyproject.toml updates automatically:
The lock file
uv createsuv.lock - this locks exact versions:
Running your code
Three ways to run Python with uv:Common uv commands
Working with existing projects
Got a project withrequirements.txt? No problem:
Virtual environment details
uv creates.venv automatically when you add packages:
- Created on first
uv addcommand - No activation needed with
uv run - Always in project directory
- Works with VS Code automatically
- Already in
.gitignore(uv adds it)
Tips and tricks
-
Global tools: Install tools globally with uv
-
Python versions: uv can manage Python too
-
Scripts: Add custom commands
What’s next?
Ready to put it all together? Check out the complete project workflow!Complete workflow
Start-to-finish project guide