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

Fundamentals

Variables, types, operators, control flow

Beginner

Data Structures

Lists, dicts, sets, tuples, comprehensions

Beginner

Functions

Definitions, args, closures, decorators

Intermediate

Object-Oriented

Classes, inheritance, magic methods, dataclasses

Intermediate

Modules & Packages

Imports, packages, pyproject.toml, uv

Intermediate

File I/O

Reading, writing, paths, JSON/YAML

Intermediate

CLI Development

Click, arguments, options, Rich output

Advanced

HTTP & APIs

requests, httpx, REST patterns, auth

Advanced

Async Programming

asyncio, aiohttp, concurrent patterns

Advanced

Testing

pytest, fixtures, mocking, coverage

Advanced

Infrastructure Patterns

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