Skip to content

Commit de7211f

Browse files
committed
cleanup
1 parent 3b5657d commit de7211f

1 file changed

Lines changed: 20 additions & 39 deletions

File tree

docs/conf.py

Lines changed: 20 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,42 @@
1-
# pylint: disable=invalid-name
2-
# pylint: disable=consider-using-f-string
31
"""
4-
Configuration file for building documentation.
2+
Sphinx configuration for miepython documentation.
53
6-
Sphinx builds the docs using couple of external modules: napoleon and nbsphinx.
7-
8-
The overall format is controlled by `.rst` files. The top level file is `index.rst`
9-
10-
`napoleon` builds the API in HTML assuming that the code is documented with
11-
docstrings that follow the Google docstring format.
12-
13-
`nbsphinx` convert the Jupyter notebooks to html with nbsphinx, will
4+
Uses:
5+
- sphinx.ext.napoleon for Google-style docstrings
6+
- nbsphinx for rendering Jupyter notebooks (pre-executed; no execution on RTD)
147
"""
15-
import re
16-
import os.path
8+
from importlib.metadata import version as pkg_version
179

1810
project = "miepython"
11+
release = pkg_version(project)
12+
version = release
1913

14+
root_doc = "index"
2015

21-
def get_init_property(prop):
22-
"""Return property from __init__.py."""
23-
here = os.path.abspath(os.path.dirname(__file__))
24-
file_name = os.path.join(here, "..", project, "__init__.py")
25-
regex = r'{}\s*=\s*[\'"]([^\'"]*)[\'"]'.format(prop)
26-
with open(file_name, "r", encoding="utf-8") as file:
27-
result = re.search(regex, file.read())
28-
return result.group(1)
29-
30-
31-
release = get_init_property("__version__")
32-
author = get_init_property("__author__")
33-
copyright = get_init_property("__copyright__")
34-
35-
master_doc = "index"
36-
37-
# -- General configuration ---------------------------------------------------
38-
39-
# Sphinx extension modules
4016
extensions = [
17+
"sphinx.ext.autodoc",
4118
"sphinx.ext.napoleon",
4219
"sphinx.ext.viewcode",
4320
"sphinx.ext.mathjax",
4421
"sphinx_automodapi.automodapi",
4522
"nbsphinx",
4623
]
47-
numpydoc_show_class_members = False
24+
4825
napoleon_use_param = False
4926
napoleon_use_rtype = False
27+
numpydoc_show_class_members = False
5028

51-
# List of patterns, relative to source directory, of files to ignore
52-
exclude_patterns = ["_build", "14_fields.ipynb", "1d-efield.ipynb", "Untitled*", "MnNn-calc.ipynb"]
29+
exclude_patterns = [
30+
"_build",
31+
".ipynb_checkpoints",
32+
"Untitled*.ipynb",
33+
"x_MnNn_calc.ipynb",
34+
"x_14_fields.ipynb",
35+
"x_one_d_efield.ipynb",
36+
]
5337

54-
# I execute the notebooks manually in advance.
5538
nbsphinx_execute = "never"
56-
nbsphinx_allow_errors = True
57-
58-
# -- Options for HTML output -------------------------------------------------
39+
nbsphinx_allow_errors = False
5940

6041
html_theme = "sphinx_rtd_theme"
6142
html_scaled_image_link = False

0 commit comments

Comments
 (0)