Everyday Project Packaging With pyproject.toml

Packaging is often associated with publishing a project on PyPI, which can make you bypass packaging as something you don’t need to worry about at the start of your project. Python packaging has also had a long history and can be overwhelming for all levels of programmers. But it doesn’t have to be a scary process!

In this Code Conversation, you’ll follow a chat between Ian and Geir Arne demonstrating the relatively new, officially sanctioned way of setting up your Python projects using a pyproject.toml file and installing your package with pip. This offers nice benefits, such as:

  • Being able to call your project from anywhere
  • Playing on the same team as the import system
  • Allowing for consistent imports
  • Having one file that’ll work for many build systems

Along the way, you’ll:

  • Structure files and folders in your project
  • Understand different ways to run your script
  • Explore how the import system works
  • Explore the Python packaging world
  • Write a pyproject.toml file to configure your package
  • Install your pacakge with pip

You’ll also dive into various rabbit holes along the way as Ian and Geir Arne talk about all the aspects of the process.

To get the most out of this Code Conversation, you should have a handle on Python basics, be able to create a virtual environment and install packages, and have some exposure to the import system. Ideally, you have some experience fighting against the import system and thinking that there must be a better way.

What’s Included:

Downloadable Resources:

About Ian Currie

Ian is a Python nerd who relies on it for work and much enjoyment.

» More about Ian

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

← Browse All Courses