|
25 | 25 |
|
26 | 26 | from pkg_resources import parse_version as V |
27 | 27 |
|
28 | | -sys.path.insert(0, "../../install") |
| 28 | +import imaspy |
| 29 | + |
29 | 30 |
|
30 | 31 | print("python exec:", sys.executable) |
31 | 32 | print("sys.path:", sys.path) |
32 | 33 |
|
33 | | -import imaspy |
34 | | - |
35 | 34 | # -- Project information ----------------------------------------------------- |
36 | 35 | # The documented project’s name |
37 | 36 | project = src_project = PROJECT = "IMASPy" |
38 | 37 |
|
39 | 38 | # PROJECT_ID=10189354 |
40 | 39 | PACKAGE = "imaspy" |
41 | 40 | PACKAGE_HOST = "gitlab" |
42 | | -src_group = GROUP = "KLIMEX" |
| 41 | +src_group = GROUP = "IMAS" |
43 | 42 |
|
44 | 43 | # A copyright statement in the style '2008, Author Name'. |
45 | | -copyright = f"2016-{datetime.datetime.now().year}, Karel van de Plassche (DIFFER)" |
| 44 | +copyright = f"2020-{datetime.datetime.now().year}, ITER Organization" |
46 | 45 | # The author name(s) of the document |
47 | | -author = "Karel van de Plassche (DIFFER)" |
48 | | -src_host = "gitlab.com" |
| 46 | +author = "ITER Organization" |
| 47 | +src_host = "git.iter.org" |
49 | 48 |
|
50 | 49 | # Parse urls here for convenience, to be re-used |
51 | | -# gitlab imaspy folder |
52 | | -repository_url = f"https://{src_host}/{src_group}/{src_project}/" |
53 | | -blob_url = urljoin(repository_url, "-/blob/master/") |
54 | | -issue_url = urljoin(repository_url, "-/issues/") |
55 | | -mr_url = urljoin(repository_url, "-/merge_requests/") |
56 | | - |
57 | | -# JINTRAC docs |
58 | | -jintrac_sphinx = "https://users.euro-fusion.org/pages/data-cmg/wiki/" |
59 | 50 |
|
60 | 51 | # netCDF4 docs |
61 | 52 | netcdf4_docs = "https://unidata.github.io/netcdf4-python/netCDF4/index.html" |
62 | 53 |
|
63 | 54 | # ITER docs |
64 | 55 | iter_projects = "https://git.iter.org/projects/" |
65 | | -imas_site = urljoin(iter_projects, "IMAS/") |
66 | | -imex_site = urljoin(iter_projects, "IMEX/") |
67 | | -al_cython_url = urljoin(imas_site, "repos/al-cython/") |
68 | | -al_python_hli_url = urljoin(imas_site, "repos/al-python/") |
69 | | -al_python_lib_url = urljoin(imas_site, "repos/al-python-lib/") |
| 56 | +imas_repos = urljoin(iter_projects, "IMAS/") |
| 57 | +imex_repos = urljoin(iter_projects, "IMEX/") |
| 58 | +al_cython_url = urljoin(imas_repos, "repos/al-cython/") |
| 59 | +al_python_hli_url = urljoin(imas_repos, "repos/al-python/") |
| 60 | +al_python_lib_url = urljoin(imas_repos, "repos/al-python-lib/") |
70 | 61 | issue_url = jira_url = "https://jira.iter.org/browse/" |
71 | 62 |
|
| 63 | +# IMASPy |
| 64 | +repository_url = f"{iter_projects}/{src_group}/repos/{src_project}/" |
| 65 | +blob_url = urljoin(repository_url, "browse/") |
| 66 | +mr_url = urljoin(repository_url, "/pull-requests") |
| 67 | + |
| 68 | + |
72 | 69 | # Configuration of sphinx.ext.extlinks |
73 | 70 | # See https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html |
74 | 71 | # unique name: (base URL, label prefix) |
75 | 72 | extlinks = { |
76 | 73 | "src": (blob_url + "%s", f"{src_group}/{src_project}/"), |
77 | | - "issue": (issue_url + "%s", None), |
| 74 | + "issue": (issue_url + "%s", "#"), |
78 | 75 | "merge": (mr_url + "%s", "!"), |
79 | | - "jintrac": (jintrac_sphinx + "%s", "jintrac pages "), |
80 | 76 | "netcdf4": (netcdf4_docs + "%s", "netcdf4 "), |
81 | 77 | "al_cython": (al_cython_url + "%s", "al_cython "), |
82 | 78 | "al_hli": (al_python_hli_url + "%s", "al_hli"), |
|
115 | 111 | # 'matplotlib.sphinxext.plot_directive', # numpy |
116 | 112 | # 'IPython.sphinxext.ipythoGn_console_highlighting', # numpy |
117 | 113 | # 'IPython.sphinxext.ipython_directive', # numpy |
118 | | - "sphinx.ext.mathjax", # Render math with mathjax |
| 114 | + "sphinx.ext.mathjax", # Render math as images |
119 | 115 | "sphinx_rtd_theme", # Theme |
120 | 116 | "recommonmark", # For markdown support, does not support 'full' CommonMark syntax (yet)! |
| 117 | + "sphinx_autodoc_typehints", # Auto-parse type hints. Napoleon BEFORE typehints |
121 | 118 | ] |
122 | 119 |
|
123 | 120 | # Add any paths that contain templates here, relative to this directory. |
|
246 | 243 |
|
247 | 244 |
|
248 | 245 | # -- Extension configuration ------------------------------------------------- |
| 246 | +# Configuration of sphinx.ext.autodoc |
| 247 | +# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html |
| 248 | +autodoc_typehints = "none" # Use sphinx_autodoc_typehints instead |
| 249 | + |
| 250 | + |
249 | 251 | # from recommonmark.transform import AutoStructify |
250 | 252 |
|
251 | 253 | # app setup hook |
|
265 | 267 | # app.add_transform(AutoStructify) |
266 | 268 |
|
267 | 269 |
|
268 | | -# Configuration of sphinx.ext.autodoc |
269 | | -# https://www.sphinx-doc.org/en/master/usage/quickstart.html#autodoc |
270 | | -# autodoc_typehints = "none" #xarray |
271 | | - |
272 | 270 | # Configuration of sphinx.ext.autosummary |
273 | 271 | # https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html |
274 | 272 | autosummary_generate = True |
|
279 | 277 | # Configuration of sphinx.ext.napoleon |
280 | 278 | # Support for NumPy and Google style docstrings |
281 | 279 | # See https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html |
282 | | -# napoleon_google_docstring = True |
283 | | -# napoleon_numpy_docstring = True |
| 280 | +napoleon_google_docstring = True |
| 281 | +napoleon_numpy_docstring = False |
284 | 282 | napoleon_include_init_with_doc = True |
285 | 283 | napoleon_include_private_with_doc = True |
286 | 284 | # napoleon_include_special_with_doc = True |
|
289 | 287 | # napoleon_use_admonition_for_references = False |
290 | 288 | # napoleon_use_ivar = False |
291 | 289 | # napoleon_use_param = True |
292 | | -napoleon_use_keyword = True # Use the "Keyword Args" syntax |
| 290 | +# napoleon_use_keyword = False |
293 | 291 | # napoleon_use_rtype = True |
| 292 | +napoleon_preprocess_types = True |
294 | 293 | napoleon_type_aliases = { |
295 | 294 | # general terms |
296 | 295 | "sequence": ":term:`sequence`", |
|
339 | 338 | # objects with abbreviated namespace (from pandas) |
340 | 339 | "pd.Index": "~pandas.Index", |
341 | 340 | "pd.NaT": "~pandas.NaT", |
342 | | -} # TODO: From xarray, improve! |
| 341 | + "pd.DataFrame": "~pandas.NaT", |
| 342 | +} # TODO: From xarray, improve! New in 3.2 |
| 343 | + |
| 344 | +napoleon_attr_annotations = True # Allow PEP 526 attributes annotations in classes. New in 3.4 |
343 | 345 |
|
344 | 346 | # From xarray, huh? |
345 | 347 | # napoleon_preprocess_types = True #From xarray, not in docs |
|
369 | 371 | # Configuration of sphinx.ext.mathjax |
370 | 372 | # See https://www.sphinx-doc.org/en/master/usage/extensions/math.html#module-sphinx.ext.mathjax |
371 | 373 |
|
| 374 | +# Configuration of sphinx_autodoc_typehints |
| 375 | +# See https://pypi.org/project/sphinx-autodoc-typehints/ |
| 376 | +set_type_checking_flag = ( |
| 377 | + True # Set typing.TYPE_CHECKING to True to enable "expensive" typing imports |
| 378 | +) |
| 379 | +# typehints_fully_qualified = False # If True, class names are always fully qualified (e.g. module.for.Class). If False, just the class name displays (e.g. Class) |
| 380 | +always_document_param_types = ( |
| 381 | + True # add stub documentation for undocumented parameters to be able to add type info. |
| 382 | +) |
| 383 | +# typehints_document_rtype = True # If False, never add an :rtype: directive. If True, add the :rtype: directive if no existing :rtype: is found. |
| 384 | +# simplify_optional_unions = True # If True, optional parameters of type "Union[...]" are simplified as being of type Union[..., None] in the resulting documention (e.g. Optional[Union[A, B]] -> Union[A, B, None]). # If False, the "Optional"-type is kept. Note: If False, any Union containing None will be displayed as Optional! Note: If an optional parameter has only a single type (e.g Optional[A] or Union[A, None]), it will always be displayed as Optional! |
| 385 | + |
| 386 | + |
372 | 387 | def escape_underscores(string): |
373 | 388 | return string.replace("_", r"\_") |
374 | 389 |
|
|
0 commit comments