🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

Python Beginner

What is Python Package?

A directory containing Python modules and an __init__.py file, providing a way to organize and distribute reusable code.

Python packages organize related modules into a directory hierarchy. A package is a directory containing an __init__.py file (which can be empty) and one or more .py module files. Packages can be nested (subpackages). Distribution packages are installable units shared via PyPI using pip. Modern packaging uses pyproject.toml (PEP 518) with build backends like setuptools, Poetry, or Flit. The packaging ecosystem includes wheels (.whl) for pre-built distributions, sdists for source distributions, and dependency resolution tools. Understanding packages is essential for creating reusable, distributable Python code.

Related Terms

GIL (Global Interpreter Lock)
A mutex in CPython that allows only one thread to execute Python bytecode at a time, limiting true parallelism.
Python Descriptors
Objects that define __get__, __set__, or __delete__ methods, controlling how attribute access works on other objects.
Python Context Variable
A variable that maintains separate values for each execution context, enabling implicit state passing in async code without global variables.
Python Iterator Protocol
The interface requiring __iter__() and __next__() methods, enabling objects to be used in for loops and other iteration contexts.
ABC (Abstract Base Class)
A class that defines a common interface for subclasses by declaring abstract methods that must be implemented.
Comprehension
A concise syntax pattern for creating collections by transforming and filtering items from iterables.
View All Python Terms →