TipReview Chapters 1 to 4
NoteWhole Game (Chapter 1)
The Whole Game chapter ran through the entire app-package workflow in one pass, using the Old Faithful app:
- Creating the project with
uv init --packageand editing the metadata inpyproject.toml - Moving
app.pyinto thesrc/pyap/import package - Adding dependencies with
uv addand installing the package in editable mode - Moving code into documented functions and testing them with
pytest - Adding a launch function and registering it under
[project.scripts] - Building the package with
uv build, writing aREADME.md, and committing to Git
NoteShiny for Python (Chapter 2)
The Shiny for Python chapter set up a virtual environment and built the app we use for the rest of the book, one branch at a time:
02.1_shiny-app: the Core API (a UI object, aserver()function with@renderoutputs, andApp())02.2_movies-app: the movies app, with inputs, data frommovies.csv, ascatter_plot()utility function,@reactive.calc, and@reactive.event()02.3_proj-app: arequirements.txtfile and shared editor settings in.vscode/settings.json
NotePython Packages (Chapter 3)
The Python Packages chapter separated modules, import packages, and distributions, walked through the tables in pyproject.toml, and turned the movies app into a package:
03.1_pyproject: a hand writtenpyproject.tomlreplacedrequirements.txt03.2_uv:uv python pinanduv synccreated.python-version,.venv/, anduv.lock(withpyapas a non-package project)03.3_create-package: a[build-system]table withuv_build, code insrc/pyap/, and package imports madepyapinstallable in editable mode
NoteDevelopment Workflow (Chapter 4)
The Development Workflow chapter used the 04_dev branch to sort changes by what they require:
- No action: edits to code in
src/pyap/(the editable install andshiny run --reloadpick them up) - A sync: changes to dependencies or metadata (
uv add,uv remove, hand edits topyproject.toml, or switching branches) - A restart: code the Python console has already imported, and data the app reads at startup
It also covered uv run versus an activated .venv/, running tests with uv run pytest, and pointing Positron at the project environment.