1
0
mirror of https://github.com/enpaul/keyosk.git synced 2024-11-04 21:57:02 +00:00

Update about file with less sketchy loading system

Remove importlib usage from about file
Add tests to enforce data consistency between pyproject and about
Update sphinx config to use new about file
Remove pyproject from package
This commit is contained in:
Ethan Paul 2020-02-23 12:53:45 -05:00 committed by Ethan Paul
parent 1dd27b6169
commit f6185ba82d
4 changed files with 26 additions and 14 deletions

View File

@ -13,7 +13,7 @@ with open(Path(BASE_DIR, "..", "keyosk", "__about__.py")) as infile:
project = ABOUT["__title__"]
copyright = "2019, Ethan Paul"
author = ", ".join(ABOUT["__authors__"])
author = "Ethan Paul <e@enp.one>"
# The full version, including alpha/beta/rc tags
release = ABOUT["__version__"]

View File

@ -1,12 +1,3 @@
"""Access package info programatically without duplication"""
import importlib.resources
import toml
PYPROJECT = toml.loads(importlib.resources.read_text("keyosk", "pyproject.toml"))
__authors__ = PYPROJECT["tool"]["poetry"]["authors"]
__summary__ = PYPROJECT["tool"]["poetry"]["description"]
__title__ = PYPROJECT["tool"]["poetry"]["name"]
__url__ = PYPROJECT["tool"]["poetry"]["repository"]
__version__ = PYPROJECT["tool"]["poetry"]["version"]
# pylint: disable=missing-docstring
__version__ = "0.1.0-alpha-1"
__title__ = "keyosk"

View File

@ -1 +0,0 @@
../pyproject.toml

22
tests/test_about.py Normal file
View File

@ -0,0 +1,22 @@
from pathlib import Path
import toml
from keyosk import __about__
PYPROJECT_PATH = Path("pyproject.toml")
def test_version():
with PYPROJECT_PATH.open() as infile:
pyproject = toml.load(infile)
assert __about__.__version__ == pyproject["tool"]["poetry"]["version"]
def test_title():
with PYPROJECT_PATH.open() as infile:
pyproject = toml.load(infile)
assert __about__.__title__ == pyproject["tool"]["poetry"]["name"]