Book description
Create masterful, maintainable Python packages! This book includes pro tips for design, automation, testing, deployment, and even release as an open source project!In Publishing Python Packages you will learn how to:
- Build extensions and console script commands
- Use tox to automate packaging, installing, and testing
- Build a continuous integration pipeline using GitHub Actions
- Improve code quality and reduce manual review using black, mypy, and flake8
- Create published documentation for your packages
- Keep packages up to date with pyupgrade and Dependabot
- Foster an open source community using GitHub features
Publishing Python Packages teaches you how to easily share your Python code with your team and the outside world. Learn a repeatable and highly automated process for package maintenance that’s based on the best practices, tools, and standards of Python packaging. This book walks you through creating a complete package, including a C extension, and guides you all the way to publishing on the Python Package Index. Whether you’re entirely new to Python packaging or looking for optimal ways to maintain and scale your packages, this fast-paced and engaging guide is for you.
About the Technology
Successful Python packages install easily, run flawlessly, and stay reliably up to date. Publishing perfect Python packages requires a rigorous process that supports systematic testing and review, along with excellent documentation. Fortunately, the Python ecosystem includes tools and techniques to automate package creation and publishing.
About the Book
Publishing Python Packages presents a practical process for sharing Python code in an automated and scalable way. Get hands-on experience with the latest packaging tools, and learn the ins and outs of package testing and continuous integration. You’ll even get pro tips for setting up a maintainable open source project, including licensing, documentation, and nurturing a community of contributors.
What's Inside
- Build extensions and console script commands
- Improve code quality with automated review and testing
- Create excellent documentation
- Keep packages up to date with pyupgrade and Dependabot
About the Reader
For intermediate Python programmers.
About the Author
Dane Hillard has spent the majority of his development career using Python to build web applications.
Quotes
...practical...I learned a lot from this book. A wholly modern approach to current packaging tooling and the problems faced by package developers…I think you’ll find it to be a useful source and an inspiration.
- From the Foreword by David Beazley, author of Python Distilled
A comprehensive guide to the Python packaging landscape. Dane takes a complicated topic and makes you think, ‘Yeah, I got this.’ It’s impressively done. Recommended.
- Carlton Gibson, Django Project
A comprehensive guide for Python programmers ready to share their code with the world.
- Joshua A. McAdams, Senior Software Engineer, Google
Table of contents
- inside front cover
- Publishing Python Packages
- Copyright
- brief contents
- contents
- front matter
- Part 1. Foundations
- 1 The what and why of Python packages
- 2 Preparing for package development
- 3 The anatomy of a minimal Python package
- Part 2. Creating a viable package
- 4 Handling package dependencies, entry points, and extensions
- 5 Building and maintaining a test suite
- 6 Automating code quality tooling
- Part 3. Going public
- 7 Automating work through continuous integration
- 8 Authoring and maintaining documentation
-
9 Making a package evergreen
- 9.1 Choosing a package-versioning strategy
- 9.1.1 Direct and indirect dependencies
- 9.1.2 Python dependency specifiers and dependency hell
- 9.1.3 Semantic versioning and calendar versioning
- 9.2 Getting the most out of GitHub
- 9.2.1 The GitHub dependency graph
- 9.2.2 Mitigating security vulnerabilities with Dependabot
- 9.3 Thresholding test coverage
- 9.4 Updating Python syntax using pyupgrade
- 9.5 Reducing rework using pre-commit hooks
- Answers to exercises
- Summary
- Part 4. The long haul
- 10 Scaling and solidifying your practices
-
11 Building a community
- 11.1 Your README needs to make a value proposition
- 11.2 Provide supporting documentation for different user types
- 11.3 Establish, provide, and enforce a code of conduct
- 11.4 Conveying the project’s road map, status, and changes
- 11.4.1 Using GitHub projects for kanban management
- 11.4.2 Use GitHub labels to track status for individual tasks
- 11.4.3 Track high-level changes in a log
- 11.5 Gather consistent information with issue templates
- 11.6 Go forth
- Summary
- Appendix A. Installing asdf and python-launcher
- Appendix B. Installing pipx, build, tox, pre-commit, and cookiecutter
- index
- inside back cover
Product information
- Title: Publishing Python Packages
- Author(s):
- Release date: February 2023
- Publisher(s): Manning Publications
- ISBN: 9781617299919
You might also like
book
DevOps in Python: Infrastructure as Python
Take advantage of Python to automate complex systems with readable code. This new edition will help …
video
Let's build a Python package!
Build and publish a Python package from scratch! About the Technology About the Video What's Inside …
book
Python One-Liners
Python One-Liners will teach you how to read and write “one-liners”: concise statements of useful functionality …
book
Building Python Microservices with FastAPI
Discover the secrets of building Python microservices using the FastAPI framework Key Features Provides a reference …