Module 07 of 11

Modules, Packages & Environments

Lessons

About This Module

As your programs grow, keeping everything in one file stops making sense. This module covers how Python code is organized across files and projects — and how to bring in code that other people have already written.

It starts with modules: importing your own files, exploring the standard library, and how Python finds the modules you import. From there it covers packages — grouping related modules into a directory with an __init__.py file. It continues with pip, Python's package manager, for installing third-party code from PyPI, and closes with virtual environments, which keep each project's dependencies isolated from the rest of your system.

Watch the lessons in order, then continue on to Object-Oriented Programming.

Lessons

4 videos
01

Python Tutorial for Beginners 9: Import Modules and Exploring The Standard Library

Importing modules you've written yourself as well as modules from the standard library, and how Python's sys.path decides where to look.

02

What is __init__.py? How to Create a Package in Python

Turning a folder of related modules into a proper package using an __init__.py file, and importing from it cleanly.

03

pip - An In-Depth Look at the Package Management System

Installing, uninstalling, listing, and upgrading third-party packages from PyPI using pip.

04

virtualenv and Why You Should Use Virtual Environments

Keeping each project's package versions separate with virtual environments, so dependencies for one project don't break another.