Python
Notes on the Python programming language — testing, async, type hints, and practical patterns.
Accelerate Django bulk_update operations by 4x using multiprocessing to parallelize database writes across chunked record batches.
Manage multiple Python versions on macOS using asdf, a unified version manager replacing pyenv, nvm, and language-specific tools.
Optimize Django model saves with update_fields parameter to generate leaner SQL queries and improve performance in tight update loops.
Configure Python logging for AWS Lambda's pre-configured handlers while maintaining compatibility with local development environments.
Learn from a production outage caused by loading large CSV files into memory. Stream process files to prevent OOM errors and crashes.
Secure webhooks by verifying payload authenticity using HMAC hash signatures with shared secrets, preventing man-in-the-middle attacks.
Practical SQLite recipes for Python: execute statements, batch operations, transactions, row factories, and context managers with sqlite3.
Use Python's urlsplit instead of urlparse for faster URL parsing by skipping the rarely-needed params component in URL decomposition.
Master Python's ExitStack for managing multiple context managers, conditional callbacks, request rollbacks, and avoiding nested with statements.
Combine session and function-scoped pytest fixtures to avoid expensive test setup while maintaining test isolation and preventing state coupling.
Master Python mocking: patch objects at their import location, not where they're defined, to avoid common unittest.mock pitfalls.
Assert specific mock call arguments while ignoring others using unittest.mock.ANY for flexible test assertions without brittle checks.
Use Python assert statements to apply runtime constraints more succinctly than raising ValueError. Learn the trade-offs and best practices.
Process large CSV files without OOM errors by streaming content line-by-line with HTTPX and concurrent.futures for parallel processing.
Speed up Django bulk operations with ProcessPoolExecutor while preserving signals and hooks that bulk_create/bulk_update bypass.