Skip to content

Commit e6477cb

Browse files
committed
Fixed conf.py metadata read error
Added toml to docs requirements and replaced the ConfigParser metadata read. Sphinx also needed to be upgraded for a successful build. This resolves #1160.
1 parent f954989 commit e6477cb

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

doc/source/conf.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020
# serve to show the default.
2121

2222
import os
23-
from configparser import ConfigParser
23+
from pathlib import Path
2424
from runpy import run_path
2525

26+
import toml
27+
2628
# Check for external Sphinx extensions we depend on
2729
try:
2830
import numpydoc
@@ -50,9 +52,8 @@
5052
fobj.write(rel['long_description'])
5153

5254
# Load metadata from setup.cfg
53-
config = ConfigParser()
54-
config.read(os.path.join('..', '..', 'setup.cfg'))
55-
metadata = config['metadata']
55+
pyproject_dict = toml.load(Path("../../pyproject.toml"))
56+
metadata = pyproject_dict["project"]
5657

5758
# Add any Sphinx extension module names here, as strings. They can be
5859
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
@@ -86,7 +87,9 @@
8687

8788
# General information about the project.
8889
project = u'NiBabel'
89-
copyright = f"2006-2022, {metadata['maintainer']} <{metadata['author_email']}>"
90+
author_name = metadata["authors"][0]["name"]
91+
author_email = metadata["authors"][0]["email"]
92+
copyright = f"2006-2022, {author_name} <{author_email}>"
9093

9194
# The version info for the project you're documenting, acts as replacement for
9295
# |version| and |release|, also used in various other places throughout the

setup.cfg

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ dev =
1010
doc =
1111
matplotlib >= 1.5.3
1212
numpydoc
13-
sphinx >=0.3,<3
13+
sphinx ~= 5.3
1414
texext
15+
toml
1516
minc2 =
1617
h5py
1718
spm =

0 commit comments

Comments
 (0)