Skip to content
5 min read·Lesson 10 of 10

The Python DevOps Toolbelt

A curated map of the Python libraries you reach for in DevOps and cloud work — and when to pick each one.

You've now seen the building blocks. This last lesson is a map of the Python ecosystem as it actually appears in DevOps and cloud teams — what to install, what to reach for, and what to read next.

Core: The Daily Tools

NeedLibrary
HTTP callsrequests (sync), httpx (sync + async)
AWS SDKboto3 + botocore; aiobotocore for async
Azure SDKazure-identity + azure-mgmt-* + azure-storage-*
GCP SDKgoogle-cloud-* per service, google-auth
YAMLpyyaml (use safe_load)
TOMLtomllib (3.11+ stdlib), tomli-w for writing
JSON Schemajsonschema
CLIargparse (stdlib), click, typer
Config / settingspydantic-settings, dynaconf
Data validationpydantic v2
Retriestenacity
Templatingjinja2
Date/timedatetime (stdlib), dateutil, pendulum

Testing and Quality

Test runnerpytest + pytest-cov
Mock AWSmoto
HTTP mockingresponses, respx (httpx)
Fake filesystempyfakefs
Property-basedhypothesis
Linter / formatterruff
Type checkermypy or pyright
Securitybandit, pip-audit, safety

Infrastructure as Code (in Python)

  • Pulumi — multi-cloud IaC; write infrastructure in real Python (or TS, Go, .NET)
  • AWS CDK — high-level Python constructs that synthesise CloudFormation
  • Troposphere — generate CloudFormation templates from Python
  • cdktf — CDK for Terraform
  • Ansible — agentless orchestration; modules are written in Python; playbooks in YAML
  • SaltStack — Python-based config management at scale

Containers and Kubernetes

  • kubernetes (official client) — the Kubernetes API in Python
  • docker — manage local Docker daemon programmatically
  • kopf — write Kubernetes operators in Python without Go
  • pyhelm — programmatically render and install Helm charts

Data and Observability

  • pandas — tabular data; great for one-off analytics and CSV/Parquet manipulation
  • polars — much faster pandas alternative
  • duckdb — in-process analytical SQL on Parquet/CSV; perfect for log analysis
  • opentelemetry — vendor-neutral traces, metrics, logs
  • prometheus_client — expose Prometheus metrics from a Python app
  • structlog — structured logging

Web Frameworks (when your tool grows a UI/API)

  • FastAPI — async, type-driven, auto-generated OpenAPI; the modern default
  • Flask — minimal, ubiquitous, sync-first
  • Django — full-stack with ORM, admin, auth — overkill for tiny APIs
  • Starlette — async toolkit underneath FastAPI

Background Work

  • Celery — battle-tested distributed task queue, broker-based
  • RQ — simpler Redis-based queue
  • Dramatiq — modern Celery alternative
  • APScheduler — in-process job scheduling (cron-like)
  • Temporal Python SDK — durable workflows

Workflow / Pipelines

  • Apache Airflow — orchestrate batch pipelines; DAGs written in Python
  • Dagster — modern data orchestrator with stronger typing
  • Prefect — Pythonic flow framework, hybrid execution
  • Luigi — Spotify's older but still useful pipeline tool

Distribution Choices

FormWhen
Plain script + venvInternal scripts run by humans
pipx-installable wheelCLI tool used across many machines
Docker imageAnything running in production / Lambda containers / Cloud Run / Kubernetes
PyInstaller / Nuitka binarySingle executable for users without Python
Lambda layer / Lambda functionEvent-driven cloud automation

When Python Isn't the Right Tool

Use the right language. Python is the wrong choice for:

  • One-line shell pipelines — bash is fine
  • High-throughput services with strict latency targets — Go, Rust, or Java are usually better
  • Single-binary CLIs distributed to end users without Python — Go ships easier
  • Tight loops processing GB of data — drop into numpy/polars/duckdb, or use a faster language for that hot section

What to Read Next

  • The official docs — better than people give them credit for
  • Fluent Python by Luciano Ramalho — the deep dive into the language
  • Effective Python by Brett Slatkin — 90 highly practical patterns
  • Real Python tutorials and the Python Bytes podcast
  • PEPs — read the ones that introduce features you use (PEP 8 style, PEP 484 type hints, PEP 585 generics, PEP 621 pyproject)
  • Read source code of well-built tools: requests, click, fastapi, pydantic, boto3, ansible. The best way to level up.

You're Done

You've now got the toolkit to write Python that automates real cloud infrastructure: scripts that read config, call APIs concurrently, log structured output, retry on transient errors, are tested, packaged, and shippable. The rest is repetition — pick a small problem at work, write a Python tool for it, and refine.

Key Takeaways

  • Python sits at the centre of cloud automation, infra-as-code (Pulumi, CDK), and orchestration tooling.
  • Master a small set of libraries deeply rather than dabbling in many.
  • Stay current with ruff, uv, pydantic, and httpx — the modern fast-moving core.
  • Use the right tool: bash for one-liners, Python for anything stateful, Go/Rust when performance matters.
  • Read other peoples codebases — Ansible, MoltenAWS, Pulumi, Boto3 are excellent learning resources.
🎉

Course Complete!

You've finished Python for DevOps and Cloud. Now put your knowledge to the test with real exam-style practice questions.