From 46edef0117903ff030d97aa278a071cd4e724272 Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Mon, 27 Nov 2023 09:50:31 -0500 Subject: [PATCH] move build configuration from `setup.cfg` / `setup.py` to `pyproject.toml` --- MANIFEST.in | 4 --- docs/conf.py | 20 +++++++++------ pyproject.toml | 66 +++++++++++++++++++++++++++++++++++++++++++++++++- setup.cfg | 41 ------------------------------- setup.py | 4 --- 5 files changed, 78 insertions(+), 57 deletions(-) delete mode 100644 setup.cfg delete mode 100755 setup.py diff --git a/MANIFEST.in b/MANIFEST.in index 955cb2b..c19edfa 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,12 +1,8 @@ include README.rst include CHANGES.rst -include setup.cfg include LICENSE.txt include pyproject.toml -include setup.py -include setup.cfg - recursive-include docs * recursive-include wfc3tools * diff --git a/docs/conf.py b/docs/conf.py index 37ccf18..f7b56c1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -9,13 +9,19 @@ from configparser import ConfigParser import datetime import os +from pathlib import Path import sys from wfc3tools import __version__ -conf = ConfigParser() -conf.read([os.path.join(os.path.dirname(__file__), '..', 'setup.cfg')]) -setup_cfg = dict(conf.items('metadata')) +if sys.version_info < (3, 11): + import tomli as tomllib +else: + import tomllib + +with open(Path(__file__).parent.parent / "pyproject.toml", "rb") as configuration_file: + metadata = tomllib.load(configuration_file)["project"] + # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, @@ -28,9 +34,9 @@ # -- Project information ----------------------------------------------------- -project = setup_cfg['name'] -author = setup_cfg['author'] -copyright = '{0}, {1}'.format(datetime.datetime.now().year, author) +project = metadata["name"] +author = f'{metadata["authors"][0]["name"]}' +copyright = f"{datetime.datetime.now().year}, {author}" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -139,4 +145,4 @@ # latex_appendices = [] # If false, no module index is generated. -latex_domain_indices = True \ No newline at end of file +latex_domain_indices = True diff --git a/pyproject.toml b/pyproject.toml index 3284ad2..418efb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,67 @@ +[project] +name = "wfc3tools" +description = "Python Tools for HST WFC3 Data" +requires-python = ">=3.9" +authors = [ + { name = "STScI", email = "help@stsci.edu" }, +] +classifiers = [ + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Topic :: Scientific/Engineering :: Astronomy", + "Topic :: Software Development :: Libraries :: Python Modules", +] +dependencies = [ + "astropy>=4.2.0", + "numpy>=1.21.0", + "matplotlib>=3.5.1", + "stsci.tools>=4.0.1", + "scipy>=1.8.0", +] +dynamic = [ + "version", +] +github-project = "spacetelescope/wfc3tools" +description-file = "README.rst" + +[project.readme] +file = "README.rst" +content-type = "text/x-rst" + +[project.license] +file = "LICENSE.txt" +content-type = "text/plain" + +[project.urls] +Homepage = "http://wfc3tools.readthedocs.io/" +"Bug Reports" = "https://github.com/spacetelescope/wfc3tools/issues/" +Source = "https://github.com/spacetelescope/wfc3tools/" +Help = "https://hsthelp.stsci.edu" +homepage = "http:://wfc3tools.readthedocs.io/" + +[project.optional-dependencies] +docs = [ + "sphinx", + "sphinx-automodapi", + "sphinx-rtd-theme", +] + [build-system] -requires = ["setuptools>=42", "setuptools_scm[toml]>=3.4", "wheel"] +requires = [ + "setuptools>=61.2", + "setuptools_scm[toml]>=6.2", + "wheel", +] build-backend = "setuptools.build_meta" + +[tool.setuptools] +zip-safe = false +include-package-data = false + +[tool.setuptools.packages.find] +namespaces = false + +[tool.setuptools_scm] +write_to = "wfc3tools/version.py" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index eacd059..0000000 --- a/setup.cfg +++ /dev/null @@ -1,41 +0,0 @@ -[metadata] -name = wfc3tools -description = Python Tools for HST WFC3 Data -long_description = A package which contains wrappers for the calwf3 reduction scripts and tools to aid data analysis. -author = STScI -author_email = help@stsci.edu -license = BSD -github_project = spacetelescope/wfc3tools -description_file = README.rst -url = http://wfc3tools.readthedocs.io/ -homepage = http:://wfc3tools.readthedocs.io/ -project_urls = - Bug Reports = https://github.com/spacetelescope/wfc3tools/issues/ - Source = https://github.com/spacetelescope/wfc3tools/ - Help = https://hsthelp.stsci.edu -classifier= - Intended Audience :: Science/Research - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Programming Language :: Python - Topic :: Scientific/Engineering :: Astronomy - Topic :: Software Development :: Libraries :: Python Modules - -[options] -packages = find: -zip_safe=False -python_requires = >=3.9 -setup_requires = - setuptools_scm -install_requires = - astropy>=4.2.0 - numpy>=1.21.0 - matplotlib>=3.5.1 - stsci.tools>=4.0.1 - scipy>=1.8.0 - -[options.extras_require] -docs = - sphinx - sphinx-automodapi - sphinx-rtd-theme \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100755 index f2207ea..0000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env python -from setuptools import setup - -setup(use_scm_version={'write_to': 'wfc3tools/version.py'})