From a899b497478e9063e3d251c53017984c98f3be08 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 9 Oct 2024 12:52:55 +0200 Subject: [PATCH] setup.cfg->pyproject.toml, setuptools_scm * Move most package configuration to pyproject.toml * Use setuptools_scm for automated generation of version numbers based on git tags * replace version.py by dynamic version --- fiddy/__init__.py | 9 +++++++- fiddy/version.py | 1 - pyproject.toml | 42 ++++++++++++++++++++++++++++++++---- setup.cfg | 55 ----------------------------------------------- setup.py | 5 ----- tox.ini | 2 ++ 6 files changed, 48 insertions(+), 66 deletions(-) delete mode 100644 fiddy/version.py delete mode 100644 setup.py diff --git a/fiddy/__init__.py b/fiddy/__init__.py index f3136c6..e26fc27 100644 --- a/fiddy/__init__.py +++ b/fiddy/__init__.py @@ -1,3 +1,6 @@ +# from .gradient_check import gradient_check +from importlib.metadata import PackageNotFoundError, version + from .constants import * from .derivative import Derivative, get_derivative from .directional_derivative import methods @@ -9,4 +12,8 @@ # from . import quotient from .step import step -# from .gradient_check import gradient_check +try: + __version__ = version("fiddy") +except PackageNotFoundError: + # package is not installed + pass diff --git a/fiddy/version.py b/fiddy/version.py deleted file mode 100644 index f102a9c..0000000 --- a/fiddy/version.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.0.1" diff --git a/pyproject.toml b/pyproject.toml index 68f5c7b..41f712b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,44 @@ [build-system] -requires = [ - "setuptools>=42", - "wheel" -] +requires = ["setuptools>=64", "setuptools-scm>=8"] build-backend = "setuptools.build_meta" +[project] +name = "fiddy" +description = "Finite difference methods" +readme = "README.md" +dynamic = ["version"] +license = { file = "LICENSE" } +authors = [ + { name = "The fiddy developers", email = "dilan.pathirana@uni-bonn.de" } +] +keywords = ["finite difference", "gradient check", "difference quotient"] +classifiers = [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.10", +] +dependencies = [ + "joblib", + "numpy", + "pandas" +] +requires-python = ">=3.10" + +[project.urls] +Homepage = "https://github.com/icb-dcm/fiddy" +Documentation = "https://fiddy.readthedocs.io" +Repository = "https://github.com/icb-dcm/fiddy" +"Bug Tracker" = "https://github.com/icb-dcm/fiddy/issues" + +[tool.setuptools.packages.find] +include = ["fiddy*"] + +[tool.setuptools_scm] + [tool.ruff] line-length = 79 target-version = "py310" diff --git a/setup.cfg b/setup.cfg index 94827e2..5ff3715 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,54 +1,3 @@ -[metadata] -name = fiddy -version = attr: fiddy.version.__version__ -description = Finite difference methods -long_description = file: README.md -long_description_content_type = text/markdown - -# URLs -url = https://github.com/icb-dcm/fiddy -download_url = https://github.com/icb-dcm/fiddy/releases -project_urls = - Bug Tracker = https://github.com/icb-dcm/fiddy/issues - Documentation = https://fiddy.readthedocs.io - Changelog = https://fiddy.readthedocs.io/en/latest/changelog.html - -# Author information -author = The fiddy developers -author_email = dilan.pathirana@uni-bonn.de - -# License information -license = BSD-3-Clause -license_files = LICENSE - -# Search tags -classifiers = - Development Status :: 4 - Beta - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3.12 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.10 -keywords = - finite difference - gradient check - -[options] -install_requires = - joblib - numpy - pandas - -python_requires = >=3.10 -include_package_data = True - -# Where is my code -packages = find: - -[options.packages.find] -include = fiddy* - [options.extras_require] all = %(amici)s @@ -72,7 +21,3 @@ tests = scipy sympy more-itertools - -[bdist_wheel] -# Requires Python 3 -universal = False diff --git a/setup.py b/setup.py deleted file mode 100644 index 8ab9498..0000000 --- a/setup.py +++ /dev/null @@ -1,5 +0,0 @@ -# setup.py is still needed for editable installs - -import setuptools - -setuptools.setup() diff --git a/tox.ini b/tox.ini index 0ac4bad..5419215 100644 --- a/tox.ini +++ b/tox.ini @@ -40,6 +40,8 @@ description = Check the package friendliness [testenv:doc] +allowlist_externals = + sphinx-build extras = doc commands =