Skip to content

Commit

Permalink
move build configuration from setup.cfg / setup.py to `pyproject.…
Browse files Browse the repository at this point in the history
…toml`
  • Loading branch information
zacharyburnett committed Nov 27, 2023
1 parent 9547509 commit 46edef0
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 57 deletions.
4 changes: 0 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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 *

Expand Down
20 changes: 13 additions & 7 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -139,4 +145,4 @@
# latex_appendices = []

# If false, no module index is generated.
latex_domain_indices = True
latex_domain_indices = True
66 changes: 65 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,67 @@
[project]
name = "wfc3tools"
description = "Python Tools for HST WFC3 Data"
requires-python = ">=3.9"
authors = [
{ name = "STScI", email = "[email protected]" },
]
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"
41 changes: 0 additions & 41 deletions setup.cfg

This file was deleted.

4 changes: 0 additions & 4 deletions setup.py

This file was deleted.

0 comments on commit 46edef0

Please sign in to comment.