forked from materialsinnovation/pymks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf.py
106 lines (81 loc) · 2.32 KB
/
conf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import sys
import os
import alabaster
html_theme_path = [alabaster.get_path()]
extensions = ['alabaster']
html_theme = 'alabaster'
sys.path.insert(0, os.path.abspath('..'))
root_doc = 'index'
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.mathjax',
'sphinx.ext.autosummary',
'sphinx.ext.napoleon',
'nbsphinx',
'm2r2',
'sphinxcontrib.jinja',
'IPython.sphinxext.ipython_console_highlighting'
]
templates_path = ['_templates']
master_doc = 'contents'
project = u'pymks'
copyright = u'2021, Daniel Wheeler'
import pymks
version = pymks.__version__
release = pymks.__version__
exclude_patterns = ['_build', '**.ipynb_checkpoints']
autoclass_content = 'both'
pygments_style = 'alabaster.support.Alabaster'
html_sidebars = {
'**': [
'about.html',
'release.html',
'navigation.html',
]
}
html_theme_options = {
'logo': 'pymks_logo.svg',
'github_user': 'materialsinnovation',
'github_repo': 'pymks',
'github_button': True,
'sidebar_collapse': True,
'sidebar_width': '200px',
'page_width': '1050px',
'fixed_sidebar': True
}
html_title = "PyMKS"
html_short_title = "PyMKS"
html_favicon = '_static/pymks_logo.ico'
html_static_path = ['_static']
html_css_files = [
'pymks.css'
]
html_additional_pages = {}
html_show_copyright = False
htmlhelp_basename = 'pymksdoc'
source_suffix = ['.rst', '.md']
def url_resolver(url):
"""Resolve url for both documentation and Github online.
If the url is an IPython notebook links to the correct path.
Args:
url: the path to the link (not always a full url)
Returns:
a local url to either the documentation or the Github
"""
if url[-6:] == '.ipynb':
return url[4:-6] + '.html'
else:
return url
import shutil, os, glob
rst_directory = 'rst'
notebook_directory = os.path.join(rst_directory, 'notebooks')
for directory in [rst_directory, notebook_directory]:
if not os.path.exists(directory):
os.makedirs(directory)
files_to_copy = (
'README.md',
'notebooks/*.ipynb'
)
for fpath in files_to_copy:
for fpath_glob in glob.glob(os.path.join('..', fpath)):
fpath_glob_ = '/'.join(fpath_glob.split('/')[1:])
shutil.copy(fpath_glob, os.path.join(rst_directory, fpath_glob_))