Keywords: dist

# Distributing Python Modules

Greg Ward

E-mail: gward@python.net

### Abstract:

This document describes the Python Distribution Utilities (``Distutils'') from the module developer's point-of-view, describing how to use the Distutils to make Python modules and extensions easily available to a wider audience with very little overhead for build/release/install mechanics.

- Contents
- 1 Introduction
- 2 Concepts & Terminology
  - 2.1 A simple example
  - 2.2 General Python terminology
  - 2.3 Distutils-specific terminology
- 3 Writing the Setup Script
  - 3.1 Listing whole packages
  - 3.2 Listing individual modules
  - 3.3 Describing extension modules
    - 3.3.1 Extension names and packages
    - 3.3.2 Extension source files
    - 3.3.3 Preprocessor options
    - 3.3.4 Library options
- 4 Writing the Setup Configuration File
- 5 Creating a Source Distribution
  - 5.1 Specifying the files to distribute
  - 5.2 Manifest-related options
- 6 Creating Built Distributions
  - 6.1 Creating dumb built distributions
  - 6.2 Creating RPM packages
  - 6.3 Creating Windows installers
- 7 Examples
  - 7.1 Pure Python distribution (by module)
  - 7.2 Pure Python distribution (by package)
  - 7.3 Single extension module
  - 7.4 Multiple extension modules
  - 7.5 Putting it all together
- 8 Extending the Distutils
  - 8.1 Extending existing commands
  - 8.2 Writing new commands
- 9 Reference
  - 9.1 Building modules: the `build` command family
    - 9.1.1 `build`
    - 9.1.2 `build_py`
    - 9.1.3 `build_ext`
    - 9.1.4 `build_clib`
  - 9.2 Installing modules: the `install` command family
    - 9.2.1 `install_lib`
    - 9.2.2 `install_data`
    - 9.2.3 `install_scripts`
  - 9.3 Cleaning up: the `clean` command
  - 9.4 Creating a source distribution: the `sdist` command
  - 9.5 Creating a ``built'' distribution: the `bdist` command family
    - 9.5.1 `blib`
    - 9.5.2 `blib_dumb`
    - 9.5.3 `blib_rpm`
    - 9.5.4 `blib_wise`
- About this document ...