From a9edfcffbb1120cb2c3d8ed4b33358266ca83ef4 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Tue, 1 Oct 2024 15:44:47 +0100 Subject: [PATCH] Cruft update (#444) --- .cruft.json | 2 +- .pre-commit-config.yaml | 2 +- docs/conf.py | 43 ++++++++++++++++++++++++----------------- pyproject.toml | 2 ++ 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/.cruft.json b/.cruft.json index 9339b034..c6c47369 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/sunpy/package-template", - "commit": "67ea3b3815de57668e92dbe1fa2c3d033758d8f0", + "commit": "b5bbed7f845b4acf95f303ea6e4ae6edf731eced", "checkout": null, "context": { "cookiecutter": { diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 579a48f6..6e41d611 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: # This should be before any formatting hooks like isort - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.6.3" + rev: "v0.6.7" hooks: - id: ruff args: ["--fix"] diff --git a/docs/conf.py b/docs/conf.py index 189f2927..a918d7da 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -2,15 +2,16 @@ Configuration file for the Sphinx documentation builder. """ # -- stdlib imports ------------------------------------------------------------ + import datetime import os import sys -import warnings from packaging.version import Version from pkg_resources import get_distribution # -- Check for dependencies ---------------------------------------------------- + doc_requires = get_distribution("dkist").requires(extras=("docs",)) missing_requirements = [] for requirement in doc_requires: @@ -26,7 +27,7 @@ sys.exit(1) # -- Read the Docs Specific Configuration -------------------------------------- -# This needs to be done before sunpy is imported + on_rtd = os.environ.get("READTHEDOCS", None) == "True" if on_rtd: os.environ["SUNPY_CONFIGDIR"] = "/home/docs/" @@ -36,22 +37,30 @@ os.environ["HIDE_PARFIVE_PROGESS"] = "True" # -- Non stdlib imports -------------------------------------------------------- + import dkist # noqa from dkist import __version__ -# -- Project information ------------------------------------------------------- +# -- Project information ----------------------------------------------------- + +# The full version, including alpha/beta/rc tags + +_version = Version(__version__) +version = release = str(_version) +# Avoid "post" appearing in version string in rendered docs +if _version.is_postrelease: + version = release = _version.base_version +# Avoid long githashes in rendered Sphinx docs +elif _version.is_devrelease: + version = release = f"{_version.base_version}.dev{_version.dev}" +is_development = _version.is_devrelease +is_release = not(_version.is_prerelease or _version.is_devrelease) + project = "DKIST" author = "NSO / AURA" copyright = f"{datetime.datetime.now().year}, {author}" -# The full version, including alpha/beta/rc tags -release = __version__ -dkist_version = Version(__version__) -is_release = not(dkist_version.is_prerelease or dkist_version.is_devrelease) - -# We want to ignore all warnings in a release version. -if is_release: - warnings.simplefilter("ignore") +# -- General configuration --------------------------------------------------- # Suppress warnings about overriding directives as we overload some of the # doctest extensions. @@ -87,10 +96,6 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. - -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied - exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "jupyter_execute", "**/*_NOTES.md"] # The suffix(es) of source filenames. @@ -102,9 +107,8 @@ # The master toctree document. master_doc = "index" -# The reST default role (used for this markup: `text`) to use for all -# documents. Set to the "smart" one. -default_role = "obj" +# Treat everything in single ` as a Python reference. +default_role = "py:obj" napoleon_use_rtype = False @@ -120,6 +124,7 @@ typehints_defaults = "comma" # -- Options for intersphinx extension ----------------------------------------- + # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { "python": ("https://docs.python.org/3/", None), @@ -137,6 +142,7 @@ } # -- Options for HTML output --------------------------------------------------- + # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. @@ -163,6 +169,7 @@ pygments_style = "github-light" # -- MyST_NB ------------------------------------------------------------------- + nb_execution_allow_errors = False nb_execution_in_temp = True nb_execution_mode = "auto" diff --git a/pyproject.toml b/pyproject.toml index 9b184cd0..4446b757 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,6 +61,8 @@ tests = [ ] docs = [ "sphinx", + "sphinx-automodapi", + "packaging", "sphinx-astropy", "sphinx-gallery", "sphinx-changelog",