Skip to content

Fixed documentation build error #1161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Thumbs.db
# Things specific to this project #
###################################
doc/source/reference
doc/source/generated
venv/
.buildbot.patch
.vscode
Expand Down
19 changes: 8 additions & 11 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
from pathlib import Path
from runpy import run_path
from configparser import ConfigParser

import toml

# Check for external Sphinx extensions we depend on
try:
Expand All @@ -41,11 +42,6 @@
raise RuntimeError('Need nibabel on Python PATH; consider "make htmldoc" '
'from nibabel root directory')

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.append(os.path.abspath('../sphinxext'))

# -- General configuration ----------------------------------------------------

# We load the nibabel release info into a dict by explicit execution
Expand All @@ -56,9 +52,8 @@
fobj.write(rel['long_description'])

# Load metadata from setup.cfg
config = ConfigParser()
config.read(os.path.join('..', '..', 'setup.cfg'))
metadata = config['metadata']
pyproject_dict = toml.load(Path("../../pyproject.toml"))
metadata = pyproject_dict["project"]

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

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

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
10 changes: 3 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ build-backend = "setuptools.build_meta:__legacy__"
[project]
name = "nibabel"
description = "Access a multitude of neuroimaging data formats"
authors = [
{ name = "nibabel developers", email = "[email protected]" },
]
maintainers = [
{ name = "Christopher Markiewicz" },
]
authors = [{ name = "NiBabel developers", email = "[email protected]" }]
maintainers = [{ name = "Christopher Markiewicz" }]
readme = "README.rst"
license = { text="MIT License" }
license = { text = "MIT License" }
requires-python = ">=3.7"
dependencies = ["numpy >=1.17", "packaging >=17", "setuptools"]
classifiers = [
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ dev =
doc =
matplotlib >= 1.5.3
numpydoc
sphinx >=0.3,<3
sphinx ~= 5.3
texext
toml
minc2 =
h5py
spm =
Expand Down