Book description
Does it seem like your Python projects are getting bigger and bigger? Are you feeling the pain as your codebase expands and gets tougher to debug and maintain? Python is an easy language to learn and use, but that also means systems can quickly grow beyond comprehension. Thankfully, Python has features to help developers overcome maintainability woes.
In this practical book, author Patrick Viafore shows you how to use Python's type system to the max. You'll look at user-defined types, such as classes and enums, and Python's type hinting system. You'll also learn how to make Python extensible and how to use a comprehensive testing strategy as a safety net. With these tips and techniques, you'll write clearer and more maintainable code.
- Learn why types are essential in modern development ecosystems
- Understand how type choices such as classes, dictionaries, and enums reflect specific intents
- Make Python extensible for the future without adding bloat
- Use popular Python tools to increase the safety and robustness of your codebase
- Evaluate current code to detect common maintainability gotchas
- Build a safety net around your codebase with linters and tests
Publisher resources
Table of contents
- Preface
- 1. Introduction to Robust Python
- I. Annotating Your Code with Types
- 2. Introduction to Python Types
- 3. Type Annotations
- 4. Constraining Types
- 5. Collection Types
- 6. Customizing Your Typechecker
- 7. Adopting Typechecking Practically
- II. Defining Your Own Types
- 8. User-Defined Types: Enums
- 9. User-Defined Types: Data Classes
- 10. User-Defined Types: Classes
- 11. Defining Your Interfaces
- 12. Subtyping
- 13. Protocols
- 14. Runtime Checking With pydantic
- III. Extensible Python
- 15. Extensibility
- 16. Dependencies
- 17. Composability
- 18. Event-Driven Architecture
- 19. Pluggable Python
- IV. Building a Safety Net
- 20. Static Analysis
- 21. Testing Strategy
- 22. Acceptance Testing
- 23. Property-Based Testing
- 24. Mutation Testing
- Index
- About the Author
Product information
- Title: Robust Python
- Author(s):
- Release date: July 2021
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781098100667
You might also like
book
Fluent Python
Python’s simplicity lets you become productive quickly, but this often means you aren’t using everything it …
book
Effective Python: 90 Specific Ways to Write Better Python, 2nd Edition
Updated and Expanded for Python 3 It’s easy to start developing programs with Python, which is …
book
Serious Python
Sharpen your Python skills as you dive deep into the Python programming language with Serious Python. …
book
Object-Oriented Python
Object-Oriented Python (OOP) is a paradigm that combines data and code into cohesive units, allowing you …