← All insightsAutomation

Automating Python for DevOps from scratch

CodeWizard Academy · 5 February 2026 · 3 min read · Intermediate

Anything you do to Python for DevOps twice should be automated. This walks the path from a manual install to a repeatable, pipeline-driven setup.

1. Install it reproducibly

bash
python3 -m venv .venv && source .venv/bin/activate
pip install --upgrade pip
pip install requests boto3

2. Describe the desired state

A small, robust API client with retries.

python
import requests
from requests.adapters import HTTPAdapter, Retry

s = requests.Session()
s.mount('https://', HTTPAdapter(max_retries=Retry(total=3, backoff_factor=0.5,
         status_forcelist=[502, 503, 504])))
r = s.get('https://api.example.com/health', timeout=5)
r.raise_for_status()
print(r.json())

3. Run it from CI

Lint, type-check and test in CI.

yaml
- uses: actions/setup-python@v5
  with: { python-version: '3.12', cache: pip }
- run: pip install -r requirements.txt ruff mypy pytest
- run: ruff check . && mypy . && pytest -q

Want senior help putting Python for DevOps to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.

Like where this is going?

Get hands-on help from the engineers who write these posts.

Book a free consult