|  | 
| 23 | 23 | from pathlib import Path | 
| 24 | 24 | from runpy import run_path | 
| 25 | 25 | 
 | 
| 26 |  | -import toml | 
|  | 26 | +try: | 
|  | 27 | +    import tomllib | 
|  | 28 | +except ImportError: | 
|  | 29 | +    import tomli as tomllib | 
| 27 | 30 | 
 | 
| 28 | 31 | # Check for external Sphinx extensions we depend on | 
| 29 | 32 | try: | 
|  | 
| 52 | 55 |     fobj.write(rel['long_description']) | 
| 53 | 56 | 
 | 
| 54 | 57 | # Load metadata from setup.cfg | 
| 55 |  | -pyproject_dict = toml.load(Path("../../pyproject.toml")) | 
| 56 |  | -metadata = pyproject_dict["project"] | 
|  | 58 | +with open(Path("../../pyproject.toml"), 'rb') as fobj: | 
|  | 59 | +    pyproject = tomllib.load(fobj) | 
|  | 60 | +authors = pyproject["project"]["authors"][0] | 
| 57 | 61 | 
 | 
| 58 | 62 | # Add any Sphinx extension module names here, as strings. They can be | 
| 59 | 63 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. | 
| 60 | 64 | extensions = ['sphinx.ext.autodoc', | 
| 61 | 65 |               'sphinx.ext.doctest', | 
| 62 |  | -              #'sphinx.ext.intersphinx', | 
|  | 66 | +              'sphinx.ext.intersphinx', | 
| 63 | 67 |               'sphinx.ext.todo', | 
| 64 | 68 |               'sphinx.ext.mathjax', | 
| 65 | 69 |               'sphinx.ext.inheritance_diagram', | 
|  | 
| 69 | 73 |               'matplotlib.sphinxext.plot_directive', | 
| 70 | 74 |               ] | 
| 71 | 75 | 
 | 
| 72 |  | -# the following doesn't work with sphinx < 1.0, but will make a separate | 
| 73 |  | -# sphinx-autogen run obsolete in the future | 
| 74 |  | -#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 | 
| 75 | 80 | 
 | 
| 76 | 81 | # Add any paths that contain templates here, relative to this directory. | 
| 77 | 82 | templates_path = ['_templates'] | 
|  | 
| 87 | 92 | 
 | 
| 88 | 93 | # General information about the project. | 
| 89 | 94 | project = u'NiBabel' | 
| 90 |  | -author_name = metadata["authors"][0]["name"] | 
| 91 |  | -author_email = metadata["authors"][0]["email"] | 
| 92 |  | -copyright = f"2006-2022, {author_name} <{author_email}>" | 
|  | 95 | +copyright = f"2006-2022, {authors['name']} <{authors['email']}>" | 
| 93 | 96 | 
 | 
| 94 | 97 | # The version info for the project you're documenting, acts as replacement for | 
| 95 | 98 | # |version| and |release|, also used in various other places throughout the | 
|  | 
| 269 | 272 | 
 | 
| 270 | 273 | 
 | 
| 271 | 274 | # Example configuration for intersphinx: refer to the Python standard library. | 
| 272 |  | -intersphinx_mapping = {'https://docs.python.org/': None} | 
|  | 275 | +intersphinx_mapping = {'https://docs.python.org/3/': None} | 
| 273 | 276 | 
 | 
| 274 | 277 | # Config of plot_directive | 
| 275 | 278 | plot_include_source = True | 
|  | 
0 commit comments