Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
docs: retrieve configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
JesperDramsch committed Aug 12, 2024
1 parent 4644c4e commit 06a1dbd
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

sphinx:
configuration: docs/conf.py

python:
install:
- method: pip
path: .
extra_requirements:
- docs
22 changes: 22 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env make -f

# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Binary file added docs/_static/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions docs/_static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.wy-side-nav-search {
background-color: #f7f7f7;
}

/*There is a clash between xarray notebook styles and readthedoc*/

.rst-content dl.xr-attrs dt {
all: revert;
font-size: 95%;
white-space: nowrap;
}

.rst-content dl.xr-attrs dd {
font-size: 95%;
}

.xr-wrap {
font-size: 85%;
}

.wy-table-responsive table td, .wy-table-responsive table th {
white-space: inherit;
}

/*
.wy-table-responsive table td,
.wy-table-responsive table th {
white-space: normal !important;
vertical-align: top !important;
}
.wy-table-responsive {
margin-bottom: 24px;
max-width: 100%;
overflow: visible;
} */

/* Hide notebooks warnings */
.nboutput .stderr {
display: none;
}

/*
Set logo size
*/
.wy-side-nav-search .wy-dropdown > a img.logo, .wy-side-nav-search > a img.logo {
width: 200px;
}
Empty file added docs/_templates/.gitkeep
Empty file.
121 changes: 121 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import datetime
import os
import sys

read_the_docs_build = os.environ.get("READTHEDOCS", None) == "True"

sys.path.insert(0, os.path.join(os.path.abspath(".."), "src"))


source_suffix = ".rst"
master_doc = "index"
pygments_style = "sphinx"
html_theme_options = {"logo_only": True}
html_logo = "_static/logo.png"


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

project = "Anemoi Training"

author = "ECMWF"

year = datetime.datetime.now().year
years = "2024" if year == 2024 else f"2024-{year}"

copyright = f"{years}, ECMWF"


try:
from anemoi.training._version import __version__

release = __version__
except ImportError:
release = "0.0.0"


# -- 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.
extensions = [
"sphinx.ext.todo",
"sphinx_rtd_theme",
"nbsphinx",
"sphinx.ext.graphviz",
"sphinx.ext.intersphinx",
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinxarg.ext",
]

# 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", "'**.ipynb_checkpoints'"]

intersphinx_mapping = {
"python": ("https://python.readthedocs.io/en/latest", None),
"anemoi-utils": (
"https://anemoi-utils.readthedocs.io/en/latest/",
("../../anemoi-utils/docs/_build/html/objects.inv", None),
),
"anemoi-datasets": (
"https://anemoi-datasets.readthedocs.io/en/latest/",
("../../anemoi-datasets/docs/_build/html/objects.inv", None),
),
"anemoi-models": (
"https://anemoi-models.readthedocs.io/en/latest/",
("../../anemoi-models/docs/_build/html/objects.inv", None),
),
"anemoi-training": (
"https://anemoi-training.readthedocs.io/en/latest/",
("../../anemoi-training/docs/_build/html/objects.inv", None),
),
"anemoi-inference": (
"https://anemoi-inference.readthedocs.io/en/latest/",
("../../anemoi-inference/docs/_build/html/objects.inv", None),
),
"anemoi-graphs": (
"https://anemoi-graphs.readthedocs.io/en/latest/",
("../../anemoi-graphs/docs/_build/html/objects.inv", None),
),
"anemoi-registry": (
"https://anemoi-registry.readthedocs.io/en/latest/",
("../../anemoi-registry/docs/_build/html/objects.inv", None),
),
}

# -- 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 = "sphinx_rtd_theme"

# 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"]
html_css_files = ["style.css"]


todo_include_todos = not read_the_docs_build

autodoc_member_order = "bysource" # Keep file order

0 comments on commit 06a1dbd

Please sign in to comment.