Skip to content

Commit

Permalink
docs: update sphinx config
Browse files Browse the repository at this point in the history
... to dynamically extract version and other metadata from importlib

It also fixes an apparent issue with the intersphinx configuration
format that must have changed some time down the line
  • Loading branch information
Patrick Totzke authored and lucc committed Aug 1, 2024
1 parent e4a9610 commit e53701e
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# alot documentation build configuration file
import sys
import os
from importlib.metadata import version as get_version
from importlib.metadata import metadata

# 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
Expand Down Expand Up @@ -48,16 +50,18 @@

# General information about the project.
project = 'alot'
copyright = alot.__copyright__

# still used?
# copyright = alot.__copyright__

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = alot.__version__
# The full version, including alpha/beta/rc tags.
release = alot.__version__
release: str = get_version("alot")
# The short X.Y version.
# for example take major/minor
version: str = ".".join(release.split('.')[:2])

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -186,8 +190,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual])
latex_documents = [
('index', 'alot.tex', 'alot Documentation',
'Patrick Totzke', 'manual'),
('index', 'alot.tex', 'alot Documentation',
'Patrick Totzke', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -219,15 +223,15 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
alot_meta = metadata('alot')
man_pages = [
('manpage', 'alot', alot.__description__,
[alot.__author__], 1),
('manpage', 'alot', alot_meta['Summary'], [alot_meta['Author']], 1),
]


# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'http://docs.python.org/': None,
'http://notmuch.readthedocs.org/en/latest/': None,
'http://urwid.readthedocs.org/en/latest/': None
'python': ('http://docs.python.org/', None),
'notmuch': ('http://notmuch.readthedocs.org/en/latest/', None),
'urwid': ('http://urwid.readthedocs.org/en/latest/', None)
}

0 comments on commit e53701e

Please sign in to comment.