Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Everyday Project Packaging With pyproject.toml (Summary)

In this Code Conversation, you’ve learned that packaging is about more than just publishing a project on PyPI. In fact, it can be helpful for your own personal projects. You had the world of packaging demystified and got to know the new, officially sanctioned way of setting up your Python projects using a pyproject.toml file and installing your package with pip. With this, you get the following benefits:

  • 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:

  • Structured files and folders in your project
  • Understood different ways to run your script
  • Explored how the import system works
  • Explored the Python packaging world
  • Wrote a pyproject.toml file to configure your package
  • Installed your pacakge with pip

Here are some further resources that you might find useful:

Which of your projects will you package next? Share your ideas in the comments below!

Download

Sample Code (.zip)

2.2 KB

Download

Course Slides (.pdf)

2.0 MB

Diego de Pablos on Dec. 12, 2022

This was really helpful. It’s good to learn how to do these things once and for all!

paulfwatts on Dec. 13, 2022

This is my first course as a paid subscriber.

I really enjoyed the conversational format and all the materials provided, plus the transcript, were excellent.

Nice to know there is a standard way to do this now!

paulfwatts on Dec. 13, 2022

This is my README.md added to my project file for this course, which may help others:

Course

Everyday Project Packaging With pyproject.toml (Overview) – Real Python

Installation

Install the package in editable mode using -e. This will install the package in development mode, so that any changes made to the source code will be reflected in the installed package. This is useful for development purposes. Run the following command in the root directory of the project (after creating and activating a virtual environment): python -m pip install -e .

Resources

1. Building and Distributing Packages with Setuptools

2. Get to Know Python Packaging

3. Configuring setuptools using pyproject.toml files

4. Python and TOML: New Best Friends

5. PEP 621 - Storing project metadata in pyproject.toml

6. Flit - Build System

7. Poetry - Build System

wols on Dec. 24, 2022

The course should always be considered one of the first - a “way to work”.

Glenn Lehman on Dec. 30, 2022

I enjoyed this conversation! It helped to lay a solid foundation to my understanding of installing my own scripts. I did create an entire GitHub Repo to capture the code at the end of most videos.

snakesay

Martin Breuss RP Team on Jan. 2, 2023

Nice, glad you enjoyed the conversation @Glenn Lehmann. You can also download the sample code from the Supporting Materials dropdown at the top of the page.

Although that code doesn’t include your detailed Video Time Index :D

sanvorav on April 12, 2023

Love this course!! 💚🐍 This course is ESSENTIAL for all doing any development work.

NOTE:

If you’re using a Poetry environment, you can install using the command:

poetry add --editable ./myproject

This will add the line (below) to the Poetry pyproject.toml file:

myproject = {path = "myproject", develop = true}

A myproject.egg-info folder will also be generated.

Become a Member to join the conversation.