Serious Python : black-belt advice on deployment, scalability, testing, and more /


by Julien Danjou.
Bok Engelsk 2019 · Electronic books.
Omfang
1 online resource (1 volume) : : illustrations
Utgave
1st edition
Opplysninger
Includes index.. - 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.. - 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.. - 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.. - 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 gain a deeper understanding of the language itself. Written for developers and experienced programmers, Serious Python brings together over 15 years of Python experience to teach you how to avoid common mistakes, write code more efficiently, and build better programs in less time. As you make your way through the book’s extensive tutorials, you’ll learn how to start a project and tackle topics like versioning, layouts, coding style, and automated checks. You’ll learn how to package your software for distribution, optimize performance, use the right data structures, define functions efficiently, pick the right libraries, build future-proof programs, and optimize your programs down to the bytecode. You’ll also learn how to: •Make and use effective decorators and methods, including abstract, static, and class methods •Employ Python for functional programming using generators, pure functions, and functional functions •Extend flake8 to work with the abstract syntax tree (AST) to introduce more sophisticated automatic checks into your programs •Apply dynamic performance analysis to identify bottlenecks in your code •Work with relational databases and effectively manage and stream data with PostgreSQL If you’ve been looking for a way to take your Python skills from good to great, Serious Python will help you get there. Learn from the experts and get seriously good at Python with Serious Python !
Emner
Sjanger
Dewey
ISBN
1-4920-7121-8. - 1-59327-879-9

Bibliotek som har denne