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
python3 -m venv .venv && source .venv/bin/activate
pip install --upgrade pip
pip install requests boto32. Describe the desired state
A small, robust API client with retries.
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.
- 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 -qWant 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.