Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 6.6 — Modern Project Tooling with uv
Python · Example 2 of 2

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.

01

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.

02

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.

03

Which files should be committed to git in a uv project, and which should not?

Explain it without notes

01

What problems does uv solve, and which older tools does it replace?

02

What is the difference between pyproject.toml and uv.lock?

03

What does uv run do that plain python does not?

04

How do you make a teammate's environment match yours exactly?

Wishes versus the lock (made-up version numbers)
Sign in to run this example in your browser.

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