Skip to content

Commit 5955049

Browse files
Tyna Dolezalovapacesm
Tyna Dolezalova
authored andcommitted
Publishing documentation.
1 parent d6aa2ed commit 5955049

File tree

6 files changed

+197
-0
lines changed

6 files changed

+197
-0
lines changed

.github/workflows/ci.yml

+21
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,24 @@ jobs:
5353
env:
5454
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
5555
if: always()
56+
deploy:
57+
runs-on: ubuntu-20.04
58+
steps:
59+
- uses: actions/checkout@v2
60+
- name: prepare docs
61+
run: |
62+
python3 --version
63+
sudo apt-get install gfortran
64+
sudo apt-get install libhdf5-dev
65+
( cd libcdf && make build && sudo make install )
66+
( cd qdipole && ./configure && make build && sudo make install )
67+
pip3 install scipy
68+
pip3 install ./eoxmagmod/
69+
pip3 install -r requirements-docs.txt
70+
make html BUILDDIR=../public -C docs
71+
mv ./public/html/* ./public/
72+
- name: Deploy github pages
73+
uses: JamesIves/github-pages-deploy-action@v4
74+
with:
75+
folder: public
76+
note:

docs/Makefile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/conf.py

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
9+
10+
import os
11+
import inspect
12+
import shutil
13+
14+
try: # for Sphinx >= 1.7
15+
from sphinx.ext import apidoc
16+
except ImportError:
17+
from sphinx import apidoc
18+
19+
__location__ = os.path.join(
20+
os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe()))
21+
)
22+
23+
print(__location__)
24+
25+
output_dir = os.path.join(__location__, "api")
26+
module_dir = os.path.join(__location__, "../eoxmagmod/eoxmagmod")
27+
28+
29+
try:
30+
shutil.rmtree(output_dir)
31+
except FileNotFoundError:
32+
pass
33+
34+
try:
35+
import sphinx
36+
37+
cmd_line_template = (
38+
"sphinx-apidoc --implicit-namespaces -f -o {outputdir} {moduledir}"
39+
)
40+
cmd_line = cmd_line_template.format(outputdir=output_dir, moduledir=module_dir)
41+
42+
args = cmd_line.split(" ")
43+
if tuple(sphinx.__version__.split(".")) >= ("1", "7"):
44+
# This is a rudimentary parse_version to avoid external dependencies
45+
args = args[1:]
46+
47+
apidoc.main(args)
48+
except Exception as e:
49+
print("Running `sphinx-apidoc` failed!\n{}".format(e))
50+
51+
52+
def setup(app):
53+
app.add_css_file("css/custom.css")
54+
55+
56+
project = 'MagneticModel'
57+
copyright = '2022, dolezalovat'
58+
author = 'dolezalovat'
59+
60+
61+
# -- General configuration ---------------------------------------------------
62+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
63+
64+
extensions = [
65+
"sphinx.ext.autodoc",
66+
"sphinx.ext.intersphinx",
67+
"sphinx.ext.todo",
68+
"sphinx.ext.autosummary",
69+
"sphinx.ext.viewcode",
70+
"sphinx.ext.coverage",
71+
"sphinx.ext.doctest",
72+
"sphinx.ext.ifconfig",
73+
"sphinx.ext.mathjax",
74+
"sphinx.ext.napoleon",
75+
"myst_parser",
76+
"sphinx_rtd_theme",
77+
"sphinx-jsonschema",
78+
"frigate.sphinx.ext",
79+
]
80+
81+
templates_path = ["_templates"]
82+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "tests"]
83+
84+
# -- Options for HTML output -------------------------------------------------
85+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
86+
87+
html_theme = "sphinx_rtd_theme"
88+
html_static_path = ["static"]
89+
90+
source_suffix = {
91+
".rst": "restructuredtext",
92+
".txt": "markdown",
93+
".md": "markdown",
94+
}

docs/index.rst

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.. MagneticModel documentation master file, created by
2+
sphinx-quickstart on Mon Oct 24 10:55:30 2022.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to MagneticModel's documentation!
7+
=========================================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
12+
Module Reference <api/modules>
13+
14+
15+
16+
17+
Indices and tables
18+
==================
19+
20+
* :ref:`genindex`
21+
* :ref:`modindex`
22+
* :ref:`search`

docs/make.bat

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

requirements-docs.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sphinx
2+
sphinx_rtd_theme
3+
frigate
4+
sphinx-jsonschema
5+
myst-parser

0 commit comments

Comments
 (0)