Wishes versus the lock (made-up version numbers)
A model of why two files exist. wishes plays the part of pyproject.toml, the dictionary plays the part of uv.lock, and every version number here is invented for teaching.
uv is one fast tool that replaces pip, venv, pyenv and pipx: it creates projects, installs the right Python, adds dependencies, writes an exact uv.lock, and runs your code in the project's environment.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 5 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Write the uv commands, one per line, to create a project called chatbot, move into its folder, add the package httpx, and run main.py.
In pyproject.toml, which section holds the packages needed at run time? Write a small [project] example with the name chatbot that needs httpx version 0.28 or newer.
Which files should be committed to git in a uv project, and which should not?
Explain it without notes
What problems does uv solve, and which older tools does it replace?
What is the difference between pyproject.toml and uv.lock?
What does uv run do that plain python does not?
How do you make a teammate's environment match yours exactly?
Expected output
you asked for: ['httpx', 'pydantic']
the lock file pins: 4 packages
anyio 4.9.0 pulled in by another package
httpx 0.28.1 direct
idna 3.10 pulled in by another package
pydantic 2.12.0 direct