From c37bcec25c8e6c320b8b119679bdec658d487f0a Mon Sep 17 00:00:00 2001 From: Zvi Baratz Date: Wed, 28 Dec 2022 16:13:46 +0200 Subject: [PATCH 1/4] Removed unused sys import and sphinx extension instructions. --- doc/source/conf.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 6155d0bc3b..ea5f94ea71 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -19,10 +19,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys import os -from runpy import run_path from configparser import ConfigParser +from runpy import run_path # Check for external Sphinx extensions we depend on try: @@ -41,11 +40,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 From f9f69bdd802a8f96836514e52e64be0bd8d9bfdc Mon Sep 17 00:00:00 2001 From: Zvi Baratz Date: Wed, 28 Dec 2022 16:21:55 +0200 Subject: [PATCH 2/4] Added generated docs directory. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 1ba201f711..744dc5becd 100644 --- a/.gitignore +++ b/.gitignore @@ -83,6 +83,7 @@ Thumbs.db # Things specific to this project # ################################### doc/source/reference +doc/source/generated venv/ .buildbot.patch .vscode From f954989c4165522bb13f870aa8e0482a1283011f Mon Sep 17 00:00:00 2001 From: Zvi Baratz Date: Wed, 28 Dec 2022 16:22:55 +0200 Subject: [PATCH 3/4] Fixed toml formatting. --- pyproject.toml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 01d06cdfbc..b5b6c0e52d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = "neuroimaging@python.org" }, -] -maintainers = [ - { name = "Christopher Markiewicz" }, -] +authors = [{ name = "NiBabel developers", email = "neuroimaging@python.org" }] +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 = [ From e6477cb42f17d08478eafb695958ddb865186b72 Mon Sep 17 00:00:00 2001 From: Zvi Baratz Date: Wed, 28 Dec 2022 16:29:25 +0200 Subject: [PATCH 4/4] 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. --- doc/source/conf.py | 13 ++++++++----- setup.cfg | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index ea5f94ea71..cb8ad8292e 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -20,9 +20,11 @@ # serve to show the default. import os -from configparser import ConfigParser +from pathlib import Path from runpy import run_path +import toml + # Check for external Sphinx extensions we depend on try: import numpydoc @@ -50,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. @@ -86,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 diff --git a/setup.cfg b/setup.cfg index ef1c140a29..336958c605 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,8 +10,9 @@ dev = doc = matplotlib >= 1.5.3 numpydoc - sphinx >=0.3,<3 + sphinx ~= 5.3 texext + toml minc2 = h5py spm =