PythonNexus RoadmapCLIpytestPhase 1
Week 1 on the Nexus Roadmap: Building a Python CLI from Scratch
5 min read
# Week 1: Python CLI from Scratch
## What I Built
A unit converter CLI with argparse, rich for colour-coded output, and a README with 10 manual test cases documented.
## Key Learnings
**Type hints are not optional.** Running `mypy --strict` on week-one code gave me 14 errors. Fixed in 45 minutes. Now every function signature starts with types.
**Decorators are just functions returning functions.** Building `@retry(n, exceptions)` from scratch finally made this concrete. The `@timer` decorator I wrote lives in the `utils` package and will be pulled into every project for the next 26 months.
**pytest parametrize is underused.** Eight test cases for the converter — one `@pytest.mark.parametrize` block. Before this I was writing eight separate functions.
## The Nexus Connection
Everything lives at `nexus/tools/unit_converter.py`. The `@retry` utility gets imported directly into Phase 4 LLM API wrappers — LLM APIs fail transiently and retry logic is the first line of defence.
## Next Week
OOP deep-dive: a Library Catalogue with `__dunder__` methods, mixins, and serialisation — the same patterns that appear in PyTorch `nn.Module` and scikit-learn estimators.
*All code at [github.com/ambooka/nexus](https://github.com/ambooka/nexus)*
## What I Built
A unit converter CLI with argparse, rich for colour-coded output, and a README with 10 manual test cases documented.
## Key Learnings
**Type hints are not optional.** Running `mypy --strict` on week-one code gave me 14 errors. Fixed in 45 minutes. Now every function signature starts with types.
**Decorators are just functions returning functions.** Building `@retry(n, exceptions)` from scratch finally made this concrete. The `@timer` decorator I wrote lives in the `utils` package and will be pulled into every project for the next 26 months.
**pytest parametrize is underused.** Eight test cases for the converter — one `@pytest.mark.parametrize` block. Before this I was writing eight separate functions.
## The Nexus Connection
Everything lives at `nexus/tools/unit_converter.py`. The `@retry` utility gets imported directly into Phase 4 LLM API wrappers — LLM APIs fail transiently and retry logic is the first line of defence.
## Next Week
OOP deep-dive: a Library Catalogue with `__dunder__` methods, mixins, and serialisation — the same patterns that appear in PyTorch `nn.Module` and scikit-learn estimators.
*All code at [github.com/ambooka/nexus](https://github.com/ambooka/nexus)*