Skip to Content
The Hitchhiker's Guide to Python
book

The Hitchhiker's Guide to Python

by Kenneth Reitz, Tanya Schlusser
August 2016
Beginner
338 pages
7h 58m
English
O'Reilly Media, Inc.
Content preview from The Hitchhiker's Guide to Python

Chapter 6. Shipping Great Code

This chapter focuses on best practices for packaging and distributing Python code. You’ll either want to create a Python library to be imported and used by other developers, or create a standalone application for others to use, like pytest.

The ecosystem around Python packaging has become a lot more straightforward in the past few years, thanks to the work of the Python Packaging Authority (PyPA)1—the people who maintain pip, the Python Package Index (PyPI), and much of the infrastructure relevant to Python packaging. Their packaging documentation is stellar, so we won’t reinvent the wheel in “Packaging Your Code”, but we will briefly show two ways to host packages from a private site, and talk about how to upload code to Anaconda.org, the commercial analogue to PyPI run by Continuum Analytics.

The downside of distributing code through PyPI or other package repositories is that the recipient must understand how to install the required version of Python and be able and willing to use tools such as pip to install your code’s other dependencies. This is fine when distributing to other developers but makes the method unsuitable for distributing applications to end users who aren’t coders. For that, use one of the tools in “Freezing Your Code”.

Those making Python packages for Linux may also consider a Linux distro package (e.g., a .deb file on Debian/Ubuntu; called “build distributions” in Python documentation). That route is a lot of work to maintain, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

The Quick Python Book, Third Edition

The Quick Python Book, Third Edition

David Fugate, Naomi Ceder
Serious Python

Serious Python

Julien Danjou
Introduction to Python

Introduction to Python

Jessica McKellar

Publisher Resources

ISBN: 9781491933213Errata Page