From fcaf15fb5706237e4b8dab32e731727c4b05322a Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Tue, 24 Nov 2026 16:54:29 +0100 Subject: [PATCH] refactor: migrate packaging metadata from setup.py to pyproject.toml Move the metadata from setup.py to the [project] table in pyproject.toml (PEP 621), and add a complete [project.urls] section (Homepage, Repository, Issues, Security). setup.py is removed; the version still comes from git tags via setuptools_scm. The Repository URL also fixes the old DIRACGrid/cfg name (now diraccfg). --- pyproject.toml | 35 +++++++++++++++++++++++++++++++++-- setup.py | 42 ------------------------------------------ 2 files changed, 33 insertions(+), 44 deletions(-) delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml index 970c5dd..c172a6d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,42 @@ [build-system] -requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"] +requires = ["setuptools>=61", "setuptools_scm[toml]>=3.4"] build-backend = "setuptools.build_meta" # Enable setuptools_scm to compute the version number from the most recent tag # https://github.com/pypa/setuptools_scm/#pyprojecttoml-usage [tool.setuptools_scm] +[project] +name = "diraccfg" +description = "DIRAC cfg files reader" +readme = "README.md" +requires-python = ">=3.9" +license = {text = "GPL-3.0-only"} +authors = [{ name = "Federico Stagni" }] +classifiers = [ + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Operating System :: OS Independent", +] +dynamic = ["version"] + +[project.urls] +Homepage = "https://diracgrid.org" +Repository = "https://github.com/DIRACGrid/diraccfg" +Issues = "https://github.com/DIRACGrid/diraccfg/issues" +Security = "https://github.com/DIRACGrid/diraccfg/security/policy" + +[project.optional-dependencies] +testing = ["pytest>=4.6", "pytest-cov", "pylint>=1.6.5"] + +[project.scripts] +diraccfg = "diraccfg.__main__:parseArgs" + +[tool.setuptools.packages.find] +where = ["src"] + [tool.black] line-length = 120 target-version = ['py39'] @@ -42,7 +73,7 @@ python = "3.10.*" python = "3.11.*" [tool.pixi.feature.testing.pypi-dependencies] -# pytest, pytest-cov and pylint come from setup.py's `testing` extra +# pytest, pytest-cov and pylint come from the `testing` extra diraccfg = { path = ".", editable = true, extras = ["testing"] } mypy = "*" diff --git a/setup.py b/setup.py deleted file mode 100644 index 717823a..0000000 --- a/setup.py +++ /dev/null @@ -1,42 +0,0 @@ -import os -import setuptools - -with open(os.path.join(os.path.dirname(__file__), "README.md")) as fh: - long_description = fh.read() - -test_requires = [ - "pytest>=4.6", - "pytest-cov", - "pylint>=1.6.5", -] - -setuptools.setup( - name="diraccfg", - use_scm_version=True, - author="Federico Stagni", - description="DIRAC cfg files reader", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/DIRACGrid/cfg", - packages=setuptools.find_packages("src"), - package_dir={"": "src"}, - license="GPL-3.0-only", - test_suite="tests", - setup_requires=["setuptools_scm"], - include_package_data=True, - install_requires=[], - extras_require={ - "testing": test_requires, - }, - entry_points={ - "console_scripts": ["diraccfg=diraccfg.__main__:parseArgs"], - }, - classifiers=[ - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", - "Operating System :: OS Independent", - ], - python_requires=">=3.9", -)