Python
Automation, CLI tooling, packaging and scripting for operations.
Python articles
pytest Fixtures and parametrize
Fixtures give tests their setup; parametrize runs one test over many inputs. Here's scope, composition, conftest.py, and the parametrize patterns that matter.
October 24, 2026Profiling Python Code
Don't guess at what's slow — measure. cProfile for a script, py-spy for a live process, memray for memory. Here's how to run each and read the output.
October 24, 2026Parsing Config Files Safely in Python
yaml.load can execute arbitrary code; tomllib is in the stdlib now. Here's how to load, layer, and validate configuration without surprises.
October 24, 2026virtualenv vs venv vs uv: Python Environments in 2026
venv ships with Python and is fine; uv is faster and does lockfiles and Python-version management too. Here's what each does and a modern default.
October 24, 2026subprocess Without Shell Injection
The single rule that prevents command injection in Python: pass a list, never a string, and never shell=True with untrusted input.
October 24, 2026Python Logging Configuration That Doesn't Hurt
Python's logging module is fine once you stop fighting it: configure once at the entry point, let libraries just call getLogger, and use dictConfig.
October 24, 2026Packaging a Python CLI
Turn a script into a `pip install`-able command: the pyproject.toml, the entry point, the src layout, and how users should install it.
October 24, 2026Python Type Hints That Actually Pay Off
Type hints earn their keep at function boundaries and data models. Here's a pragmatic subset, a CI setup, and how to adopt them on an untyped codebase.
October 24, 2026asyncio for I/O-Bound Scripts
Async Python shines for hundreds of concurrent network calls and nothing else. Here's a correct pattern for a bulk-fetch script, with concurrency limits and error handling.
October 24, 2026argparse Patterns for Real CLI Tools
The argparse recipes that cover most operational scripts: subcommands, env defaults, parent parsers, and exit codes.
October 24, 2026