Skip to content

What is PEP 723?

PEP 723 defines a standard format for directly embedding dependency and environment information in Python scripts. This enables standalone scripts to specify their requirements without external configuration files.

Key Features

Metadata Format

  • Uses commented TOML syntax
  • Specifies dependencies
  • Declares Python version requirements
  • Supports environment markers

Integration

  • Tool-agnostic specification
  • Compatible with existing editors
  • Supports script portability

Impact

This PEP simplifies script distribution and execution by allowing dependencies to be self-contained within the script file. See How to write self-contained Python scripts using PEP 723 for a practical guide.

Tools that support PEP 723

  • uv runs a PEP 723 script with uv run script.py, creating an ephemeral environment from the inline metadata.
  • pipx runs the same scripts with pipx run script.py.
  • Hatch and PDM support PEP 723 via hatch run and pdm run.
  • pip added the --requirements-from-script flag in 26.0 (January 2026), which installs the dependencies declared in the inline metadata without running the script itself.

Learn More

Last updated on

Please submit corrections and feedback...