Properties2
TypePractice
Note createdJul 22, 2025

In Python, the notion of a package is the unit of a folder containing different scripts with a semantic relation (that is, their task is somewhat related). A package can be imported and used in code, as long as it is visible from the package root by location or by the Python installation or environment.

Packages used to need a __init__.py file at root and in each of the sub-packages. Since Python 3.3, only the top package needs this file and subsequent folders are understood as implicit namespaces packages.

For the longest time I used Poetry, an all-in-one tool that defines not only packaging but also dependencies and environments for local development. However, lately I would recommend uv as the best alternative by providing a much more solid and compatible experience (can be used with pip, setuptools, etc).

The main package repository is PyPI, although other repositories can be added to most package managers.