|
11 | 11 | from pygmt.sphinx_gallery import PyGMTScraper
|
12 | 12 | from sphinx_gallery.sorting import ExampleTitleSortKey, ExplicitOrder
|
13 | 13 |
|
14 |
| -# Dictionary for dependency name and minimum required version. |
| 14 | +# Dictionary for dependency name and minimum required versions |
15 | 15 | requirements = {
|
16 | 16 | Requirement(requirement).name: str(Requirement(requirement).specifier)
|
17 | 17 | for requirement in importlib.metadata.requires("pygmt")
|
|
50 | 50 |
|
51 | 51 | # Auto-generate header anchors with MyST parser
|
52 | 52 | myst_heading_anchors = 4
|
53 |
| -# reference: https://myst-parser.readthedocs.io/en/latest/syntax/optional.html |
| 53 | +# MyST extensions |
| 54 | +# Reference: https://myst-parser.readthedocs.io/en/latest/syntax/optional.html |
54 | 55 | myst_enable_extensions = [
|
55 | 56 | "attrs_inline", # Allow inline attributes after images
|
56 | 57 | "colon_fence", # Allow code fences using colons
|
|
61 | 62 | "requires": requirements,
|
62 | 63 | }
|
63 | 64 |
|
64 |
| -# MyST-NB configurations. |
| 65 | +# Configure MyST-NB |
65 | 66 | # Reference: https://myst-nb.readthedocs.io/en/latest/configuration.html
|
66 |
| -nb_render_markdown_format = "myst" # The format to use for text/markdown rendering |
| 67 | +nb_render_markdown_format = "myst" # Format for text/markdown rendering |
67 | 68 |
|
68 |
| -# Make the list of returns arguments and attributes render the same as the |
69 |
| -# parameters list |
| 69 | +# Render the return argument and attribute lists in the same way as the parameter lists |
70 | 70 | napoleon_use_rtype = False
|
71 | 71 | napoleon_use_ivar = True
|
72 | 72 |
|
73 |
| -# sphinx_auto_typehints |
| 73 | +# Configure sphinx_auto_typehints |
74 | 74 | typehints_defaults = "comma"
|
75 | 75 |
|
76 |
| -# configure links to GMT docs |
| 76 | +# Define links to GMT docs |
77 | 77 | extlinks = {
|
78 | 78 | "gmt-docs": ("https://docs.generic-mapping-tools.org/6.5/%s", None),
|
79 | 79 | "gmt-term": ("https://docs.generic-mapping-tools.org/6.5/gmt.conf#term-%s", "%s"),
|
80 | 80 | "gmt-datasets": ("https://www.generic-mapping-tools.org/remote-datasets/%s", None),
|
81 | 81 | }
|
82 | 82 |
|
83 |
| -# intersphinx configuration |
| 83 | +# Configure intersphinx |
84 | 84 | intersphinx_mapping = {
|
85 | 85 | "contextily": ("https://contextily.readthedocs.io/en/stable/", None),
|
86 | 86 | "geopandas": ("https://geopandas.org/en/stable/", None),
|
|
93 | 93 | "xyzservices": ("https://xyzservices.readthedocs.io/en/stable", None),
|
94 | 94 | }
|
95 | 95 |
|
96 |
| -# options for sphinx-copybutton |
97 |
| -# https://sphinx-copybutton.readthedocs.io |
| 96 | +# Configure sphinx-copybutton |
| 97 | +# Reference: https://sphinx-copybutton.readthedocs.io |
98 | 98 | copybutton_prompt_text = r">>> |\.\.\. "
|
99 | 99 | copybutton_prompt_is_regexp = True
|
100 | 100 | copybutton_only_copy_prompt_lines = True
|
101 | 101 | copybutton_remove_prompts = True
|
102 | 102 |
|
103 | 103 | sphinx_gallery_conf = {
|
104 |
| - # path to your examples scripts |
| 104 | + # Set paths to your examples scripts |
105 | 105 | "examples_dirs": [
|
106 | 106 | "../examples/gallery",
|
107 | 107 | "../examples/tutorials",
|
108 | 108 | "../examples/get_started",
|
109 | 109 | "../examples/projections",
|
110 | 110 | ],
|
111 |
| - # path where to save gallery generated examples |
| 111 | + # Set paths where to save the generated examples |
112 | 112 | "gallery_dirs": ["gallery", "tutorials", "get_started", "projections"],
|
113 | 113 | "subsection_order": ExplicitOrder(
|
114 | 114 | [
|
|
136 | 136 | "filename_pattern": r"\.py",
|
137 | 137 | # Remove the "Download all examples" button from the top level gallery
|
138 | 138 | "download_all_examples": False,
|
139 |
| - # Sort gallery example by file name instead of number of lines (default) |
| 139 | + # Sort gallery examples by the file names instead of number of lines [Default] |
140 | 140 | "within_subsection_order": ExampleTitleSortKey,
|
141 |
| - # directory where function granular galleries are stored |
| 141 | + # Directory where function granular galleries are stored |
142 | 142 | "backreferences_dir": "api/generated/backreferences",
|
143 |
| - # Modules for which function level galleries are created. In |
144 |
| - # this case sphinx_gallery and numpy in a tuple of strings. |
145 |
| - "doc_module": "pygmt", |
| 143 | + # Modules for which function level galleries are created (given as tuple of strings) |
| 144 | + "doc_module": ("pygmt",), |
146 | 145 | # Insert links to documentation of objects in the examples
|
147 | 146 | "reference_url": {"pygmt": None},
|
148 | 147 | "image_scrapers": (PyGMTScraper(),),
|
149 |
| - # Removes configuration comments from scripts |
| 148 | + # Remove configuration comments from scripts |
150 | 149 | "remove_config_comments": True,
|
151 |
| - # Disable "nested_sections" (default is True), to |
152 |
| - # generate only a single index file for the whole gallery. |
153 |
| - # This is a new feature up on Sphinx-Gallery 0.11.0. |
| 150 | + # Disable "nested_sections" [Default is True], to generate only a single index file |
| 151 | + # for the whole gallery. This is a new feature up on Sphinx-Gallery 0.11.0. |
154 | 152 | "nested_sections": False,
|
155 | 153 | }
|
156 | 154 |
|
157 |
| -# Sphinx project configuration |
| 155 | +# Configure Sphinx project |
158 | 156 | templates_path = ["_templates"]
|
159 | 157 | exclude_patterns = [
|
160 | 158 | "_build",
|
161 | 159 | "**.ipynb_checkpoints",
|
162 | 160 | # Workaround from https://github.com/executablebooks/MyST-NB/issues/363 to prevent
|
163 |
| - # myst-nb from parsing the .ipynb and .py files generated by sphinx-gallery. |
| 161 | + # MyST-NB from parsing the .ipynb and .py files generated by Sphinx-Gallery. |
164 | 162 | "gallery/**.ipynb",
|
165 | 163 | "tutorials/**.ipynb",
|
166 | 164 | "get_started/**.ipynb",
|
|
173 | 171 |
|
174 | 172 | source_suffix = ".rst"
|
175 | 173 | needs_sphinx = "1.8"
|
176 |
| -# The encoding of source files. |
| 174 | +# Encoding of source files |
177 | 175 | source_encoding = "utf-8-sig"
|
178 | 176 | root_doc = "index"
|
179 | 177 |
|
|
183 | 181 | copyright = f"2017-{year}, The PyGMT Developers" # noqa: A001
|
184 | 182 | if len(__version__.split("+")) > 1 or __version__ == "unknown":
|
185 | 183 | version = "dev"
|
186 |
| - # Set base_url for stable version |
| 184 | + # Set base URL for dev version |
187 | 185 | html_baseurl = "https://pygmt.org/dev/"
|
188 | 186 | else:
|
189 | 187 | version = __version__
|
190 |
| - # Set base_url for dev version |
| 188 | + # Set base URL for stable version |
191 | 189 | html_baseurl = "https://pygmt.org/latest/"
|
192 | 190 | release = __version__
|
193 | 191 |
|
|
205 | 203 | html_show_sphinx = False
|
206 | 204 | html_show_copyright = True
|
207 | 205 |
|
208 |
| -# Theme config |
| 206 | +# Configure theme |
209 | 207 | html_theme = "sphinx_rtd_theme"
|
210 | 208 | html_theme_options = {}
|
211 | 209 | repository = "GenericMappingTools/pygmt"
|
|
237 | 235 | repository_url,
|
238 | 236 | ),
|
239 | 237 | ],
|
240 |
| - # Custom variables to enable "Improve this page"" and "Download notebook" |
241 |
| - # links |
| 238 | + # Custom variables to enable "Improve this page"" and "Download notebook" links |
242 | 239 | "doc_path": "doc",
|
243 | 240 | "galleries": sphinx_gallery_conf["gallery_dirs"],
|
244 | 241 | "gallery_dir": dict(
|
|
0 commit comments