Skip to content

Commit

Permalink
Convert setup.cfg to pyproject.toml (#260)
Browse files Browse the repository at this point in the history
* Convert setup.cfg to pyproject.toml

* Remove setup.py

* Make filename of version.py consistent with past usage

* Remove extra blank line

* Expand & update requirements

* Remove packaging as a dependency

* Remove developer set of dependencies

* Alphabetize requirements

* Stop using requirements files for Nox sessions

* Remove requirements files as no longer needed

* Update requirements & usage for tests/docs/dev

* Fix ipywidgets dependency

* Install setuptools for doc builds to get pkg_resources

* Relax requirement on docutils

* Require setuptools for Python ≥ 3.12 to get pkg_resources
  • Loading branch information
namurphy authored Jun 28, 2024
1 parent e01871d commit d7d18c3
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 225 deletions.
12 changes: 4 additions & 8 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

@nox.session(python=python_versions)
def tests(session):
session.install("-r", "requirements/tests.txt")
session.install(".")
session.install(".[dev,tests]")
session.run("pytest", *pytest_options)


Expand All @@ -40,8 +39,7 @@ def import_package(session):

@nox.session
def build_docs(session):
session.install("-r", "requirements/docs.txt")
session.install(".")
session.install(".[dev,docs]")
session.run(
"sphinx-build",
*sphinx_opts,
Expand All @@ -51,8 +49,7 @@ def build_docs(session):

@nox.session
def build_docs_nitpicky(session):
session.install("-r", "requirements/docs.txt")
session.install(".")
session.install(".[dev,docs]")
session.run(
"sphinx-build",
*sphinx_opts,
Expand All @@ -63,8 +60,7 @@ def build_docs_nitpicky(session):

@nox.session
def build_docs_no_examples(session):
session.install("-r", "requirements/docs.txt")
session.install(".")
session.install(".[dev,docs]")
session.run(
"sphinx-build",
*sphinx_opts,
Expand Down
122 changes: 119 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,94 @@ requires = [
"setuptools>=50",
"setuptools_scm>=6",
"wheel>=0.34",
] # ought to mirror 'requirements/build.txt'
]

[project]
name = "xrtpy"
readme = "README.md"
keywords = ["solar physics"]
description = "For analyzing data from the X-Ray Telescope (XRT) on the Hinode spacecraft."
license = {file = "LICENSE"}
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering :: Astronomy",
"Topic :: Scientific/Engineering :: Physics",
]
# SPEC 0 recommends that packages in the scientific pythoniverse support
# versions of Python that have been released in the last ≤36 months
requires-python = ">=3.9"
dynamic = ["version"]
authors = [
{name = "Joy Velasquez", email = "[email protected]"},
{name = "Jonathan Slavin", email = "[email protected]"},
{name = "Nick Murpy", email="[email protected]"},
{name = "Will Barnes"},
{name = "Stuart Mumford"},
]

dependencies = [
"astropy >= 5.1",
"cached-property >= 1.5.2",
"matplotlib >= 3.5.0",
"numpy >= 1.24.0",
"requests >= 2.28.0",
"scikit-image >= 0.19.0",
"scipy >= 1.8.0",
# install setuptools to get pkg_resources
"setuptools; python_version >= '3.12'",
"sunpy[map] >= 4.0.0",
]

[project.optional-dependencies]
dev = [
"nox >= 2022.8.7",
"pre-commit >= 3.6.0",
]
tests = [
"pytest >= 8.0.0",
"pytest-allclose >= 1.0.0",
"pytest-xdist >= 3.6.1",
]
docs = [
"docutils >= 0.19",
"imageio >= 2.20.0",
"ipykernel >= 6.20.0",
"ipython >= 8.4.0",
"ipywidgets >= 8.1.0",
"jinja2 != 3.1, >= 3.0.0",
"nbconvert >= 7.7.0, < 7.14",
"nbsphinx >= 0.9",
"numpydoc >= 1.5.0",
"pillow >= 9.1.0",
"pygments >= 2.12.0",
"sphinx >= 7.3.0",
"sphinx-changelog >= 1.5.0",
"sphinx-codeautolink >= 0.15.2",
"sphinx-copybutton >= 0.5.2",
"sphinx-gallery >= 0.16.0",
"sphinx-hoverxref >= 1.4.0",
"sphinx-issues >= 4.1.0",
"sphinx_automodapi >= 0.17.0",
"sphinx_rtd_theme >= 2.0.0",
"sphinxcontrib-bibtex >= 2.6.2",
"sunpy[net] >= 4.0.0",
"towncrier >= 23.11.0",
]

[project.urls]
Documentation = "https://xrtpy.readthedocs.io"
Repository = "https://github.com/HinodeXRT/xrtpy"
Issues = "https://github.com/HinodeXRT/xrtpy/issues"
Changelog = "https://xrtpy.readthedocs.io/en/stable/changelog/index.html"

[tool.ruff]
target-version = "py39"
Expand All @@ -17,7 +104,6 @@ extend-exclude = [
]
namespace-packages = [".github/workflows", "docs"]


[tool.ruff.lint]
# Find info about ruff rules at: https://docs.astral.sh/ruff/rules
extend-select = [
Expand Down Expand Up @@ -78,7 +164,6 @@ ignore = [
"TRY003", # raise-vanilla-args
]


[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402", "F401", "F402", "F403"] # ignore import errors
"docs/notebooks/computing_functions/temperature_response.ipynb" = ["A001"] # filter variable shadows Python builtin
Expand Down Expand Up @@ -108,6 +193,37 @@ tne,
ue
"""

[tool.pytest.ini_options]
testpaths = ['xrtpy', 'docs']
xfail_strict = true
doctest_optionflags = """
NORMALIZE_WHITESPACE
ELLIPSIS
NUMBER
IGNORE_EXCEPTION_DETAIL"""
norecursedirs = [
'build',
'docs/_build',
'examples',
'auto_examples',
]
addopts = [
'--doctest-modules',
'--doctest-continue-on-failure',
'--ignore=docs/conf.py',
]

[tool.setuptools]
packages = ["xrtpy"]

[tool.setuptools.package-data]
"xrtpy" = ["data/*"]
"xrtpy.response" = ["data/*.txt", "data/*.geny"]
"xrtpy.response.tests" = ["data/*/*/*.txt"]

[tool.setuptools_scm]
write_to = "xrtpy/version.py"

[tool.towncrier]
package = "xrtpy"
name = "XRTpy"
Expand Down
5 changes: 0 additions & 5 deletions requirements/build.txt

This file was deleted.

31 changes: 0 additions & 31 deletions requirements/docs.txt

This file was deleted.

8 changes: 0 additions & 8 deletions requirements/extras.txt

This file was deleted.

11 changes: 0 additions & 11 deletions requirements/install.txt

This file was deleted.

10 changes: 0 additions & 10 deletions requirements/tests.txt

This file was deleted.

125 changes: 0 additions & 125 deletions setup.cfg

This file was deleted.

Loading

0 comments on commit d7d18c3

Please sign in to comment.