Python Mastery
Python is the backbone of infrastructure automation. Master it from basics to building production CLIs like netapi.
Why Python Matters
| Domain | Applications |
|---|---|
Infrastructure Automation |
netapi, Ansible, Terraform providers, cloud SDKs |
API Development |
FastAPI, Flask, REST clients, webhook handlers |
CLI Tools |
Click, Typer, Rich for professional interfaces |
Data Processing |
pandas, JSON/YAML parsing, log analysis |
Security |
cryptography, certificate handling, secrets management |
Testing |
pytest, mocking, integration testing |
Curriculum
| Module | Description | Level |
|---|---|---|
Variables, types, operators, control flow |
Beginner |
|
Lists, dicts, sets, tuples, comprehensions |
Beginner |
|
Definitions, args, closures, decorators |
Intermediate |
|
Classes, inheritance, magic methods, dataclasses |
Intermediate |
|
Imports, packages, pyproject.toml, uv |
Intermediate |
|
Reading, writing, paths, JSON/YAML |
Intermediate |
|
Click, arguments, options, Rich output |
Advanced |
|
requests, httpx, REST patterns, auth |
Advanced |
|
asyncio, aiohttp, concurrent patterns |
Advanced |
|
pytest, fixtures, mocking, coverage |
Advanced |
|
Real-world patterns from netapi |
Reference |
Quick Reference
Running Python
# REPL
python3
# Run script
python3 script.py
# Run module
python3 -m module_name
# With uv (preferred)
uv run python script.py
uv run pytest
Project Setup
# Create project with uv
uv init my-project
cd my-project
# Add dependencies
uv add click rich httpx
# Add dev dependencies
uv add --dev pytest pytest-cov
# Run
uv run python -m my_project
Projects
| Project | Description | Status |
|---|---|---|
netapi |
Infrastructure automation CLI (ISE, Vault, WLC, Wazuh) |
Active |
domus-cli |
Home enterprise management |
Planning |