Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert setup.cfg to pyproject.toml #260

Merged
merged 16 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes like these allow us to bypass the need for having the requirements files specified in the requirements/ directory. We'll be installing the dependencies for running tests based on the dependency sets in pyproject.toml instead, so dependencies will only need to be included in one place.

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",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this from 3 - Alpha to 3 - Beta since XRTpy has been gaining maturity.

"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"
Comment on lines +29 to +31
Copy link
Contributor Author

@namurphy namurphy Jun 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the link to SPEC 0. We could drop Python 3.9 anytime.

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",
]
Comment on lines +55 to +58
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dev dependency set includes packages that we need for both tests & docs.

tests = [
"pytest >= 8.0.0",
"pytest-allclose >= 1.0.0",
"pytest-xdist >= 3.6.1",
]
Comment on lines +59 to +63
Copy link
Contributor Author

@namurphy namurphy Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can install xrtpy & packages necessary for running tests with pip install .[dev,tests] (from the top-level directory of the repo).

Similarly, we can do pip install .[dev,docs] for building docs. This is now handled by the Nox sessions.

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
Loading