-
Notifications
You must be signed in to change notification settings - Fork 242
Expand file tree
/
Copy pathconf.py
More file actions
169 lines (156 loc) · 5.18 KB
/
conf.py
File metadata and controls
169 lines (156 loc) · 5.18 KB
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# -*- coding: utf-8 -*-
"""
Sphinx documentation configuration file.
"""
# pylint: disable=invalid-name
import datetime
from sphinx_gallery.sorting import ( # pylint: disable=no-name-in-module
FileNameSortKey,
ExplicitOrder,
)
from pygmt import __version__, __commit__
from pygmt.sphinx_gallery import PyGMTScraper
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.doctest",
"sphinx.ext.viewcode",
"sphinx.ext.extlinks",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"nbsphinx",
"sphinx_gallery.gen_gallery",
]
# Autosummary pages will be generated by sphinx-autogen instead of sphinx-build
autosummary_generate = []
# Make the list of returns arguments and attributes render the same as the
# parameters list
napoleon_use_rtype = False
napoleon_use_ivar = True
# configure links to GMT docs
extlinks = {
"gmt-docs": ("https://docs.generic-mapping-tools.org/latest/%s", None),
"gmt-term": ("https://docs.generic-mapping-tools.org/latest/gmt.conf#term-%s", ""),
}
# intersphinx configuration
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"numpy": ("https://docs.scipy.org/doc/numpy/", None),
"pandas": ("http://pandas.pydata.org/pandas-docs/stable/", None),
"xarray": ("http://xarray.pydata.org/en/stable/", None),
}
sphinx_gallery_conf = {
# path to your examples scripts
"examples_dirs": [
"../examples/gallery",
"../examples/tutorials",
"../examples/projections",
],
# path where to save gallery generated examples
"gallery_dirs": ["gallery", "tutorials", "projections"],
"subsection_order": ExplicitOrder(
[
"../examples/gallery/line",
"../examples/gallery/coast",
"../examples/gallery/plot",
"../examples/gallery/grid",
"../examples/projections/azim",
"../examples/projections/conic",
"../examples/projections/cyl",
"../examples/projections/misc",
"../examples/projections/nongeo",
]
),
# Patter to search for example files
"filename_pattern": r"\.py",
# Remove the "Download all examples" button from the top level gallery
"download_all_examples": False,
# Sort gallery example by file name instead of number of lines (default)
"within_subsection_order": FileNameSortKey,
# directory where function granular galleries are stored
"backreferences_dir": "api/generated/backreferences",
# Modules for which function level galleries are created. In
# this case sphinx_gallery and numpy in a tuple of strings.
"doc_module": "pygmt",
# Insert links to documentation of objects in the examples
"reference_url": {"pygmt": None},
"image_scrapers": (PyGMTScraper(),),
}
# Sphinx project configuration
templates_path = ["_templates"]
exclude_patterns = ["_build", "**.ipynb_checkpoints"]
source_suffix = ".rst"
needs_sphinx = "1.8"
# The encoding of source files.
source_encoding = "utf-8-sig"
master_doc = "index"
# General information about the project
year = datetime.date.today().year
project = "PyGMT"
copyright = f"2017-{year}, The PyGMT Developers." # pylint: disable=redefined-builtin
if len(__version__.split("+")) > 1 or __version__ == "unknown":
version = "dev"
else:
version = __version__
release = __version__
# These enable substitutions using |variable| in the rst files
rst_epilog = """
.. |year| replace:: {year}
""".format(
year=year
)
html_last_updated_fmt = "%b %d, %Y"
html_title = "PyGMT"
html_short_title = "PyGMT"
html_logo = ""
html_favicon = "_static/favicon.png"
html_static_path = ["_static"]
html_css_files = ["style.css"]
html_extra_path = []
pygments_style = "default"
add_function_parentheses = False
html_show_sourcelink = False
html_show_sphinx = False
html_show_copyright = True
# Theme config
html_theme = "sphinx_rtd_theme"
html_theme_options = {}
repository = "GenericMappingTools/pygmt"
repository_url = "https://github.com/GenericMappingTools/pygmt"
commit_link = f'<a href="{repository_url}/commit/{ __commit__ }">{ __commit__[:7] }</a>'
html_context = {
"menu_links": [
(
'<i class="fa fa-users fa-fw"></i> Contributing',
f"{repository_url}/blob/master/CONTRIBUTING.md",
),
(
'<i class="fa fa-gavel fa-fw"></i> Code of Conduct',
f"{repository_url}/blob/master/CODE_OF_CONDUCT.md",
),
(
'<i class="fa fa-book fa-fw"></i> License',
f"{repository_url}/blob/master/LICENSE.txt",
),
(
'<i class="fa fa-comment fa-fw"></i> Contact',
"https://forum.generic-mapping-tools.org",
),
(
'<i class="fa fa-github fa-fw"></i> Source Code',
repository_url,
),
],
# Custom variables to enable "Improve this page"" and "Download notebook"
# links
"doc_path": "doc",
"galleries": sphinx_gallery_conf["gallery_dirs"],
"gallery_dir": dict(
zip(sphinx_gallery_conf["gallery_dirs"], sphinx_gallery_conf["examples_dirs"])
),
"github_repo": repository,
"github_version": "master",
"commit": commit_link,
}