Loading video player…

Publishing Python Packages to PyPI (Overview)

PyPI is the public hosting service where open-source Python packages live. When you pip install a package, that’s where it fetches it from. In this course, you’ll learn all about the structures of a package and how to upload your own to the PyPI server.

In this video course, you’ll learn about:

  • Why packages and virtual environments exist
  • How to structure a package
  • How to use build systems
  • The contents of the pyproject.toml file
  • How to use the build and twine tools
  • What the Flit and Poetry tools offer

Throughout this course, you’ll work with an example project, a reader package that can be used to read Real Python tutorials in your console:


Course Slides (PDF)

5.0 MB

00:00 Welcome to Publishing Python Packages to PyPI. My name is Christopher, and I will be your guide. Nothing like starting out with rhyming couplets, huh? In this course, you’ll learn about Python packages, packaging and virtual environments, how a Python package is structured, what a build system is, how build systems use pyproject.toml files, the build and twine tools for building and uploading packages, as well as a couple of alternate build systems.

00:34 This course was tested using Python 3.11.1, pip 23.0.1, build 0.10.0, and twine 4.0.2. The Python packaging world is constantly changing.

00:48 The companion article for this course was given an update eight months prior to the course, and things had changed even in that short time. The version of pip in particular is important.

00:59 Earlier versions will mean less capabilities with the pyproject.toml files that you’ll be seeing throughout this course.

01:09 As my comment in the previous slide kind of foreshadowed, packaging in Python is, well, complicated and, well, changing. Python Enhancement Proposals are still being written and argued about that impact how packaging works and the different tools in the packaging ecosystem.

01:27 Not that long ago, one of those PEPs defined the pyproject.toml file, a text-based configuration file that is intended to supplant the other project metadata mechanisms.

01:38 The two most common tools for building and publishing Python packages are build and twine, respectively. This course will show you how to use them and then briefly cover some alternatives

01:51 before digging into a specific package. The next lesson does a quick overview of what a package is and how it relates to virtual environments.

Become a Member to join the conversation.