Skip to content

Python Packages

  • Package is a directory that contains a special file called __init__.py (can be empty).
  • The presence of __init__.py tells Python that this directory is a package, and can contain modules (python files) and subpackages
  • https://docs.python.org/3/tutorial/modules.html
myapp/               # package
├── __init__.py
├── models.py        # module (myapp.models)
└── utils/           # subpackage
    ├── __init__.py
    └── helper.py    # submodule (myapp.utils.helpers)

Native Modules (Standard Library)

External Packages

  • External Packages: https://pypi.org/
  • Pip is the endorsed package manager for python, although it's an external module
# Pip can be installed through the built-in module "ensurepip"
python -m ensurepip --upgrade