Skip to content

Commit

Permalink
Updates from the package template (#138)
Browse files Browse the repository at this point in the history
* Automatic package template update

* Update conf.py

* Update pyproject.toml

---------

Co-authored-by: nabobalis <[email protected]>
Co-authored-by: Stuart Mumford <[email protected]>
  • Loading branch information
3 people authored Sep 30, 2024
1 parent 4cdda9a commit 4742d12
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/sunpy/package-template",
"commit": "c1efeecc741705d6a87ab17ca3662428df783a6d",
"commit": "17602ec8f8d4a4c5722bca00e255e480683f5096",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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.5"
rev: "v0.6.7"
hooks:
- id: ruff
args: ["--fix"]
Expand Down
43 changes: 34 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
Configuration file for the Sphinx documentation builder.
"""
# -- stdlib imports ------------------------------------------------------------

import os
import datetime
from packaging.version import Version

# -- Read the Docs Specific Configuration --------------------------------------

on_rtd = os.environ.get("READTHEDOCS", None) == "True"
if on_rtd:
os.environ["SUNPY_CONFIGDIR"] = "/home/docs/"
Expand All @@ -18,17 +20,24 @@
# -- Project information -----------------------------------------------------

# The full version, including alpha/beta/rc tags
from sunkit_instruments import __version__ # NOQA
from sunkit_instruments import __version__

_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

project = "sunkit-instruments"
author = "The SunPy Community"
copyright = f"{datetime.datetime.now().year}, {author}"
release = __version__
sunkit_instruments_version = Version(__version__)
is_release = not (
sunkit_instruments_version.is_prerelease or sunkit_instruments_version.is_devrelease
)

# -- General configuration -----------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom
# ones.
Expand Down Expand Up @@ -69,9 +78,10 @@
master_doc = "index"

# Treat everything in single ` as a Python reference.
default_role = 'py:obj'
default_role = "py:obj"

# -- Options for intersphinx extension -----------------------------------------

intersphinx_mapping = {
"python": (
"https://docs.python.org/3/",
Expand Down Expand Up @@ -102,17 +112,29 @@
"reproject": ("https://reproject.readthedocs.io/en/stable/", None),
"aiapy": ("https://aiapy.readthedocs.io/en/stable/", None),
}
default_role = "obj"

# -- Options for HTML output ---------------------------------------------------

from sunpy_sphinx_theme import PNG_ICON

html_theme = "sunpy"

# -- Other options ----------------------------------------------------------
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ["_static"]

# By default, when rendering docstrings for classes, sphinx.ext.autodoc will
# make docs with the class-level docstring and the class-method docstrings,
# but not the __init__ docstring, which often contains the parameters to
# class constructors across the scientific Python ecosystem. The option below
# will append the __init__ docstring to the class-level docstring when rendering
# the docs. For more options, see:
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autoclass_content
autoclass_content = "both"

# -- Graphviz Output ------------------------------------------------------------

graphviz_output_format = "svg"
graphviz_dot_args = [
"-Nfontsize=10",
Expand All @@ -124,6 +146,7 @@
]

# -- Sphinx Gallery ------------------------------------------------------------

sphinx_gallery_conf = {
"backreferences_dir": os.path.join("generated", "modules"),
"filename_pattern": "^((?!skip_).)*$",
Expand All @@ -137,3 +160,5 @@
"doc_module": ("sunpy"),
"only_warn_on_example_error": True,
}

# -- Other options ----------------------------------------------------------
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ tests = [
docs = [
"sphinx",
"sphinx-automodapi",
"packaging",
"sphinx-changelog",
"sphinx-gallery",
"sunpy-sphinx-theme",
Expand Down

0 comments on commit 4742d12

Please sign in to comment.