From 2ec4715d41a06490ddea65d0d182231b0412ee4d Mon Sep 17 00:00:00 2001 From: Kwabena Amponsah Date: Wed, 15 Jul 2026 10:16:45 +0100 Subject: [PATCH] #303 Move packaging config from setup.py to pyproject.toml --- .github/workflows/pytest.yml | 2 +- .isort.cfg | 14 ------ pyproject.toml | 87 +++++++++++++++++++++++++++++++++++- setup.py | 86 ----------------------------------- 4 files changed, 87 insertions(+), 102 deletions(-) delete mode 100644 .isort.cfg delete mode 100644 setup.py diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index f15ea9f17..8204c586e 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -25,7 +25,7 @@ jobs: python3 -m flake8 - name: Test sorting with isort run: | - python3 -m isort --verbose --check-only --diff chaste_codegen tests setup.py + python3 -m isort --verbose --check-only --diff chaste_codegen tests - name: Test with pytest run: | python3 -m pytest --cov --cov-config=.coveragerc diff --git a/.isort.cfg b/.isort.cfg deleted file mode 100644 index a8217c52f..000000000 --- a/.isort.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[isort] -line_length = 120 -multi_line_output = 3 -# ^ Vertical Hanging Indent -force_grid_wrap = 4 -# ^ Don't allow more than 3 imports on a single line -lines_after_imports = 2 -order_by_type = True -include_trailing_comma = True -force_single_line = False - -default_section = THIRDPARTY -known_first_party = chaste_codegen -skip = diff --git a/pyproject.toml b/pyproject.toml index fed528d4a..d22fccaad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,88 @@ [build-system] -requires = ["setuptools"] +requires = ["setuptools>=64", "wheel"] build-backend = "setuptools.build_meta" + +[project] +name = "chaste_codegen" +description = "Code generation for cardiac Chaste" +readme = "README.md" +requires-python = ">=3.10" +authors = [ + {name = "Maurice Hendrix"}, + {name = "Michael Clerx"}, + {name = "Jonathan Cooper"}, +] +maintainers = [ + {name = "Kwabena Amponsah", email = "Kwabena.Amponsah1@nottingham.ac.uk"}, +] +classifiers = [ + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", +] +dependencies = [ + "py>=1.10.0", + "decorator>=4.5", + "importlib-metadata>=1.7", + "isodate>=0.6", + "lxml>=4.7", + "MarkupSafe>=1.2", + "mpmath>=1.1", + "networkx>=2.4", + "packaging>=20.4", + "Pint>=0.9, <0.20", + "pyparsing>=2.4.7, <4", + "rdflib>=5.0", + "six>=1.15", + "sympy>=1.9, <1.11", + "zipp>=1.2", + "Jinja2>=3.0", + "cellmlmanip>=0.3.7", +] +dynamic = ["version"] + +[project.optional-dependencies] +docs = [ + "sphinx>=3.0", + "sphinx-automodapi>=0.12", +] +test = [ + "pytest-cov>=2.10", # For coverage checking + "pytest>=4.6", # For unit tests + "flake8>=3", # For code style checking + "isort", + "mock>=3.0.5", # For mocking command line args etc. +] + +[project.urls] +Homepage = "https://github.com/ModellingWebLab/chaste-codegen" + +[project.scripts] +chaste_codegen = "chaste_codegen._command_line_script:chaste_codegen" + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.dynamic] +version = {file = "chaste_codegen/version.txt"} + +[tool.setuptools.packages.find] +include = ["chaste_codegen*"] + +[tool.isort] +line_length = 120 +multi_line_output = 3 +# ^ Vertical Hanging Indent +force_grid_wrap = 4 +# ^ Don't allow more than 3 imports on a single line +lines_after_imports = 2 +order_by_type = true +include_trailing_comma = true +force_single_line = false +default_section = "THIRDPARTY" +known_first_party = ["chaste_codegen"] diff --git a/setup.py b/setup.py deleted file mode 100644 index e44359fef..000000000 --- a/setup.py +++ /dev/null @@ -1,86 +0,0 @@ -# -# Chaste codegen setuptools script -# -import os - -from setuptools import find_packages, setup - - -# Load text for description -with open('README.md') as f: - readme = f.read() - -# Load version number -with open(os.path.join('chaste_codegen', 'version.txt'), 'r') as f: - version = f.read() - -# Go! -setup( - # Module name (lowercase) - name='chaste_codegen', - - version=version, - description='Code generation for cardiac Chaste', - long_description=readme, - long_description_content_type="text/markdown", - author='Maurice Hendrix, Michael Clerx, Jonathan Cooper', - author_email='Maurice.Hendrix@nottingham.ac.uk', - maintainer='Maurice Hendrix', - maintainer_email='Maurice.Hendrix@nottingham.ac.uk', - url='https://github.com/ModellingWebLab/chaste-codegen', - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - ], - - # Packages to include - packages=find_packages( - include=('chaste_codegen', 'chaste_codegen.*')), - - # Include non-python files (via MANIFEST.in) - include_package_data=True, - - # Required Python version - python_requires='>=3.6', - - # List of dependencies - install_requires=[ - 'py>=1.10.0', - 'decorator>=4.5', - 'importlib-metadata>=1.7', - 'isodate>=0.6', - 'lxml>=4.7', - 'MarkupSafe>=1.2', - 'mpmath>=1.1', - 'networkx>=2.4', - 'packaging>=20.4', - 'Pint>=0.9, <0.20', - 'pyparsing>=2.4.7, <4', - 'rdflib>=5.0', - 'six>=1.15', - 'sympy>=1.9, <1.11', - 'zipp>=1.2', - 'Jinja2>=3.0', - 'cellmlmanip>=0.3.7', - ], - extras_require={ - 'docs': [ - 'sphinx>=3.0', - 'sphinx-automodapi>=0.12', - ], - 'test': [ - 'pytest-cov>=2.10', # For coverage checking - 'pytest>=4.6', # For unit tests - 'flake8>=3', # For code style checking - 'isort', - 'mock>=3.0.5', # For mocking command line args etc. - ], - }, - entry_points={ - 'console_scripts': [ - 'chaste_codegen=' - 'chaste_codegen._command_line_script:chaste_codegen', - ], - }, -)