Exercise py-08 — a tiny package someone else can install

You have written chunk, repair_json, retry and timed three times across Days 2–5, each one living inside its own exercise folder. This is the day they become a package: a pyproject.toml, the src/ layout, a console entry point, a py.typed marker, and a wheel that installs on a machine which has never seen your repository. Everything you ship after this — flagship F1's RAG service included — is this shape with more code in it. It runs on your Mac, not in the browser: it builds a real wheel and a real virtual environment, which Pyodide cannot do.

~2 hruns locally · uv + pytest 8 checkspy-08-tiny-package

What you're building

src/llmutils/__init__.py is provided: it re-exports the four functions and reads __version__ from importlib.metadata — the installed distribution's metadata, not a second copy of the number. Read the pyproject.toml too: the build backend, the src/ layout, the entry point and the two tool sections are the artifact this exercise is really about.

The tests are ordinary pytest and ship in the public folder with the starter — read them first; the names below are the check list. Solutions are not published.

Get the repo (once)

Needs git. uv installs the right Python itself, so nothing else is required.

# once, anywhere on your machine
git clone https://github.com/theDocWho/ai-ml-roadmap.git
cd ai-ml-roadmap

No git? Download the ZIP, unzip it, and cd into the unzipped folder instead.

Run it

From the repo root:

# one-time: uv (https://docs.astral.sh/uv/) manages the venv and pins Python ≥ 3.12
cd exercises/py-08-tiny-package && uv sync && uv run pytest -q -m ''

# the same bar the reference solution clears
uv run ruff check . && uv run mypy --strict src && uv run python -m build --wheel

Done when uv run pytest -q -m '' prints 8 passed. Plain uv run pytest -q runs the five fast checks; -m '' clears the -m 'not slow' in addopts and adds the three that build a real wheel and a throwaway venv (about 15 s). The untouched starter fails all eight — including ruff (the imports it hands you are unused until you use them) and mypy (a ... body is [empty-body] in strict mode).

The checks

Files

This is self-attestation — the site cannot see your terminal, so the box and the button are you telling The Path the suite went green on your machine.

If you get stuck