PYTHON Contents

Build and Wheels (sdist, wheel)

Build wheels as immutable artifacts, then install and smoke test them in a clean environment to match production behavior.

On this page

Build Once, Deploy Many

Treat build artifacts as immutable. CI should build the wheel, then install that wheel into a clean environment and run smoke tests.

Artifact Strategy

  • wheel: fast installs, fewer surprises
  • sdist: fallback for building wheels

Smoke Test Pattern

# Conceptual CI steps:
# 1) build wheel
# 2) create clean venv
# 3) install wheel
# 4) run import + a basic command

Operational Checklist

  • Do not deploy from a working tree; deploy from artifacts.
  • Install in a clean environment to catch missing files and bad metadata.
  • Keep artifact provenance (git sha, build id, dependency lock).

Failure Modes

  • Works on my machine: missing package files only show up after install.
  • Mutable deploy: code changes between build and deploy break rollback safety.