forked from WojtekWeclewski/workshop-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconf.py
141 lines (120 loc) · 3.79 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
project = 'Python 3: from None to Machine Learning'
author = 'Matt Harasymczuk'
email = 'matt@astrotech.io'
html_theme = 'sphinx_rtd_theme'
todo_emit_warnings = False
todo_include_todos = True
extensions = [
'sphinxcontrib.bibtex',
'sphinx.ext.doctest',
'sphinx.ext.todo',
'sphinx.ext.imgmath',
# 'sphinx.ext.autosectionlabel',
# 'sphinx.ext.viewcode',
# 'sphinx.ext.coverage',
# 'sphinx.ext.githubpages',
# 'sphinx.ext.autodoc',
# 'sphinx.ext.intersphinx',
# 'sphinx.ext.graphviz',
# 'sphinxjp.themes.revealjs',
# 'nbsphinx',
# 'IPython.sphinxext.ipython_console_highlighting',
]
language = 'en'
numfig_format = {
'section': 'Section %s.',
'figure': 'Figure %s.',
'table': 'Table %s.',
'code-block': 'Listing %s.',
}
exclude_patterns = [
'_book',
'*/_template.rst',
]
# article - for articles in scientific journals, presentations, short reports, program documentation, invitations, ...
# proc - a class for proceedings based on the article class.
# minimal - is as small as it can get. It only sets a page size and a base font. It is mainly used for debugging purposes.
# report - for longer reports containing several chapters, small books, thesis, ...
# book - for real books
# slides - for slides. The class uses big sans serif letters.
# memoir - for changing sensibly the output of the document. It is based on the book class, but you can create any kind of document with it (1)
# letter - For writing letters.
# beamer - For writing presentations (see LaTeX/Presentations).
latex_documentclass = 'report'
html_context = {}
# -- Standard book config -----------------------------------------------------
import os
import re
import subprocess
import sys
from datetime import date
needs_sphinx = '2.1'
exclude_patterns += [
'.*',
'venv*',
'virtualenv*',
'_build',
'_extensions',
'_img',
'_slides',
'_static',
'_themes',
'_tmp',
'*/contrib/*',
'*/solution/*',
'*/solutions/*',
'**.ipynb_checkpoints',
'README.rst',
'TODO.rst',
'Thumbs.db',
'.DS_Store',
]
templates_path = ['_templates']
highlight_language = 'python3'
pygments_style = 'borland'
sys.path.insert(0, os.path.abspath('_extensions'))
# 0 - sequence number of image in whole document
# 1 - sequence number of image in header level 1 (only if :numbered: option is present at toctree directive)
# 2 - sequence number of image in header level 2
# will use x.1, x.2, … if located directly under a header level 1,
# will use 1, 2, … if at the document level
numfig_secnum_depth = 0
numfig = True
smartquotes = False
project_slug = re.sub(r'[\W]+', '', project)
sha1 = subprocess.run('git log -1 --format="%h"', stdout=subprocess.PIPE, shell=True, encoding='utf-8').stdout.strip()
year = date.today().year
today = date.today().strftime('%Y-%m-%d')
version = f'#{sha1}, {today}'
release = f'#{sha1}, {today}'
copyright = f'{year}, {author} <{email}>'
html_show_sphinx = False
html_use_smartypants = False
html_search_language = language
html_add_permalinks = ""
html_theme_path = ['_themes']
html_secnumber_suffix = '. '
html_title = project
if os.path.isdir('_static'):
html_static_path = ['_static']
html_context.update({
'css_files': [
'_static/screen.css',
'_static/print.css',
],
'script_files': [
'_static/jquery.min.js',
'_static/onload.js',
],
})
latex_documents = [('index', f'{project_slug}.tex', project, author, latex_documentclass)]
latex_elements = {
'papersize': 'a4paper',
'pointsize': '10pt',
'figure_align': 'htbp',
# Fix for: LaTeX Backend Fails with Citations In Figure Captions
'preamble': r"""
\usepackage{etoolbox}
\AtBeginEnvironment{figure}{\renewcommand{\phantomsection}{}}
"""
}