Skip to content

Learning

Advanced Python

Course workspace running entirely on Jupyter notebooks, with the interpreter and kernel managed by uv.

Advanced Python

Course workspace. Everything runs as Jupyter notebooks, so all you need is a Python interpreter and a kernel — both managed by uv.

Start with hello_world.ipynb to confirm your setup works.

1. Install uv

macOS / Linux

curl -LsSf https://astral.sh/uv/install.sh | sh

Windows (PowerShell)

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Or via a package manager, if you’d rather:

brew install uv          # macOS
pipx install uv          # anywhere pipx works

Restart your shell, then check it:

uv --version

2. Install Python

uv downloads and manages interpreters itself — you don’t need pyenv, Homebrew Python, or the system Python.

uv python install 3.13     # get the interpreter
uv python list             # see what's available / installed

3. Set up the project

From the repo root:

git clone https://github.com/pdfarhad/advanced_python.git
cd advanced_python

uv init --python 3.13      # creates pyproject.toml + .python-version (skip if present)
uv add jupyterlab          # notebook environment

uv add creates the virtual environment in .venv/ and writes a uv.lock on first use. Anyone cloning later can reproduce it exactly with:

uv sync

4. Open the notebooks

uv run jupyter lab

That opens JupyterLab in your browser. Pick hello_world.ipynb and run every cell (Shift+Enter, or Run → Run All Cells). If the last cell prints a green check, you’re ready for the course.

Prefer VS Code / Cursor?

Open the folder, open hello_world.ipynb, and when prompted for a kernel choose Python Environments → .venv. Install the Python and Jupyter extensions if the kernel picker doesn’t appear.

Everyday commands

Command What it does
uv run jupyter lab Launch JupyterLab in the project env
uv add <package> Add a dependency (updates pyproject.toml + uv.lock)
uv remove <package> Drop a dependency
uv sync Recreate the env exactly from uv.lock
uv run python -V Check which Python the project uses
uv run python script.py Run a script inside the project env

You never need to activate .venv manually — uv run does it for you.

Troubleshooting

uv: command not found — the installer added uv to ~/.local/bin; restart your shell, or add that directory to your PATH.

Notebook kernel won’t start — make sure JupyterLab is installed in the project (uv add jupyterlab), not globally, then relaunch with uv run jupyter lab.

Wrong Python version in the notebook — check .python-version, then re-sync:

uv python pin 3.13
uv sync

Imports fail inside a notebook that work in the terminal — you’re on the wrong kernel. Switch the kernel to the one backed by .venv.

Search posts, pages, and every course lessonesc