File: conf.py

package info (click to toggle)
xrayutilities 1.7.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,660 kB
  • sloc: python: 49,871; ansic: 4,585; makefile: 15
file content (136 lines) | stat: -rw-r--r-- 3,979 bytes parent folder | download
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
# -*- coding: utf-8 -*-
#
# xrayutilities documentation build configuration file, created by
# sphinx-quickstart on Sat Mar  2 11:39:01 2013.
#
# This file is execfile()d with the current directory set to its containing
# dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import re
from pathlib import Path

import sphinx_rtd_theme
#from sphinx_pyproject import SphinxConfig
from xrayutilities import __version__ as xu_version

# Load configuration from pyproject.toml

#config = SphinxConfig(
#    Path(__file__).parent.parent.parent / "pyproject.toml",
#    config_overrides = {"version": xu_version},
#)

# Project information (auto-extracted from pyproject.toml)
#project = config.name     # Automatically gets the project name
#author = config.author    # Automatically gets the author(s)
#copyright = f"%Y, {config.author}"
#release = config.version  # Full version (e.g., "1.2.3")
#version = config.version.split(".")[0] + "." + config.version.split(".")[1]  # Short version (e.g., "1.2")

# Add any Sphinx extension module names here, as strings. They can be
# extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.coverage',
    'sphinx.ext.doctest',
    'sphinx.ext.intersphinx',
    'sphinx.ext.mathjax',
    'sphinx.ext.viewcode',
    'numpydoc']

intersphinx_mapping = {
    'python': ('https://docs.python.org/3', None),
    'matplotlib': ('https://matplotlib.org/stable', None),
    'lmfit': ('https://lmfit.github.io/lmfit-py/', None),
}
# Paths
templates_path = ["_templates"]
source_suffix = ".rst"
master_doc = "index"

# solve "toctree contains reference to nonexisting document" warnings
numpydoc_show_class_members = False

# HTML output options
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
#html_theme_options = {"logo_only": True}
html_logo = "pics/xray-logo.png"
html_favicon = "favicon.ico"
# Output file base name for HTML help builder.
htmlhelp_basename = 'xrayutilitiesdoc'

# -- Options for Sphinx output ------------------------------------------

mathjax_path = 'file:///usr/share/javascript/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML'

# LaTeX options
latex_elements = {
    # The paper size ('letterpaper' or 'a4paper').
    'papersize': 'a4paper',

    # The font size ('10pt', '11pt' or '12pt').
    # 'pointsize': '10pt',

    # Additional stuff for the LaTeX preamble.
    'preamble': '\\usepackage{enumitem}\n\\setlistdepth{15}',
}
latex_documents = [
    ('index', 'xrayutilities.tex', u'xrayutilities Documentation',
     u'Dominik Kriegner \\and Eugen Wintersberger', 'manual'),
]



# manual page options
man_pages = [
    ('index', 'xrayutilities', u'xrayutilities Documentation',
     [u'Dominik Kriegner, Eugen Wintersberger'], 1)
]


# Texinfo options
texinfo_documents = [
    ('index',
     'xrayutilities',
     u'xrayutilities Documentation',
     u'Dominik Kriegner, Eugen Wintersberger',
     'xrayutilities',
     'a Python package for diffraction physicists',
     'Miscellaneous'),
]


# PDF output options
#pdf_documents = [
#    ("index", "xrayutilities", "xrayutilities", author),
#]
#pdf_stylesheets = ["sphinx", "onecolumn"]
#pdf_compressed = True
#pdf_default_dpi = 120


def process_docstring(app, what, name, obj, options, lines):
    """my additions for pre-processing the docstring"""
    # insert note block
    for i in range(len(lines)):
        lines[i] = re.sub(r'^\s*Note:', r'.. note::', lines[i])


def skip(app, what, name, obj, would_skip, options):
    """always document __init__ and __call__ functions"""
    if name in ["__init__", "__call__"]:
        return False
    return would_skip


def setup(app):
    app.connect('autodoc-process-docstring', process_docstring)
    app.connect("autodoc-skip-member", skip)