Serious Python black-belt advice on deployment, scalability, testing, and more
Sharpen your Python skills as you dive deep into the Python programming language with Serious Python. You’ll cover a range of advanced topics like multithreading and memorization, get advice from experts on things like designing APIs and dealing with databases, and learn Python internals to help you...
Otros Autores: | |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
San Francisco :
No Starch Press
[2019]
|
Edición: | 1st edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009630545706719 |
Tabla de Contenidos:
- Intro
- Brief Contents
- Contents in Detail
- Acknowledgments
- Introduction
- Who Should Read This Book and Why
- About This Book
- Chapter 1: Starting Your Project
- Versions of Python
- Laying Out Your Project
- What to Do
- What Not to Do
- Version Numbering
- Coding Style and Automated Checks
- Tools to Catch Style Errors
- Tools to Catch Coding Errors
- Interview with Joshua Harlow
- Chapter 2: Modules, Libraries, and Frameworks
- The Import System
- The sys Module
- Import Paths
- Custom Importers
- Meta Path Finders
- Useful Standard Libraries
- External Libraries
- The External Libraries Safety Checklist
- Protecting Your Code with an API Wrapper
- Package Installation: Getting More from pip
- Using and Choosing Frameworks
- Doug Hellmann, Python Core Developer, on Python Libraries
- Chapter 3: Documentation and Good API Practice
- Documenting with Sphinx
- Getting Started with Sphinx and reST
- Sphinx Modules
- Writing a Sphinx Extension
- Managing Changes to Your APIs
- Numbering API Versions
- Documenting Your API Changes
- Marking Deprecated Functions with the warnings Module
- Summary
- Christophe de Vienne on Developing APIs
- Chapter 4: Handling Timestamps and Time Zones
- The Problem of Missing Time Zones
- Building Default datetime Objects
- Time Zone-Aware Timestamps with dateutil
- Serializing Time Zone-Aware datetime Objects
- Solving Ambiguous Times
- Summary
- Chapter 5: Distributing Your Software
- A Bit of setup.py History
- Packaging with setup.cfg
- The Wheel Format Distribution Standard
- Sharing Your Work with the World
- Entry Points
- Visualizing Entry Points
- Using Console Scripts
- Using Plugins and Drivers
- Summary
- Nick Coghlan on Packaging
- Chapter 6: Unit Testing
- The Basics of Testing
- Some Simple Tests
- Skipping Tests.
- Running Particular Tests
- Running Tests in Parallel
- Creating Objects Used in Tests with Fixtures
- Running Test Scenarios
- Controlled Tests Using Mocking
- Revealing Untested Code with coverage
- Virtual Environments
- Setting Up a Virtual Environment
- Using virtualenv with tox
- Re-creating an Environment
- Using Different Python Versions
- Integrating Other Tests
- Testing Policy
- Robert Collins on Testing
- Chapter 7: Methods and Decorators
- Decorators and When to Use Them
- Creating Decorators
- Writing Decorators
- Stacking Decorators
- Writing Class Decorators
- How Methods Work in Python
- Static Methods
- Class Methods
- Abstract Methods
- Mixing Static, Class, and Abstract Methods
- Putting Implementations in Abstract Methods
- The Truth About super
- Summary
- Chapter 8: Functional Programming
- Creating Pure Functions
- Generators
- Creating a Generator
- Returning and Passing Values with yield
- Inspecting Generators
- List Comprehensions
- Functional Functions Functioning
- Applying Functions to Items with map()
- Filtering Lists with filter()
- Getting Indexes with enumerate()
- Sorting a List with sorted()
- Finding Items That Satisfy Conditions with any() and all()
- Combining Lists with zip()
- A Common Problem Solved
- Useful itertools Functions
- Summary
- Chapter 9: The Abstract Syntax Tree, Hy, and Lisp-like Attributes
- Looking at the AST
- Writing a Program Using the AST
- The AST Objects
- Walking Through an AST
- Extending flake8 with AST Checks
- Writing the Class
- Ignoring Irrelevant Code
- Checking for the Correct Decorator
- Looking for self
- A Quick Introduction to Hy
- Summary
- Paul Tagliamonte on the AST and Hy
- Chapter 10: Performances and Optimizations
- Data Structures
- Understanding Behavior Through Profiling
- cProfile.
- Disassembling with the dis Module
- Defining Functions Efficiently
- Ordered Lists and bisect
- namedtuple and Slots
- Memoization
- Faster Python with PyPy
- Achieving Zero Copy with the Buffer Protocol
- Summary
- Victor Stinner on Optimization
- Chapter 11: Scaling and Architecture
- Multithreading in Python and Its Limitations
- Multiprocessing vs. Multithreading
- Event-Driven Architecture
- Other Options and asyncio
- Service-Oriented Architecture
- Interprocess Communication with ZeroMQ
- Summary
- Chapter 12: Managing Relational Databases
- RDBMSs, ORMs, and When to Use Them
- Database Backends
- Streaming Data with Flask and PostgreSQL
- Writing the Data-Streaming Application
- Building the Application
- Dimitri Fontaine on Databases
- Chapter 13: Write Less, Code More
- Using six for Python 2 and 3 Support
- Strings and Unicode
- Handling Python Modules Moves
- The modernize Module
- Using Python Like Lisp to Make a Single Dispatcher
- Creating Generic Methods in Lisp
- Generic Methods with Python
- Context Managers
- Less Boilerplate with attr
- Summary
- Index.