Skip to content

Commit

Permalink
Merge pull request #3 from espdev/fix-build-docs-on-rtd
Browse files Browse the repository at this point in the history
Fix build docs on rtd
  • Loading branch information
espdev committed May 27, 2020
2 parents ebfe7ef + 41d7378 commit 808499d
Show file tree
Hide file tree
Showing 6 changed files with 350 additions and 419 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v0.2.1 (27.05.2020)

- Fix building docs on ReadTheDocs

## v0.2.0 (27.05.2020)

- Refactoring the package with changing some low-level API
Expand Down
37 changes: 15 additions & 22 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,27 @@
# 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.

import sys
import pathlib
import toml
import re

ROOT_PATH = pathlib.Path(__file__).parent.parent

sys.path.insert(0, str(ROOT_PATH))


with (ROOT_PATH / 'pyproject.toml').open() as fp:
pyproject_toml = toml.load(fp)


def get_author():
authors = pyproject_toml['tool']['poetry']['authors']
return re.sub(r'<.+>', '', authors[0]).strip()
from importlib_metadata import metadata, PackageNotFoundError


# -- Project information -----------------------------------------------------

project = pyproject_toml['tool']['poetry']['name']
author = get_author()
PACKAGE_NAME = 'scikit-mpe'

try:
project_metadata = metadata(PACKAGE_NAME)
except PackageNotFoundError:
raise RuntimeError(
f"The package '{PACKAGE_NAME}' must be installed. "
"Please install the package in editable mode before building docs."
)

project = project_metadata['name']
author = project_metadata['author']
copyright = f'2020, {author}'

# The full version, including alpha/beta/rc tags
version = pyproject_toml['tool']['poetry']['version']
release = pyproject_toml['tool']['poetry']['version']
version = project_metadata['version']
release = version


# -- General configuration ---------------------------------------------------
Expand Down
Loading

0 comments on commit 808499d

Please sign in to comment.