Python Package and Wheel

An import package is code organized under a name Python can import. A distribution package is the installable project described by packaging metadata. Their names need not match: a distribution called orders-pipeline can provide an import package called orders_pipeline, and one distribution can provide more than one import package.

A wheel is a built distribution archive containing installable files and metadata. It is not a full virtual environment. Required libraries still need to be installed, and some wheels are compatible only with particular interpreters or platforms. A build backend creates the artifact from source and configuration; the presence of a source directory alone does not establish what will be included.

During development, an editable installation exposes the source so edits become visible without repeatedly rebuilding a wheel. That is useful for iteration but can hide packaging omissions. Build the wheel, install it in a separate environment, and run from outside the source checkout to avoid accidentally importing local files instead of the installed artifact.

Entry points are another part of the contract. A configured console command calls its designated function. Running an import package with python -m uses its __main__ module. Exercise the intended entry points and required data files in the installed artifact. A successful startup is a smoke test; it does not replace tests of parsing, business rules, or integration with actual services.

Reference: Python Packaging User Guide. For worked examples, see Python for Data Engineers.


Discover more from Insightful Data Lab

Subscribe to get the latest posts sent to your email.

Similar Posts

Questions, corrections, or additional insights?

This site uses Akismet to reduce spam. Learn how your comment data is processed.