Skip to content

Commit

Permalink
update configuration read
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Sep 20, 2022
1 parent 60dea3c commit 4b14a80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import importlib
import stsci_rtd_theme
import sys
import tomli
from datetime import datetime
from pathlib import Path

import stsci_rtd_theme
import toml as toml


def setup(app):
try:
Expand All @@ -22,12 +21,13 @@ def setup(app):

# Read the package's `pyproject.toml` so that we can use relevant
# values here:
conf = toml.load(str(REPO_ROOT / 'pyproject.toml'))
setup_metadata = conf['project']
with open(REPO_ROOT / "pyproject.toml", "rb") as configuration_file:
conf = tomli.load(configuration_file)
setup_cfg = conf['project']

project = setup_metadata["name"]
author = setup_metadata["authors"][0]['name']
copyright = f"{datetime.now().year}, {author}"
author = f'{setup_cfg["authors"][0]["name"]} <{setup_cfg["authors"][0]["email"]}>'
copyright = f'{datetime.datetime.now().year}, {author}'

package = importlib.import_module(setup_metadata["name"])
version = package.__version__.split("-", 1)[0]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ docs = [
'sphinx-automodapi',
'sphinx-rtd-theme',
'stsci-rtd-theme',
'toml',
'tomli',
]
test = [
'pytest >=4.6.0',
Expand Down

0 comments on commit 4b14a80

Please sign in to comment.