2. Create a Project with uv
Managing Python projects can get complicated, because you'll need to manage different versions of Python with different dependencies.
Python comes with a built in tool called pip, but uv is a new modern tool written in Rust that's fast, and helps manage Python environments with a lot less work.
Let's create a new folder for this workshop.
Then, create an environment called learn-python with uv, and run uv sync so an virtual environment is created and automatically picked up in VS Code.
shell
mkdir -p ~/learnpy
cd ~/learnpy
uv init --python ">=3.14" learn-python
cd learn-python
uv run main.py
Now, run the autogenerated code:
shell
uv run main.py
You should see:
Text
❯ uv run main.py
Using CPython 3.14.4
Creating virtual environment at: .venv
Hello from learn-python!
Using uv
uv initcreates the project metadata, as well and inits a local git repo`uv init --python ">=3.14"specifies Python versionuv addinstalls packages and records them inpyproject.toml.- (Optional)
uv synccreates an empty venv if there isn't one already, or installs dependencies frompyproject.toml. uv runmakes sure uses project's environment instead of the system Python.
Files and directories generated with uv init or uv sync
| File | Purpose |
|---|---|
pyproject.toml |
Project metadata, Python version, and dependencies |
uv.lock |
Locked dependency graph for reproducible installs |
main.py |
Project entry point |
README.md |
Empty README |
.venv/ |
(Hidden) Python Virtual Environment created with uv sync or first uv add |
.git/ and .gitignore |
Empty Git repo, standard .gitignore for Python |
README.md |
Empty README |