Structuring Python projects properly, especially when developing packages, can often be confusing. Many developers struggle with common questions: To help clarify these common challenges, I’ll show how I typically set up Python projects and organise package structures using the Python package and environment manager, uv. The challenge A typical and recurring problem in Python is… Continue reading Case Study: Developing and Testing Python Packages with uv
Articles on Modern Python
Optimizing Python: Understanding Generator Mechanics, Expressions, and Efficiency
By Josh Engroff on 20 March 2025
Python generators provide an elegant mechanism for handling iteration, particularly for large datasets where traditional approaches may be memory-intensive. Unlike standard functions that compute and return all values at once, generators produce values on demand through the yield statement, enabling efficient memory usage and creating new possibilities for data processing workflows. Generator Function Mechanics At… Continue reading Optimizing Python: Understanding Generator Mechanics, Expressions, and Efficiency
Leveraging typing.Protocol: Faster Error Detection And Beyond Inheritance
By Bob Belderbos on 9 February 2024
Introduction Two weeks ago I wrote an article about ABCs and interface enforcement. Shortly after I learned that you can do this as well with protocols. Python 3.8 introduced quite a groundbreaking feature that further advanced the language’s capabilities in type checking: the typing.Protocol which allows Python developers to define and enforce interface contracts in… Continue reading Leveraging typing.Protocol: Faster Error Detection And Beyond Inheritance