Modules and Packages

Learning PathSkills: Packages, Modules, Import System, pip, PyPI, uv, __init__.py, Namespace Packages

A person loading a large ship with shipping containers that represent Python 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.

Title image for Python Modules and Packages: An Introduction (Python Best Practices Artwork)

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.

Title image for Python Modules and Packages (Python Modules & Packages)

Interactive Quiz

Python Modules and Packages

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.

Title image for Absolute vs Relative Imports in Python (Absolute vs Relative Imports in Python)

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.

Title image for Advanced Python import Techniques (Python import: Advanced Techniques and Tips)

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.

Title image for Python's __all__: Packages, Modules, and Wildcard Imports (Python's __all__: Packages, Modules, and Wildcard Imports)

Tutorial

Python's __all__: Packages, Modules, and Wildcard Imports

Learn about wildcard imports and the __all__ variable in Python. With __all__, you can prepare your packages and modules for wildcard imports, which are a quick way to import everything.

Title image for What's a Python Namespace Package, and What's It For? (What's a Python Namespace Package, and What's It For?)

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.

Title image for Python Namespace Packages (What's a Python Namespace Package, and What's It For?)

Interactive Quiz

Python Namespace Packages

Title image for Python Zip Imports: Distribute Modules and Packages Quickly (Python Zip Imports: Distribute Modules and Packages Quickly)

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.

Title image for A Beginner's Guide to pip (What Is pip? A Guide for New Pythonistas)

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.

Title image for uv vs pip: Python Packaging and Dependency Management (uv vs pip: Managing Python Packages and Dependencies)

Course

uv vs pip: Python Packaging and Dependency Management

Choosing between uv vs pip? This video course compares speed, reproducible environments, compatibility, and dependency management to help you pick the right tool.

Title image for Managing Python Dependencies (Managing Python Dependencies Course)

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.

Title image for How to Evaluate the Quality of Python Packages (How to Evaluate the Quality of Python Packages)

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.

Title image for Publishing Python Packages to PyPI (How to Publish an Open-Source Python Package to PyPI)

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.

Title image for Using PyInstaller to Easily Distribute Python Applications (Using PyInstaller to Easily Distribute Python Applications)

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.

Title image for Creating Great README Files for Your Python Projects (Creating Great README Files for Your Python Projects)

Tutorial

Creating Great README Files for Your Python Projects

Learn how to create, organize, and format high-quality README files for your Python projects.

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:

Got feedback on this learning path?

Looking for real-time conversation? Visit the Real Python Community Chat or join the next “Office Hours” Live Q&A Session. Happy Pythoning!

« Browse All Learning Paths