python-packaging · git:20260920.677b300 · 2026-09-20 · sha256 64cfd3967ac7f995

python-packaging git:20260920.677b300A

Immutable. This exact content never changes and is served at /api/v1/blob/64cfd3967ac7f995.

---
name: python-packaging
description: Modern Python project configuration. Use for pyproject.toml, PEP 621, PEP 723 inline script metadata, uv init, dependencies, or migrating off setup.py and requirements.txt.
trigger: pyproject.toml, PEP 621, PEP 723, setup.py, requirements.txt, python packaging, dependencies, uv init, inline script
metadata:
  provenance:
    class: cpp-authored
---

# Python Packaging Best Practices

This skill covers PEP 621 (pyproject.toml metadata) and PEP 723 (inline script metadata) for modern Python projects using uv.

## When Activated

Read the full topic skill at: `docs/skills/python-packaging.md`

## Quick Reference

**Always use `pyproject.toml`** with PEP 621 `[project]` table. Never `setup.py` or `requirements.txt` for new projects.

**For single-file scripts**, use PEP 723 inline metadata (`# /// script` block) so `uv run` auto-installs dependencies.

**Key commands:**
```bash
uv init my-project           # Creates PEP 621 pyproject.toml
uv add requests              # Adds to [project.dependencies]
uv add --dev pytest          # Adds to [dependency-groups]
uv run script.py             # Reads PEP 723 metadata, auto-installs
uv add --script s.py rich    # Add dep to inline script metadata
```