liveBook · Manning

Distribution package

As explained in Python Workout: 50 ten-minute exercises

A distribution package is a distributable wrapper containing a Python package together with metadata, dependencies, tests, licensing information, and installation instructions.

A distribution package wraps a Python package for sharing. It carries author information, compatible versions, licensing, tests, dependencies, and installation instructions. Distinguish it from the Python package inside it: both commonly use the same name, but the outer directory contains the inner package directory. section 8.10

A minimal distribution workflow includes:

  • Create the package metadata, traditionally in setup.py. section 8.10
  • Use Poetry to create, build, and publish the distribution package. section 8.10
  • Register for PyPI credentials before uploading there. section 8.10
$ poetry new mypackage                  #1
$ cd mypackage                          #2
$ cp -R ~/mypackage-code/* mypackage    #3
$ poetry build                          #4
$ poetry publish                        #5

Follow the compact Poetry command sequence from project creation through building and publishing. section 8.10

How Python Workout: 50 ten-minute exercises covers it

How deep it goes
Explains the nested directory structure and gives a minimal setup.py, Poetry, and PyPI workflow.
Examples
Uses mypackage directories, import statements, and Poetry shell commands as concrete examples.
What it assumes
Assumes familiarity with Python packages and modules while clarifying their distinction from distribution packages.
What you can do after
Operate Poetry to create, build, and publish a distribution package through PyPI.
How it connects
Connects Python packages with modules, dependencies, setup.py, Poetry, and PyPI.

Also explained in

Compare how 2 books explain distribution package →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Python Workout: 50 ten-minute exercises. The section links point to the parts of the book it draws on.