initpy
Initpy is a term used in Python programming to refer to the initialization script init.py inside a package directory. The presence of this file marks the directory as a Python package and makes its contents importable as module attributes. When a package is imported, Python executes the code at the top level of init.py, which commonly sets up package-level state, defines public API symbols, and imports frequently used submodules.
Typical contents include import statements for submodules, assignment to all, version information, and small initialization routines.
Namespace packages: Python 3.3+ supports implicit namespace packages (PEP 420). A directory without init.py can be
Best practices: keep init.py lightweight; avoid heavy I/O or long-running initialization; use all to define public