Packages And Sub-packages In Python


  • Any Python library of significant complexity and a simple design tends to grow into multiple .py files.
  • While each .py file corresponds to a Python module, multiple python modules are grouped as Python packages and sub-packages.
  • A package can have several sub-packages and modules inside.
  • Roughly packages are directories and modules are files. This simple organization of packages is called regular packages in Python.
  • From Python3.3, the packages can be formed of portions from many directories and network locations. They are called namespace packages. Also, only one or few files of a directory can contribute to a Python namespace package.
  • Namespace packages do not have and they also do not rely on the __path__ attribute.

Copyright 2022 ©