PEP 621 [0] designated pyproject.toml as the standard place to store project metadata. Setuptools, the build system used by this project, has support for reading metadata from this location. As such, migrate the majority of the metadata out of `setup.py`. For now, the external modules are left declared in `setup.py` because support within pyproject.toml is still experimental [1]. New metadata has been added/updated, namely: * Add Trove classifiers * Add a link to the issues page * Update license from LGPL-2.1 to LGPL-2.1+ to match SPDX identifier [0]: https://peps.python.org/pep-0621/ [1]: https://setuptools.pypa.io/en/stable/userguide/ext_modules.html#pyproject-toml Closes: https://github.com/brgl/libgpiod/issues/107 Signed-off-by: Vincent Fazio <vfazio@xxxxxxxxxxx> --- bindings/python/pyproject.toml | 43 +++++++++++++++++++++++++++++++++- bindings/python/setup.py | 20 +--------------- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index d6f5f9b..dbc0c7d 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -2,7 +2,48 @@ # SPDX-FileCopyrightText: 2023 Phil Howard <phil@xxxxxxxxxxxxx> [build-system] -requires = ["setuptools", "wheel", "packaging"] +requires = ["setuptools>=69.0.0", "wheel", "packaging"] +build-backend = "setuptools.build_meta" + +[project] +name = "gpiod" +dynamic = ["version"] +description = "Python bindings for libgpiod" +readme = "README.md" +license = {text = "LGPL-2.1-or-later"} +requires-python = ">=3.9.0" +authors = [ + {name = "Bartosz Golaszewski", email = "brgl@xxxxxxxx"}, +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)", + "Operating System :: POSIX :: Linux", + "Typing :: Typed", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] + +[project.urls] +Homepage = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git" +Issues = "https://github.com/brgl/libgpiod/issues/" + +[tool.setuptools] +platforms = ["linux"] +include-package-data = false + +[tool.setuptools.dynamic] +version = {attr = "gpiod.version.__version__"} + +[tool.setuptools.packages.find] +include = ["gpiod"] +namespaces = false [tool.mypy] python_version = "3.9" diff --git a/bindings/python/setup.py b/bindings/python/setup.py index 0d518af..1af4709 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -4,7 +4,7 @@ from os import getenv, path, unlink from shutil import copytree, rmtree -from setuptools import Extension, find_packages, setup +from setuptools import Extension, setup from setuptools.command.build_ext import build_ext as orig_build_ext from setuptools.command.sdist import log from setuptools.command.sdist import sdist as orig_sdist @@ -18,11 +18,6 @@ TAR_FILENAME = "libgpiod-{version}.tar.gz" ASC_FILENAME = "sha256sums.asc" SHA256_CHUNK_SIZE = 2048 -# __version__ -with open("gpiod/version.py", "r") as fd: - exec(fd.read()) - - def sha256(filename): """ Return a sha256sum for a specific filename, loading the file in chunks @@ -225,19 +220,6 @@ gpiod_ext = Extension( ) setup( - name="gpiod", - url="https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git", - packages=find_packages(exclude=["tests", "tests.*"]), - package_data={"gpiod": ["py.typed", "_ext.pyi"]}, - python_requires=">=3.9.0", ext_modules=[gpiod_ext], cmdclass={"build_ext": build_ext, "sdist": sdist}, - version=__version__, - author="Bartosz Golaszewski", - author_email="brgl@xxxxxxxx", - description="Python bindings for libgpiod", - long_description=open("README.md", "r").read(), - long_description_content_type="text/markdown", - platforms=["linux"], - license="LGPLv2.1", ) -- 2.34.1