diff --git a/pyproject.toml b/pyproject.toml index a01afce..722a276 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,23 @@ [build-system] requires = [ - "setuptools>=42", + "setuptools>=61", "pybind11>=2.10.0", ] build-backend = "setuptools.build_meta" +[project] +name = "python_example" +version = "0.0.1" +description = "A test project using pybind11" +authors = [{ name = "Sylvain Corlay", email = "sylvain.corlay@gmail.com" }] +requires-python = ">=3.11" + +[project.urls] +Homepage = "https://github.com/pybind/python_example" + +[project.optional-dependencies] +test = ["pytest"] + [tool.cibuildwheel] test-command = "python {project}/tests/test.py" diff --git a/setup.py b/setup.py index 51dcd69..b795cd0 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,12 @@ # Available at setup time due to pyproject.toml +import tomllib +from pathlib import Path + from pybind11.setup_helpers import Pybind11Extension, build_ext from setuptools import setup -__version__ = "0.0.1" +with Path(__file__).with_name("pyproject.toml").open("rb") as f: + __version__ = tomllib.load(f)["project"]["version"] # The main interface is through Pybind11Extension. # * You can add cxx_std=11/14/17, and then build_ext can be removed. @@ -23,18 +27,8 @@ ] setup( - name="python_example", - version=__version__, - author="Sylvain Corlay", - author_email="sylvain.corlay@gmail.com", - url="https://github.com/pybind/python_example", - description="A test project using pybind11", - long_description="", ext_modules=ext_modules, - extras_require={"test": "pytest"}, # Currently, build_ext only provides an optional "highest supported C++ # level" feature, but in the future it may provide more features. cmdclass={"build_ext": build_ext}, - zip_safe=False, - python_requires=">=3.11", )