Skip to content

build: move static metadata to pyproject.toml [project] table#30

Draft
hozblok wants to merge 1 commit into
masterfrom
fix/17-pyproject-project-table
Draft

build: move static metadata to pyproject.toml [project] table#30
hozblok wants to merge 1 commit into
masterfrom
fix/17-pyproject-project-table

Conversation

@hozblok
Copy link
Copy Markdown
Owner

@hozblok hozblok commented May 11, 2026

Closes item #17 from ai/improvements_2026-05-09.md.

Problem. All package metadata lived in setup.py. Modern tooling (uv, hatch, pip-tools, dependency scanners, IDE indexers) reads pyproject.toml directly and shouldn't need to invoke setup.py to learn the name, version, classifiers, or dependencies. Setuptools >= 61 has supported declarative [project] for years; the project's build system already requires setuptools>=61 in [build-system].

Fix.

  • pyproject.toml — add a complete [project] table: name, description, readme, license + license-files, authors, requires-python, classifiers, [project.urls], [project.optional-dependencies]. Version stays dynamic (dynamic = ["version"]) so __version__ in src/formula/__init__.py remains the single source of truth. Package discovery moves to [tool.setuptools.package-dir] and [tool.setuptools.packages.find].
  • setup.py — trim to the imperative bits: read __version__, compute BOOST_HEADERS and EXTRA_COMPILE_ARGS, declare the Pybind11Extension, and call setup(version=..., ext_modules=..., cmdclass=...). The version pass-through keeps the VERSION_INFO macro on the C++ side fed from the same string.

Verification. Rebuilt the extension and ran the full pytest suite (316/316). importlib.metadata.metadata('formula') on the installed package reports name, version, summary, license, author email, and all 11 classifiers correctly.

Static metadata (name, description, classifiers, license, authors, urls,
requires-python, optional-dependencies, package layout) now lives in
pyproject.toml's [project] table per PEP 621. setup.py is now a thin
imperative shim: it still owns the version-string read (kept as a single
source of truth, also feeding the VERSION_INFO macro on the C++ side)
and the Pybind11Extension wiring.

This change makes the package legible to modern tooling — uv, pip,
hatch's project introspection, dependency scanners, IDE indexers — that
parse pyproject.toml without invoking setup.py.

Verified by rebuilding the extension, running the full pytest suite
(316/316), and inspecting `importlib.metadata.metadata('formula')` on
the installed package — name, version, summary, license, author email,
classifiers all carry through correctly.

See ai/improvements_2026-05-09.md item #17.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hozblok hozblok force-pushed the fix/17-pyproject-project-table branch from db81245 to b2c9481 Compare June 2, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant