# piglei/one-python-craftsman

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/piglei-one-python-craftsman).**

7,211 stars · 987 forks · Apache-2.0

## Links

- GitHub: https://github.com/piglei/one-python-craftsman
- Homepage: https://www.piglei.com
- awesome-repositories: https://awesome-repositories.com/repository/piglei-one-python-craftsman.md

## Topics

`articles` `book` `python` `python3`

## Description

This project is a comprehensive Python coding guide and software engineering resource focused on professional development practices. It provides a detailed collection of idiomatic techniques, design patterns, and architectural strategies to improve code quality and maintainability.

The guide emphasizes advanced design patterns such as dependency injection, data-driven design, and the application of SOLID principles for object-oriented design. It distinguishes itself by covering sophisticated structural strategies, including class-based decorators, the separation of interfaces from implementations, and the use of data-driven logic externalization to modify program behavior without altering source code.

The resource covers a broad surface of capability areas, including performance optimization through efficient iterator patterns and container selection, robust error handling via the EAFP philosophy, and the construction of decoupled data pipelines using generators. It also details code quality standards regarding naming conventions, type annotations, and variable scope management.

The content provides guidance on language internals, ranging from magic method implementation and assignment expressions to memory-efficient file streaming and block-based reading.

## Tags

### Programming Languages & Runtimes

- [Idiomatic Patterns](https://awesome-repositories.com/f/programming-languages-runtimes/python-language-features/idiomatic-patterns.md) — A comprehensive guide to Python-specific coding patterns and idiomatic conventions that improve professional code quality.
- [Python Language Features](https://awesome-repositories.com/f/programming-languages-runtimes/python-language-features.md) — Covers fundamental Python syntax, internal object models, and core language features.
- [Type Annotations](https://awesome-repositories.com/f/programming-languages-runtimes/type-annotations/type-annotations.md) — Provides guidance on adding type descriptions to function arguments and return values for static type checking. ([source](https://www.piglei.com/book/ch10_solid_p1.html))
- [Assignment Expressions](https://awesome-repositories.com/f/programming-languages-runtimes/assignment-expressions.md) — Covers the use of the walrus operator to eliminate redundancy in conditional statements and comprehensions. ([source](https://cdn.jsdelivr.net/gh/piglei/one-python-craftsman@master/README.md))
- [Class Inheritance](https://awesome-repositories.com/f/programming-languages-runtimes/class-inheritance.md) — Provides detailed guidance on using class inheritance to extend and override behavior in Python. ([source](https://www.piglei.com/book/ch10_solid_p1.html))
- [Efficient Container Selection](https://awesome-repositories.com/f/programming-languages-runtimes/efficient-container-selection.md) — Guides the selection of optimal Python collection types, such as sets and deques, to enhance performance. ([source](https://cdn.jsdelivr.net/gh/piglei/one-python-craftsman@master/README.md))
- [Starred Sequence Unpackings](https://awesome-repositories.com/f/programming-languages-runtimes/expression-sequencing/starred-sequence-unpackings.md) — Provides guidance on using starred expressions and nested unpacking to distribute iterable elements into variables. ([source](https://www.piglei.com/book/ch01_variables.html))
- [Idiomatic Loop Construction](https://awesome-repositories.com/f/programming-languages-runtimes/idiomatic-loop-construction.md) — Teaches advanced techniques for increasing iteration efficiency through idiomatic loop decomposition and generator modifiers. ([source](https://cdn.jsdelivr.net/gh/piglei/one-python-craftsman@master/README.md))
- [Literal and Constant Management](https://awesome-repositories.com/f/programming-languages-runtimes/literal-and-constant-management.md) — Guides the handling of constants and text using enumerations, raw strings, and advanced formatting techniques. ([source](https://cdn.jsdelivr.net/gh/piglei/one-python-craftsman@master/README.md))
- [Loop Flattening](https://awesome-repositories.com/f/programming-languages-runtimes/loop-flattening.md) — Shows how to replace multi-layer nested loops with a single loop using Cartesian products for better readability. ([source](https://www.piglei.com/book/ch06_loop.html))
- [Magic Method Implementations](https://awesome-repositories.com/f/programming-languages-runtimes/magic-method-implementations.md) — Demonstrates how to implement magic methods to customize object slicing, string formatting, and data class behavior. ([source](https://cdn.jsdelivr.net/gh/piglei/one-python-craftsman@master/README.md))
- [Predicate-Based Iteration Limits](https://awesome-repositories.com/f/programming-languages-runtimes/predicate-based-iteration-limits.md) — Implements patterns to automatically terminate loops based on specific conditions, replacing manual break statements. ([source](https://www.piglei.com/book/ch06_loop.html))
- [Custom Iterators](https://awesome-repositories.com/f/programming-languages-runtimes/sequence-iteration/custom-iterators.md) — Explains how to implement the iterator protocol using magic methods to create custom traversal sequences. ([source](https://www.piglei.com/book/ch06_loop.html))
- [Single Element Retrieval](https://awesome-repositories.com/f/programming-languages-runtimes/single-element-retrieval.md) — Demonstrates efficient retrieval of the first matching element from a collection without converting iterables to lists. ([source](https://www.piglei.com/book/ch06_loop.html))

### Software Engineering & Architecture

- [Python Best Practices](https://awesome-repositories.com/f/software-engineering-architecture/development-best-practices/python-best-practices.md) — Serves as a comprehensive collection of Python-specific idioms, best practices, and professional coding techniques.
- [Python Patterns](https://awesome-repositories.com/f/software-engineering-architecture/architectural-patterns/python-patterns.md) — Provides Python-specific architectural patterns including data-driven design and dependency injection.
- [Dependency Injection](https://awesome-repositories.com/f/software-engineering-architecture/dependency-injection.md) — Implements dependency injection to pass behavioral strategies into objects during initialization. ([source](https://www.piglei.com/book/ch10_solid_p1.html))
- [EAFP Error Handling](https://awesome-repositories.com/f/software-engineering-architecture/eafp-error-handling.md) — Advocates and demonstrates the EAFP philosophy for robust and idiomatic Python error management.
- [Engineering Best Practices](https://awesome-repositories.com/f/software-engineering-architecture/engineering-best-practices.md) — Implements professional development workflows and industry-standard practices for software development.
- [EAFP Patterns](https://awesome-repositories.com/f/software-engineering-architecture/error-handling-patterns/eafp-patterns.md) — Implements the EAFP pattern to manage boundary cases and missing data efficiently in Python. ([source](https://cdn.jsdelivr.net/gh/piglei/one-python-craftsman@master/README.md))
- [Dependency Injection](https://awesome-repositories.com/f/software-engineering-architecture/integration-extensibility/dependency-injection.md) — Provides a comprehensive guide on decoupling software components by injecting required behavioral dependencies during initialization.
- [Object-Oriented Design Principles](https://awesome-repositories.com/f/software-engineering-architecture/object-oriented-design-principles.md) — Implements SOLID principles and other object-oriented design patterns to ensure maintainable and scalable software. ([source](https://cdn.jsdelivr.net/gh/piglei/one-python-craftsman@master/README.md))
- [Precise Exception Handling](https://awesome-repositories.com/f/software-engineering-architecture/precise-exception-handling.md) — Provides capabilities for robust error management by capturing specific exceptions and maintaining architectural abstraction consistency. ([source](https://cdn.jsdelivr.net/gh/piglei/one-python-craftsman@master/README.md))
- [Refactoring Techniques](https://awesome-repositories.com/f/software-engineering-architecture/python-coding-standards/refactoring-techniques.md) — Offers strategies for improving the structure and readability of existing Python code through refactoring.
- [Large Scale Architectures](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture-design/large-scale-architectures.md) — Offers architectural insights and experience-based guidance for developing and managing complex, large-scale Python projects. ([source](https://www.piglei.com/book/preface.html))
- [Object Oriented Design](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/foundational-theory-and-guidance/software-architecture-concepts/object-oriented-design.md) — Provides guidance on applying object-oriented design principles and patterns to structure Python software systems.
- [Data-Driven Architectural Patterns](https://awesome-repositories.com/f/software-engineering-architecture/software-design-patterns/data-driven-architectural-patterns.md) — Provides an architectural approach that externalizes changing logic into data structures. ([source](https://www.piglei.com/book/ch10_solid_p1.html))
- [Software Engineering Principles](https://awesome-repositories.com/f/software-engineering-architecture/software-engineering-principles.md) — Guidance on applying software engineering principles like SOLID and precise error handling to Python projects.
- [Class-Based Decorators](https://awesome-repositories.com/f/software-engineering-architecture/class-based-decorators.md) — Provides detailed strategies for implementing class-based decorators to extend function behavior in an object-oriented manner.
- [Coding Best Practices](https://awesome-repositories.com/f/software-engineering-architecture/coding-best-practices.md) — Shares engineering patterns and technical tips to improve code quality and efficiency across Python functions. ([source](https://www.piglei.com/book/preface.html))
- [Generator-Based Iterators](https://awesome-repositories.com/f/software-engineering-architecture/compile-time-code-generation/iterative-code-generation/generator-based-iterators.md) — Demonstrates the use of the yield keyword to create lazy iterables and reduce iterator boilerplate. ([source](https://www.piglei.com/book/ch06_loop.html))
- [Configuration-Driven Logic](https://awesome-repositories.com/f/software-engineering-architecture/configuration-driven-logic.md) — Implements patterns for representing executable logic as structured data to allow behavior modification without altering source code.
- [Decorators](https://awesome-repositories.com/f/software-engineering-architecture/decorator-patterns/decorators.md) — Extends function behavior using class-based decorators while preserving original metadata. ([source](https://cdn.jsdelivr.net/gh/piglei/one-python-craftsman@master/README.md))
- [Interface-Implementation Separation](https://awesome-repositories.com/f/software-engineering-architecture/interface-implementation-separation.md) — Teaches the separation of functional interfaces from implementation details to improve code maintainability and modularity.
- [Nested Loop Extractions](https://awesome-repositories.com/f/software-engineering-architecture/nested-loop-extractions.md) — A Python refactoring technique that wraps nested loops in a separate function to allow immediate exit via a single return. ([source](https://www.piglei.com/book/ch06_loop.html))
- [Performance Optimization Patterns](https://awesome-repositories.com/f/software-engineering-architecture/performance-optimization-patterns.md) — Details performance optimization patterns such as efficient iterator use and container selection to reduce memory usage.
- [Generator-Based Data Pipelines](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/modular-decoupled-design/structural-design-paradigms/decoupled-logic-encapsulation/logic-decoupling/generator-based-data-pipelines.md) — Separates the logic of fetching data from processing it using decoupled generator-based pipelines. ([source](https://www.piglei.com/book/ch06_loop.html))
- [Generator-Based Pipelines](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/modular-decoupled-design/structural-design-paradigms/decoupled-logic-encapsulation/logic-decoupling/generator-based-pipelines.md) — Demonstrates how to construct decoupled data pipelines using generators to isolate acquisition from processing.
- [Refactoring Techniques](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/foundational-theory-and-guidance/software-architecture-principles/solid-principles/single-responsibility-principles/refactoring-techniques.md) — Provides a practice for splitting large classes and functions into specialized components to minimize reasons for change. ([source](https://www.piglei.com/book/ch10_solid_p1.html))

### Development Tools & Productivity

- [Iterable Decoration](https://awesome-repositories.com/f/development-tools-productivity/iterable-decorators/iterable-decoration.md) — Provides patterns for wrapping source iterables in generators to handle filtering and indexing efficiently. ([source](https://www.piglei.com/book/ch06_loop.html))

### Scientific & Mathematical Computing

- [Slicing Iteration](https://awesome-repositories.com/f/scientific-mathematical-computing/multi-dimensional-arrays/slicing-iteration.md) — Explains how to extract elements from an iterable at specific intervals without loading the full sequence into memory. ([source](https://www.piglei.com/book/ch06_loop.html))
