1
|
|
|
# -*- coding: utf-8 -*- |
2
|
|
|
|
3
|
|
|
import json |
4
|
|
|
import re |
5
|
|
|
import sys |
6
|
|
|
from unittest.mock import MagicMock |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
class Mock(MagicMock): |
10
|
|
|
@classmethod |
11
|
|
|
def __getattr__(cls, name): |
12
|
|
|
return MagicMock() |
13
|
|
|
|
14
|
|
|
MOCK_MODULES = ['apexpy'] |
15
|
|
|
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES) |
16
|
|
|
|
17
|
|
|
extensions = ['sphinx.ext.autodoc', |
18
|
|
|
'sphinx.ext.autosummary', |
19
|
|
|
'sphinx.ext.coverage', |
20
|
|
|
'sphinx.ext.viewcode', |
21
|
|
|
'sphinx.ext.githubpages', |
22
|
|
|
'sphinx.ext.napoleon', |
23
|
|
|
'sphinx.ext.extlinks'] |
24
|
|
|
|
25
|
|
|
# Define common elements |
26
|
|
|
|
27
|
|
|
source_suffix = '.rst' |
28
|
|
|
master_doc = 'index' |
29
|
|
|
project = 'ApexPy' |
30
|
|
|
year = '2022' |
31
|
|
|
zenodo = json.loads(open('../.zenodo.json').read()) |
32
|
|
|
author = ' and '.join([zcreator['name'] for zcreator in zenodo['creators']]) |
33
|
|
|
copyright = ', '.join([year, author]) |
34
|
|
|
|
35
|
|
|
# Get version number from __init__.py |
36
|
|
|
regex = r"(?<=__version__..\s)\S+" |
37
|
|
|
with open('../apexpy/__init__.py', 'r') as fin: |
38
|
|
|
text = fin.read() |
39
|
|
|
match = re.findall(regex, text) |
40
|
|
|
version = release = match[0].strip("'") |
41
|
|
|
|
42
|
|
|
# The theme to use for HTML and HTML Help pages. See the documentation for |
43
|
|
|
# a list of builtin themes. |
44
|
|
|
html_theme = 'sphinx_rtd_theme' |
45
|
|
|
html_theme_path = ["_themes", ] |
46
|
|
|
|
47
|
|
|
pygments_style = 'trac' |
48
|
|
|
templates_path = ['.'] |
49
|
|
|
html_use_smartypants = True |
50
|
|
|
html_last_updated_fmt = '%b %d, %Y' |
51
|
|
|
html_split_index = True |
52
|
|
|
html_sidebars = {'**': ['searchbox.html', 'globaltoc.html', 'sourcelink.html']} |
53
|
|
|
html_short_title = '-'.join([project, version]) |
54
|
|
|
autodoc_member_order = 'bysource' |
55
|
|
|
autodoc_mock_imports = ['apexpy'] |
56
|
|
|
napoleon_use_ivar = True |
57
|
|
|
napoleon_use_rtype = False |
58
|
|
|
napoleon_use_param = False |
59
|
|
|
|
60
|
|
|
extlinks = {'doi': ('http://dx.doi.org/%s', 'doi:')} |
61
|
|
|
|