Package

A folder of related modules you can import; also a library you install with pip.

A package groups related modules under one name so they can be imported together (from urllib import request). In everyday use, “package” also means a third-party library you install from PyPI with piprequests, flask, pandas — then import like any other module.

Example
# install once at the terminal:  pip install requests
import requests                  # a third-party package

from urllib import request        # a standard-library package

Where this shows up in real Python

Almost every real project pulls in packages — for HTTP, data, or web apps — installed with pip and listed in requirements.txt.

Commonly used Package tools

  • pip install name — install a package from PyPI
  • import name — use an installed package
  • from pkg import module — import a package’s module
  • pip show name — see a package’s details

Official documentation: Python Tutorial: Packages

Related terms