|
19 | 19 | # All configuration values have a default; values that are commented out
|
20 | 20 | # serve to show the default.
|
21 | 21 |
|
22 |
| -import sys |
23 | 22 | import os
|
| 23 | +from pathlib import Path |
24 | 24 | from runpy import run_path
|
25 |
| -from configparser import ConfigParser |
| 25 | + |
| 26 | +try: |
| 27 | + import tomllib |
| 28 | +except ImportError: |
| 29 | + import tomli as tomllib |
26 | 30 |
|
27 | 31 | # Check for external Sphinx extensions we depend on
|
28 | 32 | try:
|
|
41 | 45 | raise RuntimeError('Need nibabel on Python PATH; consider "make htmldoc" '
|
42 | 46 | 'from nibabel root directory')
|
43 | 47 |
|
44 |
| -# If extensions (or modules to document with autodoc) are in another directory, |
45 |
| -# add these directories to sys.path here. If the directory is relative to the |
46 |
| -# documentation root, use os.path.abspath to make it absolute, like shown here. |
47 |
| -# sys.path.append(os.path.abspath('../sphinxext')) |
48 |
| - |
49 | 48 | # -- General configuration ----------------------------------------------------
|
50 | 49 |
|
51 | 50 | # We load the nibabel release info into a dict by explicit execution
|
|
56 | 55 | fobj.write(rel['long_description'])
|
57 | 56 |
|
58 | 57 | # Load metadata from setup.cfg
|
59 |
| -config = ConfigParser() |
60 |
| -config.read(os.path.join('..', '..', 'setup.cfg')) |
61 |
| -metadata = config['metadata'] |
| 58 | +with open(Path("../../pyproject.toml"), 'rb') as fobj: |
| 59 | + pyproject = tomllib.load(fobj) |
| 60 | +authors = pyproject["project"]["authors"][0] |
62 | 61 |
|
63 | 62 | # Add any Sphinx extension module names here, as strings. They can be
|
64 | 63 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
65 | 64 | extensions = ['sphinx.ext.autodoc',
|
66 | 65 | 'sphinx.ext.doctest',
|
67 |
| - #'sphinx.ext.intersphinx', |
| 66 | + 'sphinx.ext.intersphinx', |
68 | 67 | 'sphinx.ext.todo',
|
69 | 68 | 'sphinx.ext.mathjax',
|
70 | 69 | 'sphinx.ext.inheritance_diagram',
|
|
74 | 73 | 'matplotlib.sphinxext.plot_directive',
|
75 | 74 | ]
|
76 | 75 |
|
77 |
| -# the following doesn't work with sphinx < 1.0, but will make a separate |
78 |
| -# sphinx-autogen run obsolete in the future |
79 |
| -#autosummary_generate = True |
| 76 | +# Autosummary always wants to use a `generated/` directory. |
| 77 | +# We generate with `make api-stamp` |
| 78 | +# This could change in the future |
| 79 | +autosummary_generate = False |
80 | 80 |
|
81 | 81 | # Add any paths that contain templates here, relative to this directory.
|
82 | 82 | templates_path = ['_templates']
|
|
92 | 92 |
|
93 | 93 | # General information about the project.
|
94 | 94 | project = u'NiBabel'
|
95 |
| -copyright = f"2006-2022, {metadata['maintainer']} <{metadata['author_email']}>" |
| 95 | +copyright = f"2006-2022, {authors['name']} <{authors['email']}>" |
96 | 96 |
|
97 | 97 | # The version info for the project you're documenting, acts as replacement for
|
98 | 98 | # |version| and |release|, also used in various other places throughout the
|
|
272 | 272 |
|
273 | 273 |
|
274 | 274 | # Example configuration for intersphinx: refer to the Python standard library.
|
275 |
| -intersphinx_mapping = {'https://docs.python.org/': None} |
| 275 | +intersphinx_mapping = {'https://docs.python.org/3/': None} |
276 | 276 |
|
277 | 277 | # Config of plot_directive
|
278 | 278 | plot_include_source = True
|
|
0 commit comments