Skip to content

Commit eb040d6

Browse files
Add initial documentation (#2)
1 parent 4483c9e commit eb040d6

File tree

12 files changed

+996
-0
lines changed

12 files changed

+996
-0
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,20 @@ jobs:
6363
run: |
6464
uv run pre-commit install
6565
uv run pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
66+
67+
docs:
68+
runs-on: ubuntu-latest
69+
timeout-minutes: 15
70+
steps:
71+
- uses: actions/checkout@v4
72+
73+
- name: Install uv
74+
uses: astral-sh/setup-uv@v6
75+
with:
76+
python-version: "3.12"
77+
78+
- name: Install dependencies
79+
run: uv sync
80+
81+
- name: Build docs
82+
run: cd docs && uv run make html

.github/workflows/docs.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: docs
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
# Allow one concurrent deployment
14+
concurrency:
15+
group: "pages"
16+
17+
jobs:
18+
docs-deploy:
19+
if: github.ref == 'refs/heads/main' && github.repository == 'ddmms/mlip-testing'
20+
environment:
21+
name: github-pages
22+
url: ${{ steps.deployment.outputs.page_url }}
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Install uv
29+
uses: astral-sh/setup-uv@v6
30+
with:
31+
python-version: "3.12"
32+
33+
- name: Install dependencies
34+
run: uv sync
35+
36+
- name: Build docs
37+
run: cd docs && uv run make html
38+
39+
- name: upload
40+
uses: actions/upload-pages-artifact@v3
41+
with:
42+
# Upload entire repository
43+
path: './docs/build/html/.'
44+
45+
- name: Deploy to GitHub Pages
46+
id: deployment
47+
uses: actions/deploy-pages@v4

docs/Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
PAPER =
8+
BUILDDIR = build
9+
10+
# User-friendly check for sphinx-build
11+
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
12+
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
13+
endif
14+
15+
# Internal variables.
16+
PAPEROPT_a4 = -D latex_paper_size=a4
17+
PAPEROPT_letter = -D latex_paper_size=letter
18+
ALLSPHINXOPTS = -n -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
19+
# the i18n builder cannot share the environment and doctrees with the others
20+
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
21+
22+
.PHONY: all help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext customdefault
23+
24+
## Runs nit-picky and converting warnings into errors to
25+
## make sure the documentation is properly written
26+
customdefault:
27+
$(SPHINXBUILD) -b html -nW --keep-going $(ALLSPHINXOPTS) $(BUILDDIR)/html
28+
29+
all: html
30+
31+
clean:
32+
rm -rf $(BUILDDIR)
33+
34+
html:
35+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
36+
@echo
37+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
38+
39+
view:
40+
xdg-open $(BUILDDIR)/html/index.html
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
mlip\_testing package
2+
=====================
3+
4+
Module contents
5+
---------------
6+
7+
.. automodule:: mlip_testing
8+
:members:
9+
:special-members:
10+
:private-members:
11+
:undoc-members:
12+
:show-inheritance:

docs/source/conf.py

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
#
2+
# Sphinx configuration for mlip-testing
3+
#
4+
# This file is execfile()d with the current directory set to its
5+
# containing dir.
6+
#
7+
# Note that not all possible configuration values are present in this
8+
# autogenerated file.
9+
#
10+
# All configuration values have a default; values that are commented out
11+
# serve to show the default.
12+
13+
from importlib import metadata
14+
import time
15+
16+
import mlip_testing
17+
18+
# -- General configuration ------------------------------------------------
19+
20+
# If extensions (or modules to document with autodoc) are in another directory,
21+
# add these directories to sys.path here. If the directory is relative to the
22+
# documentation root, use os.path.abspath to make it absolute, like shown here.
23+
24+
# Add any Sphinx extension module names here, as strings. They can be
25+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
26+
# ones.
27+
extensions = [
28+
"sphinx.ext.autodoc",
29+
"sphinx.ext.intersphinx",
30+
"sphinx.ext.napoleon",
31+
"sphinx.ext.mathjax",
32+
"sphinx.ext.viewcode",
33+
"sphinxcontrib.contentui",
34+
"sphinx_copybutton",
35+
"sphinx_autodoc_typehints",
36+
"nbsphinx",
37+
]
38+
39+
always_use_bars_union = True
40+
napoleon_include_special_with_doc = True
41+
napoleon_use_param = True
42+
43+
numpydoc_validation_checks = {"all", "EX01", "SA01", "ES01", "PR04"}
44+
numpydoc_validation_exclude = {
45+
r"\.__weakref__$",
46+
r"\.__repr__$",
47+
}
48+
numpydoc_class_members_toctree = False
49+
50+
intersphinx_mapping = {
51+
"python": ("https://docs.python.org/3", None),
52+
}
53+
54+
# Add any paths that contain templates here, relative to this directory.
55+
templates_path = ["_templates"]
56+
57+
# The suffix of source filenames.
58+
source_suffix = ".rst"
59+
60+
# The encoding of source files.
61+
# source_encoding = 'utf-8-sig'
62+
63+
# The master toctree document.
64+
# ~ master_doc = 'index'
65+
master_doc = "index"
66+
67+
# General information about the project.
68+
project = "mlip-testing"
69+
copyright_first_year = "2025"
70+
copyright_owners = metadata.metadata("mlip-testing")["author"]
71+
72+
current_year = str(time.localtime().tm_year)
73+
copyright_year_string = (
74+
current_year
75+
if current_year == copyright_first_year
76+
else f"{copyright_first_year}-{current_year}"
77+
)
78+
copyright = f"{copyright_year_string}, {copyright_owners}. All rights reserved"
79+
80+
# The version info for the project you're documenting, acts as replacement for
81+
# |version| and |release|, also used in various other places throughout the
82+
# built documents.
83+
#
84+
# The full version, including alpha/beta/rc tags.
85+
release = mlip_testing.__version__
86+
87+
# The short X.Y version.
88+
version = ".".join(release.split(".")[:2])
89+
90+
# The language for content autogenerated by Sphinx. Refer to documentation
91+
# for a list of supported languages.
92+
#
93+
# This is also used if you do content translation via gettext catalogs.
94+
# Usually you set "language" from the command line for these cases.
95+
language = "en"
96+
97+
# There are two options for replacing |today|: either, you set today to some
98+
# non-false value, then it is used:
99+
# today = ''
100+
# Else, today_fmt is used as the format for a strftime call.
101+
# today_fmt = '%B %d, %Y'
102+
103+
# List of patterns, relative to source directory, that match files and
104+
# directories to ignore when looking for source files.
105+
# exclude_patterns = ['doc.rst']
106+
# ~ exclude_patterns = ['index.rst']
107+
108+
# If true, sectionauthor and moduleauthor directives will be shown in the
109+
# output. They are ignored by default.
110+
show_authors = True
111+
112+
# The name of the Pygments (syntax highlighting) style to use.
113+
pygments_style = "sphinx"
114+
115+
# -- Options for HTML output ----------------------------------------------
116+
117+
html_theme = "furo"
118+
html_title = f"mlip-testing v{release}"
119+
html_theme_options = {
120+
"source_repository": "https://github.com/ddmms/mlip-testing/",
121+
"source_branch": "main",
122+
"source_directory": "docs/source",
123+
"footer_icons": [
124+
{
125+
"name": "GitHub",
126+
"url": "https://github.com/ddmms/mlip-testing",
127+
"html": """
128+
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16">
129+
<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>
130+
</svg>
131+
""",
132+
"class": "",
133+
},
134+
],
135+
}
136+
137+
# Add any paths that contain custom themes here, relative to this directory.
138+
# ~ html_theme_path = ["."]
139+
140+
# The name of an image file (within the static path) to use as favicon of the
141+
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
142+
# pixels large.
143+
# html_favicon = "images/favicon.ico"
144+
145+
# Add any paths that contain custom static files (such as style sheets) here,
146+
# relative to this directory. They are copied after the builtin static files,
147+
# so a file named "default.css" will overwrite the builtin "default.css".
148+
# html_static_path = ['_static']
149+
150+
# Add any extra paths that contain custom files (such as robots.txt or
151+
# .htaccess) here, relative to this directory. These files are copied
152+
# directly to the root of the documentation.
153+
# html_extra_path = []
154+
155+
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
156+
# using the given strftime format.
157+
html_last_updated_fmt = "%b %d, %Y"
158+
159+
# If true, SmartyPants will be used to convert quotes and dashes to
160+
# typographically correct entities.
161+
# html_use_smartypants = True
162+
163+
# Custom sidebar templates, maps document names to template names.
164+
html_sidebars = {}
165+
166+
# Additional templates that should be rendered to pages, maps page names to
167+
# template names.
168+
# html_additional_pages = {}
169+
170+
# If false, no module index is generated.
171+
# html_domain_indices = True
172+
173+
# If false, no index is generated.
174+
# html_use_index = True
175+
176+
# If true, the index is split into individual pages for each letter.
177+
# html_split_index = False
178+
179+
# If true, links to the reST sources are added to the pages.
180+
html_show_sourcelink = False
181+
182+
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
183+
html_show_sphinx = True
184+
185+
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
186+
# ~ html_show_copyright = False
187+
188+
# If true, an OpenSearch description file will be output, and all pages will
189+
# contain a <link> tag referring to it. The value of this option must be the
190+
# base URL from which the finished HTML is served.
191+
html_use_opensearch = "https://ddmms.github.io/mlip-testing/"
192+
193+
# This is the file name suffix for HTML files (e.g. ".xhtml").
194+
# html_file_suffix = None
195+
196+
# Language to be used for generating the HTML full-text search index.
197+
# Sphinx supports the following languages:
198+
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
199+
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
200+
html_search_language = "en"
201+
202+
# Warnings to ignore when using the -n (nitpicky) option
203+
# We should ignore any python built-in exception, for instance
204+
nitpicky = True

0 commit comments

Comments
 (0)