Skip to content

Commit e994fc4

Browse files
authored
chore: move metadata to pyproject.toml (#245)
Assisted-by: ClaudeCode:claude-opus-5-5
1 parent 41d6080 commit e994fc4

2 files changed

Lines changed: 19 additions & 12 deletions

File tree

‎pyproject.toml‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
[build-system]
22
requires = [
3-
"setuptools>=42",
3+
"setuptools>=61",
44
"pybind11>=2.10.0",
55
]
66
build-backend = "setuptools.build_meta"
77

8+
[project]
9+
name = "python_example"
10+
version = "0.0.1"
11+
description = "A test project using pybind11"
12+
authors = [{ name = "Sylvain Corlay", email = "sylvain.corlay@gmail.com" }]
13+
requires-python = ">=3.11"
14+
15+
[project.urls]
16+
Homepage = "https://github.com/pybind/python_example"
17+
18+
[project.optional-dependencies]
19+
test = ["pytest"]
20+
821

922
[tool.cibuildwheel]
1023
test-command = "python {project}/tests/test.py"

‎setup.py‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# Available at setup time due to pyproject.toml
2+
import tomllib
3+
from pathlib import Path
4+
25
from pybind11.setup_helpers import Pybind11Extension, build_ext
36
from setuptools import setup
47

5-
__version__ = "0.0.1"
8+
with Path(__file__).with_name("pyproject.toml").open("rb") as f:
9+
__version__ = tomllib.load(f)["project"]["version"]
610

711
# The main interface is through Pybind11Extension.
812
# * You can add cxx_std=11/14/17, and then build_ext can be removed.
@@ -23,18 +27,8 @@
2327
]
2428

2529
setup(
26-
name="python_example",
27-
version=__version__,
28-
author="Sylvain Corlay",
29-
author_email="sylvain.corlay@gmail.com",
30-
url="https://github.com/pybind/python_example",
31-
description="A test project using pybind11",
32-
long_description="",
3330
ext_modules=ext_modules,
34-
extras_require={"test": "pytest"},
3531
# Currently, build_ext only provides an optional "highest supported C++
3632
# level" feature, but in the future it may provide more features.
3733
cmdclass={"build_ext": build_ext},
38-
zip_safe=False,
39-
python_requires=">=3.11",
4034
)

0 commit comments

Comments
 (0)