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# -- Path setup --------------------------------------------------------------
7# If extensions (or modules to document with autodoc) are in another directory,
8# add these directories to sys.path here. If the directory is relative to the
9# documentation root, use os.path.abspath to make it absolute, like shown here.
10
11import os, sys, re
12
13sys.path.insert(0, os.path.abspath(".."))
14sys.path.insert(0, os.path.abspath("../tests"))
15
16import pyyc
17
18# -- Project information -----------------------------------------------------
19# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
20
21project = "pyYC \\pwik\\"
22copyright = "2024, Yannick Copin"
23author = "Yannick Copin"
24
25# Major version (used by '|version|')
26version = pyyc.__version__ # Obtained from package __version__
27# If you want to differentiate version (major) and release (detailed),
28# the full release, including alpha/beta/rc tags (used by '|release|')
29# Here, obtained from 'git describe' string
30release = re.sub("^v", "", os.popen("git describe").read().strip())
31
32# -- General configuration ---------------------------------------------------
33# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
34
35# Add any Sphinx extension module names here, as strings. They can be
36# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
37# ones.
38extensions = [
39 # Standard extensions
40 "sphinx.ext.autodoc", # automatic documentation
41 #'sphinx.ext.autosummary', # automatic summary
42 "sphinx.ext.intersphinx", # link to external documentations
43 "sphinx.ext.mathjax", # (or pngmath) support for equations
44 "sphinx.ext.viewcode", # link to code source
45 "sphinx.ext.extlinks", # support for external links
46 "sphinx.ext.autosectionlabel", # automatic section label
47 #'sphinx.ext.coverage', # documentation coverage
48 # Additional extensions (see https://github.com/OddBloke/sphinx-git)
49 "nbsphinx", # support for Ipython Notebooks
50 # 'matplotlib.sphinxext.plot_directive', # support for embedded plots
51 # 'sphinx-git', # create a changelog from git history
52]
53
54# Autodoc configuration
55autodoc_default_options = {
56 "members": True, # Document all members
57 "undoc-members": True, # ... including undocumented ones
58 "ignore-module-all": True, # do not stick to __all__
59}
60autoclass_content = "both" # Insert class and __init__ docstrings
61autodoc_member_order = "bysource" # Keep source order
62
63# Intersphinx configuration
64intersphinx_mapping = {
65 "python": ("https://docs.python.org/3/", None),
66 "pytest": ("https://docs.pytest.org/en/stable/", None),
67 "sphinx": ("https://www.sphinx-doc.org/en/master/", None),
68}
69
70# Extlinks configuration
71extlinks = {
72 "pypi": ("https://pypi.org/project/%s", "%s"), # PyPI
73}
74
75# Autosectionlabel configuration
76autosectionlabel_prefix_document = True # :ref:`fichier:section`
77
78# Coverage configuration
79coverage_show_missing_items = True
80
81# nbsphinx configuration
82nbsphinx_prolog = r"""
83{% set docname = env.doc2path(env.docname, base=False) %}
84.. raw:: latex
85
86 \nbsphinxstartnotebook{\scriptsize\noindent\strut
87 \textcolor{gray}{The following section was generated from
88 \sphinxcode{\sphinxupquote{\strut {{ docname | escape_latex }}}} \dotfill}}
89"""
90
91nbsphinx_epilog = r"""
92{% set docname = env.doc2path(env.docname, base=False) %}
93.. only:: html
94
95 .. role:: raw-html(raw)
96 :format: html
97
98 .. nbinfo::
99
100 This page was generated from `{{ docname }}`.
101
102.. raw:: latex
103
104 \nbsphinxstopnotebook{\scriptsize\noindent\strut
105 \textcolor{gray}{\dotfill\ \sphinxcode{\sphinxupquote{\strut
106 {{ docname | escape_latex }}}} ends here.}}
107"""
108
109# mathjax configuration
110mathjax3_config = {
111 "tex": {"tags": "ams", "useLabelIds": True},
112}
113
114# Add any paths that contain templates here, relative to this directory.
115templates_path = ["_templates"]
116
117# The master toctree document.
118master_doc = "index"
119
120# The version info for the project you're documenting, acts as replacement for
121# |version| and |release|, also used in various other places throughout the
122# built documents.
123#
124# The language for content autogenerated by Sphinx. Refer to documentation
125# for a list of supported languages.
126language = "en"
127
128# There are two options for replacing |today|: either, you set today to some
129# non-false value, then it is used:
130# today = ''
131# Else, today_fmt is used as the format for a strftime call.
132# today_fmt = '%B %d, %Y'
133today_fmt = "%y-%m-%d, %H:%M"
134
135# List of patterns, relative to source directory, that match files and
136# directories to ignore when looking for source files.
137# This pattern also affects html_static_path and html_extra_path.
138exclude_patterns = [
139 "_build",
140 "Thumbs.db",
141 ".DS_Store",
142 "**.ipynb_checkpoints",
143 "**.egg-info",
144]
145
146# The reST default role (used for this markup: `text`) to use for all
147# documents.
148default_role = "literal"
149
150highlight_language = "console"
151
152# If true, '()' will be appended to :func: etc. cross-reference text.
153add_function_parentheses = True
154
155# If true, the current module name will be prepended to all description
156# unit titles (such as .. function::).
157add_module_names = True
158
159# If true, sectionauthor and moduleauthor directives will be shown in the
160# output. They are ignored by default.
161show_authors = True
162
163# The name of the Pygments (syntax highlighting) style to use.
164pygments_style = "emacs"
165
166# If true, keep warnings as "system message" paragraphs in the built documents.
167keep_warnings = True
168
169# -- Options for HTML output -------------------------------------------------
170# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
171
172# https://www.sphinx-doc.org/en/master/usage/theming.html#builtin-themes
173html_theme = "bizstyle"
174html_static_path = ["_static"]
175
176# If true, links to the reST sources are added to the pages.
177html_show_sourcelink = True
178
179# -- Options for LaTeX output ---------------------------------------------
180
181latex_elements = {
182 "papersize": "a4paper",
183 "pointsize": "10pt",
184 "fontenc": r"\usepackage[LGR,T1]{fontenc}",
185 "utf8extra": r"""
186\DeclareUnicodeCharacter{212B}{\AA} % Å
187""",
188 "preamble": r"""
189\usepackage{alphalph}
190\renewcommand{\thefootnote}{\alphalph{\value{footnote}}}
191""",
192}
193
194# Grouping the document tree into LaTeX files. List of tuples
195# (source start file, target name, title,
196# author, documentclass [howto, manual, or own class]).
197latex_documents = [
198 (master_doc, "pyyc.tex", "PyYC Documentation", author, "manual"),
199]
200
201# If true, show page references after internal links.
202latex_show_pagerefs = True
203
204# If true, show URL addresses after external links.
205latex_show_urls = "footnote"
206
207# If false, no module index is generated.
208latex_domain_indices = False