Skip to content

Commit

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

* Update conf.py

* Update pyproject.toml

* Update pyproject.toml

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Cadair <1391051+Cadair@users.noreply.github.com>
Co-authored-by: Stuart Mumford <stuart@cadair.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Sep 30, 2024
1 parent 76f18ad commit 2e0da11
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 43 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
Expand Up @@ -16,7 +16,7 @@ repos:
]
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|docs/conf.py)$"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.6.5"
rev: "v0.6.7"
hooks:
- id: ruff
args: ["--fix"]
Expand Down
97 changes: 76 additions & 21 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
import warnings
from pathlib import Path

from packaging.version import Version

from astropy.utils.exceptions import AstropyDeprecationWarning
from matplotlib import MatplotlibDeprecationWarning
from packaging.version import Version
from sunpy.util.exceptions import SunpyDeprecationWarning, SunpyPendingDeprecationWarning
from sunpy_sphinx_theme import PNG_ICON

from sunkit_image import __version__

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

os.environ["PARFIVE_HIDE_PROGRESS"] = "True"
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
if on_rtd:
Expand All @@ -25,14 +25,25 @@
os.environ["LANG"] = "C"
os.environ["LC_ALL"] = "C"

# -- Project information -----------------------------------------------------

# The full version, including alpha/beta/rc tags
from sunkit_image 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_image"
author = "The SunPy Community"
copyright = f"{datetime.datetime.now(datetime.UTC).year}, {author}" # NOQA: A001

release = __version__
sunkit_image_version = Version(__version__)
is_release = not (sunkit_image_version.is_prerelease or sunkit_image_version.is_devrelease)

# We want to make sure all the following warnings fail the build
warnings.filterwarnings("error", category=SunpyDeprecationWarning)
warnings.filterwarnings("error", category=SunpyPendingDeprecationWarning)
Expand Down Expand Up @@ -78,13 +89,46 @@
"sphinx.ext.todo",
"sphinx.ext.viewcode",
]
html_extra_path = ["robots.txt"]

# Add any paths that contain templates here, relative to this directory.
# templates_path = ["_templates"]

# 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.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
source_suffix = ".rst"

# The master toctree document.
master_doc = "index"
default_role = "obj"

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

html_extra_path = ["robots.txt"]

napoleon_use_rtype = False

napoleon_google_docstring = False

# Enable nitpicky mode, which forces links to be non-broken
nitpicky = True

# This is not used. See docs/nitpick-exceptions file for the actual listing.
nitpick_ignore = []
with Path("nitpick-exceptions").open() as f:
for line in f.readlines():
if line.strip() == "" or line.startswith("#"):
continue
dtype, target = line.split(None, 1)
target = target.strip()
nitpick_ignore.append((dtype, target))

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

intersphinx_mapping = {
"python": (
"https://docs.python.org/3/",
Expand All @@ -106,20 +150,28 @@
"skimage": ("https://scikit-image.org/docs/stable/", None),
}

# Enable nitpicky mode, which forces links to be non-broken
nitpicky = True
# This is not used. See docs/nitpick-exceptions file for the actual listing.
nitpick_ignore = []
with Path("nitpick-exceptions").open() as f:
for line in f.readlines():
if line.strip() == "" or line.startswith("#"):
continue
dtype, target = line.split(None, 1)
target = target.strip()
nitpick_ignore.append((dtype, target))

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

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = "sunpy"

# 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 @@ -131,6 +183,7 @@
]

# -- Options for the Sphinx gallery -------------------------------------------

path = pathlib.Path.cwd()
example_dir = path.parent.joinpath("examples")
sphinx_gallery_conf = {
Expand All @@ -144,3 +197,5 @@
"remove_config_comments": True,
"only_warn_on_example_error": True,
}

# -- Other options ----------------------------------------------------------
40 changes: 20 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ classifiers = [
"Topic :: Scientific/Engineering :: Physics",
]
dependencies = [
'astropy>=5.3.0',
'numpy>=1.23.5',
'matplotlib>=3.5.0',
'scipy>=1.10.1',
'scikit-image>=0.20.0',
'sunpy[map]>=6.0.0',
"astropy>=5.3.0",
"numpy>=1.23.5",
"matplotlib>=3.5.0",
"scipy>=1.10.1",
"scikit-image>=0.20.0",
"sunpy[map]>=6.0.0",
]

[project.optional-dependencies]
Expand All @@ -45,26 +45,26 @@ all = ["sunkit_image[watroo]"]
watroo = ["watroo"]
tests = [
"sunkit_image[all]",
'dask',
'pytest-astropy',
'pytest-mpl',
"dask",
"pytest-astropy",
"pytest-mpl",
"pytest-xdist",
"sunpy[data,net]>=6.0.0",
]
docs = [
"sphinx",
"sphinx-automodapi",
"packaging",
"sunkit_image[all]",
'astroscrappy',
'dask',
'matplotlib',
'sphinx-automodapi',
'sphinx-changelog',
'sphinx-design',
'sphinx-gallery',
'sphinx',
'sunpy-sphinx-theme',
'sunpy[data,net]>=6.0.0',
"astroscrappy",
"dask",
"matplotlib",
"sphinx-changelog",
"sphinx-design",
"sphinx-gallery",
"sunpy-sphinx-theme",
"sunpy[data,net]>=6.0.0",
]

dev = ["sunkit_image[all,tests,docs]"]

[project.urls]
Expand Down

0 comments on commit 2e0da11

Please sign in to comment.