Modules and Packages (Learning Path) – Real Python
Learning Path ⋅ Skills: Packages, Modules, Import System, pip, PyPI, uv, __init__.py, Namespace Packages
In this learning path, you’ll explore how Python’s import system works and how to structure your code using modules and packages. You’ll learn to manage project dependencies with pip and uv, evaluate third-party package quality, and publish your own packages to PyPI. Along the way, you’ll also cover namespace packages, zip imports, and creating README files for your projects.
Modules and Packages
Learning Path ⋅ 14 Resources
Understanding Modules and Packages
Get started with Python’s module and package system. You’ll learn how to organize your code into reusable modules and understand what init.py does.
Course
Python Modules and Packages: An Introduction
In this course, you'll explore Python modules and Python packages, two mechanisms that facilitate modular programming. See how to write and import modules so you can optimize the structure of your own programs and make them more maintainable.
Python's Import System
Explore how Python’s import system works under the hood. You’ll cover absolute and relative imports, advanced import techniques, namespace packages, and zip imports.
Course
Absolute vs Relative Imports in Python
If you've worked on a Python project that has more than one file, chances are you've had to use an import statement before. In this course, you'll not only cover the pros and cons of absolute and relative imports but also learn about the best practices for writing import statements.
Course
Advanced Python import Techniques
The Python import system is as powerful as it is useful. In this in-depth video course, you'll learn how to harness this power to improve the structure and maintainability of your code.
Tutorial
What's a Python Namespace Package, and What's It For?
In this tutorial, you'll be exploring Python namespace packages: what they are, what they're for, and how you can use them in your package systems. Along the way, you'll create your own set of namespace packages and explore how you might be able to use them in your own projects.
Tutorial
Python Zip Imports: Distribute Modules and Packages Quickly
Learn what Zip imports are and how to use them in Python. You'll learn to create your own importable ZIP files and make them available for use. Finally, you'll learn how to use the zipimport module to dynamically import code from ZIP files.
Managing Dependencies
Learn how to install and manage third-party packages for your projects. You’ll work with pip and uv, and learn to evaluate package quality.
Course
A Beginner's Guide to pip
What is pip? In this beginner-friendly course, you'll learn how to use pip, the standard package manager for Python, so that you can install and manage additional packages that are not part of the Python standard library.
Course
Managing Python Dependencies
Get up to speed with Python dependency management quickly and go from “writing scripts” to “building applications” with this complete course.
Tutorial
How to Evaluate the Quality of Python Packages
Just like you shouldn't download any file from the Internet, you shouldn't install third-party Python packages without evaluating them first. This tutorial will give you the tool set to evaluate the quality of external Python packages before you incorporate them into your Python projects.
Publishing and Distributing
Share your Python projects with the world. You’ll learn to publish packages on PyPI, bundle applications with PyInstaller, and create effective README files.
Course
Publishing Python Packages to PyPI
In this video course, you’ll learn how to create a Python package for your project and how to publish it to PyPI, the Python Package Index. Quickly get up to speed on everything from naming your package to configuring it using setup.cfg.
Tutorial
Using PyInstaller to Easily Distribute Python Applications
Learn how to use PyInstaller to turn your Python application into an executable with no dependencies or installation required. This is great if you want to distribute applications to users who may or may not be Python developers.
Ready to keep building your Python skills? Continue to the next learning path:
Learning Path
Object-Oriented Programming (OOP)
16 Resources ⋅ Skills: Python, OOP, Classes, Data Classes, Getters, Setters, Property, super(), Magic Methods, Operator Overloading, SOLID, Inheritance, Composition, Mixin Classes, Factory Pattern
You may also be interested in these related learning paths: