From 972e66077d445130843ccd185199f456c1e7506b Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 15 Oct 2024 12:11:52 +0200 Subject: [PATCH] Set up setuptools_scm Set up setuptools_scm and move most package configuration to pyproject.toml. --- petab_select/version.py | 2 -- pyproject.toml | 57 ++++++++++++++++++++++++++++++++--- setup.py | 66 ----------------------------------------- 3 files changed, 53 insertions(+), 72 deletions(-) delete mode 100644 petab_select/version.py diff --git a/petab_select/version.py b/petab_select/version.py deleted file mode 100644 index 6312a57b..00000000 --- a/petab_select/version.py +++ /dev/null @@ -1,2 +0,0 @@ -"""Version of the model selection extension for PEtab.""" -__version__ = '0.1.13' diff --git a/pyproject.toml b/pyproject.toml index 50c68ba9..063551f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,59 @@ [build-system] -requires = [ - "setuptools>=42", - "wheel" -] +requires = ["setuptools>=64", "setuptools-scm>=8"] build-backend = "setuptools.build_meta" +[project] +name = "petab_select" +dynamic = ["version"] +maintainers = [ + {name = "Dilan Pathirana", email = "dilan.pathirana@uni-bonn.de"}, +] +authors = [ + {name = "The PEtab Select developers"}, +] +description = "PEtab Select: an extension to PEtab for model selection." +readme = "README.md" +requires-python = ">=3.10" +license = {text = "BSD-3-Clause"} +dependencies = [ + # TODO minimum versions + "more-itertools", + "numpy", + "pandas", + "petab", + "pyyaml", + "click", + "dill", +] +[project.optional-dependencies] +test = [ + "pytest >= 5.4.3", + "pytest-cov >= 2.10.0", + "amici >= 0.11.25", + "fides >= 0.7.5", + "pypesto > 0.2.13", +] +doc = [ + "sphinx>=3.5.3,<7", + "sphinxcontrib-napoleon>=0.7", + "sphinx-markdown-tables>=0.0.15", + "sphinx-rtd-theme>=0.5.1", + "recommonmark>=0.7.1", + # pin until ubuntu comes with newer pandoc: + # /home/docs/checkouts/readthedocs.org/user_builds/petab-select/envs/63/lib/python3.11/site-packages/nbsphinx/__init__.py:1058: RuntimeWarning: You are using an unsupported version of pandoc (2.9.2.1). + # Your version must be at least (2.14.2) but less than (4.0.0). + "nbsphinx==0.9.1", + "nbconvert<7.5.0", + "ipython>=7.21.0", + "readthedocs-sphinx-ext>=2.2.5", + "sphinx-autodoc-typehints", +] + +[project.scripts] +petab_select = "petab_select.cli:cli" + +[tool.setuptools_scm] + [tool.black] line-length = 79 target-version = ['py37', 'py38', 'py39'] diff --git a/setup.py b/setup.py index 6e4d3ea8..f657616f 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ import os import re -import sys from setuptools import find_packages, setup @@ -30,77 +29,12 @@ def absolute_links(txt): return txt -minimum_python_version = '3.10' -if sys.version_info < tuple(map(int, minimum_python_version.split('.'))): - sys.exit(f'PEtab Select requires Python >= {minimum_python_version}') - -# read version from file -__version__ = '' -version_file = os.path.join('petab_select', 'version.py') -# sets __version__ -exec(read(version_file)) # pylint: disable=W0122 # nosec - -ENTRY_POINTS = { - 'console_scripts': [ - 'petab_select = petab_select.cli:cli', - ] -} - # project metadata # noinspection PyUnresolvedReferences setup( - name='petab_select', - version=__version__, - description='PEtab Select: an extension to PEtab for model selection.', long_description=absolute_links(read('README.md')), long_description_content_type="text/markdown", - # author='The PEtab Select developers', - # author_email='dilan.pathirana@uni-bonn.de', url=f'https://github.com/{org}/{repo}', packages=find_packages(exclude=['doc*', 'test*']), - install_requires=[ - # TODO minimum versions - 'more-itertools', - 'numpy', - 'pandas', - 'petab', - 'pyyaml', - #'python-libsbml>=5.17.0', - #'sympy', - # required for CLI - 'click', - 'dill', - # plotting - #'matplotlib>=2.2.3', - #'seaborn', - ], include_package_data=True, - python_requires=f'>={minimum_python_version}', - entry_points=ENTRY_POINTS, - extras_require={ - 'test': [ - 'pytest >= 5.4.3', - 'pytest-cov >= 2.10.0', - 'amici >= 0.11.25', - 'fides >= 0.7.5', - # FIXME - 'pypesto > 0.2.13', - # 'pypesto @ git+https://github.com/ICB-DCM/pyPESTO.git@develop#egg=pypesto', - ], - 'doc': [ - 'sphinx>=3.5.3,<7', - 'sphinxcontrib-napoleon>=0.7', - 'sphinx-markdown-tables>=0.0.15', - 'sphinx-rtd-theme>=0.5.1', - 'recommonmark>=0.7.1', - # pin until ubuntu comes with newer pandoc: - # /home/docs/checkouts/readthedocs.org/user_builds/petab-select/envs/63/lib/python3.11/site-packages/nbsphinx/__init__.py:1058: RuntimeWarning: You are using an unsupported version of pandoc (2.9.2.1). - # Your version must be at least (2.14.2) but less than (4.0.0). - 'nbsphinx==0.9.1', - 'nbconvert<7.5.0', - 'ipython>=7.21.0', - 'readthedocs-sphinx-ext>=2.2.5', - 'sphinx-autodoc-typehints', - ], - }, )