Debian Codegraph @

docs/conf.py

raw
1 import re
2 import sys
3
4 sys.path.append('.')
5
6
7 def changelog_version(path, encoding='utf-8'):
8 "Return the 1st *stable* (not pre, dev) version in the changelog"
9 # See also grep_version() in setup.py
10 # e.g. "0.1.2, (1999-12-31)\n"
11 version_pattern = re.compile(
12 r'^v(?P<version>\d+\.\d+\.\d+) \((?P<date>\d\d\d\d-\d\d-\d\d)\)$',
13 re.MULTILINE,
14 )
15
16 with open(path, encoding=encoding) as f:
17 match = version_pattern.search(f.read())
18 return match.group('version')
19
20
21 VERSION = changelog_version('changelog.rst')
22
23 author = u'Network Genomics'
24 copyright = u'2021, the Mitogen authors'
25 exclude_patterns = ['_build', '.venv']
26 extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinxcontrib.programoutput', 'domainrefs']
27
28 # get rid of version from <title>, it messes with piwik
29 html_title = 'Mitogen Documentation'
30
31 html_show_copyright = False
32 html_show_sourcelink = False
33 html_show_sphinx = False
34 html_sidebars = {'**': ['globaltoc.html', 'github.html']}
35 html_static_path = ['_static']
36 html_theme = 'alabaster'
37 html_theme_options = {
38 'font_family': "Georgia, serif",
39 'head_font_family': "Georgia, serif",
40 'fixed_sidebar': True,
41 'show_powered_by': False,
42 'pink_2': 'fffafaf',
43 'pink_1': '#fff0f0',
44 }
45 htmlhelp_basename = 'mitogendoc'
46 intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
47 language = None
48 master_doc = 'toc'
49 project = u'Mitogen'
50 pygments_style = 'sphinx'
51 release = VERSION
52 source_suffix = '.rst'
53 templates_path = ['_templates']
54 todo_include_todos = False
55 version = VERSION
56
57 domainrefs = {
58 'gh:commit': {
59 'text': '%s',
60 'url': 'https://github.com/mitogen-hq/mitogen/commit/%s',
61 },
62 'gh:issue': {
63 'text': '#%s',
64 'url': 'https://github.com/mitogen-hq/mitogen/issues/%s',
65 },
66 'gh:pull': {
67 'text': '#%s',
68 'url': 'https://github.com/mitogen-hq/mitogen/pull/%s',
69 },
70 'gh:ansissue': {
71 'text': 'Ansible #%s',
72 'url': 'https://github.com/ansible/ansible/issues/%s',
73 },
74 'gh:anspull': {
75 'text': 'Ansible #%s',
76 'url': 'https://github.com/ansible/ansible/pull/%s',
77 },
78
79 'ans:mod': {
80 'text': '%s module',
81 'url': 'https://docs.ansible.com/ansible/latest/modules/%s_module.html',
82 },
83 'ans:conn': {
84 'text': '%s connection plug-in',
85 'url': 'https://docs.ansible.com/ansible/latest/plugins/connection/%s.html',
86 },
87 'freebsd:man2': {
88 'text': '%s(2)',
89 'url': 'https://man.freebsd.org/cgi/man.cgi?query=%s',
90 },
91 'linux:man1': {
92 'text': '%s(1)',
93 'url': 'https://man7.org/linux/man-pages/man1/%s.1.html',
94 },
95 'linux:man2': {
96 'text': '%s(2)',
97 'url': 'https://man7.org/linux/man-pages/man2/%s.2.html',
98 },
99 'linux:man3': {
100 'text': '%s(3)',
101 'url': 'https://man7.org/linux/man-pages/man3/%s.3.html',
102 },
103 'linux:man7': {
104 'text': '%s(7)',
105 'url': 'https://man7.org/linux/man-pages/man7/%s.7.html',
106 },
107 }
108
109 # > ## Official guidance
110 # > Query PyPI’s JSON API to determine where to download files from.
111 # > ## Predictable URLs
112 # > You can use our conveyor service to fetch this file, which exists for
113 # > cases where using the API is impractical or impossible.
114 # > -- https://warehouse.pypa.io/api-reference/integration-guide.html#predictable-urls
115 rst_epilog = """
116
117 .. |mitogen_version| replace:: %(VERSION)s
118
119 .. |mitogen_url| replace:: `mitogen-%(VERSION)s.tar.gz <https://files.pythonhosted.org/packages/source/m/mitogen/mitogen-%(VERSION)s.tar.gz>`__
120
121 """ % locals()