getsentry / getsentry/sentry-python

Migrate package metadata from setup.py to pyproject.toml (PEP 621)

Abierto
#6,420 1 comentario 0 reacciones 1 asignado Reclamado por @sl0thentr0py Ver en GitHub
Python Task
Lenguaje dominante
Python
Estrellas
2.2k
Forks
669
Merge medio
1 d 1 h
PR fusionados (30 d)
213

Descripción

## Background

The package metadata still lives in `setup.py` (name, version, dependencies, extras, entry points, classifiers, etc.). `pyproject.toml` currently only carries tool configuration (coverage, pytest, mypy, ruff).

With the tox/uv migration landing (see #6325, #6327, #6367, and the rest of the `chore/migrate-to-tox-uv` work), the distribution itself is the last piece still using legacy setuptools configuration. Moving to PEP 621 `[project]` metadata would:

- Make the project introspectable by modern tooling (`uv sync`, `uv add`, `pip install .` without executing arbitrary Python, build frontends, dependency scanners, SBOM tools).
- Eliminate the `setup.py` execution step during builds.
- Align with the direction setuptools itself recommends.

## Scope

Port everything currently in `setup.py` into `pyproject.toml`:

- [ ] `[build-system]` table (setuptools backend)
- [ ] `[project]` table: `name`, `version`, `description`, `readme`, `requires-python`, `license`, `authors`, `urls`, `classifiers`
- [ ] `[project] dependencies` ← `install_requires`
- [ ] `[project.optional-dependencies]` ← `extras_require` (all ~40 extras — names must match exactly; they're public API)
- [ ] `[project.entry-points.\"opentelemetry_propagator\"]` ← `entry_points`
- [ ] `[tool.setuptools] zip-safe = false`
- [ ] `[tool.setuptools.package-data]` for `py.typed` (PEP 561)
- [ ] `[tool.setuptools.packages.find]` with `tests*` excluded
- [ ] Verify `MANIFEST.in` still behaves correctly (or fold into `include-package-data`)
- [ ] Update release tooling (`.craft.yml`, version-bump scripts) to read/write the version in `pyproject.toml` instead of `setup.py`
- [ ] Remove `setup.py` once the above is verified

## Verification

- [ ] `python -m build` produces an sdist + wheel byte-identical in contents (modulo metadata format) to the current release
- [ ] `pip install sentry-sdk[flask]`, `[django]`, `[opentelemetry]`, etc. resolve identically
- [ ] `py.typed` is shipped in the wheel
- [ ] `tests/` is **not** shipped in the wheel
- [ ] OTel propagator entry point is discoverable post-install
- [ ] Release pipeline dry-run succeeds

## Risks

- Public-facing extras names — a typo silently breaks `pip install sentry-sdk[name]`.
- Version bump automation — release tooling likely greps `setup.py`.
- `python_requires=\">=3.6\"` in current `setup.py` looks stale vs. the rest of the repo; worth confirming the intended floor before carrying it forward.

## Related

- Tox/uv migration: #6325, #6327, #6367, et al.
- #6121 (removed `bdist_wheel` universal option)
- #5932 (license classifier inconsistency — pyproject migration is a chance to fix cleanly via `license` field)

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.