setuptools & metadata

This commit is contained in:
checktheroads 2019-12-31 00:07:54 -07:00
parent 8d19cf159f
commit 706b1f5ed5
2 changed files with 46 additions and 12 deletions

View file

@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
"""
# Standard Library Imports
from datetime import datetime
import sys
# Third Party Imports
@ -55,3 +56,11 @@ from hyperglass import util
stackprinter.set_excepthook()
uvloop.install()
__name__ = "hyperglass"
__version__ = "1.0.0"
__author__ = "Matt Love"
__copyright__ = f"Copyright {datetime.now().year} Matthew Love"
__license__ = "BSD 3-Clause Clear License"
meta = (__name__, __version__, __author__, __copyright__, __license__)

View file

@ -1,30 +1,55 @@
"""hyperglass setuptools."""
# Standard Library Imports
import sys
from configparser import ConfigParser
from distutils.core import setup
from pathlib import Path
if sys.version_info < (3, 7):
sys.exit("Python 3.7+ is required.")
# Project Imports
from hyperglass import meta
# Project metadata
__name__, __version__, __author__, __copyright__, __license__ = meta
with open("README.md", "r") as ld:
# Path & file objects
root_dir = Path.cwd()
pipfile = root_dir / "Pipfile"
readme = root_dir / "README.md"
# Read Pipfile
config = ConfigParser()
config.read_file(pipfile.open("r"))
# Pipenv requirements
requirements = list(config["packages"].keys())
dev_requirements = list(config["dev-packages"].keys())
# Pipenv Python versions
_parsed_py_ver = tuple(config["requires"].values())[0]
python_version = tuple(int(i) for i in _parsed_py_ver.strip('"').split("."))
pretty_python_version = ".".join(python_version)
if sys.version_info < python_version:
sys.exit(f"Python {pretty_python_version}+ is required.")
with readme.open("r") as ld:
long_description = ld.read()
with open("requirements.txt", "r") as req:
requirements = req.read().split("\n")
desc = "hyperglass is a modern, customizable network looking glass written in Python 3."
setup(
name="hyperglass",
version="1.0.0",
author="Matt Love",
name=__name__,
version=__version__,
author=__author__,
author_email="matt@hyperglass.io",
description=desc,
url="https://github.com/checktheroads/hyperglass",
python_requires=">=3.7",
packages=["hyperglass"],
python_requires=f">={pretty_python_version}",
packages=[__name__],
install_requires=requirements,
license="BSD 3-Clause Clear License",
extras_require={"dev": dev_requirements},
license=__license__,
long_description=long_description,
long_description_content_type="text/markdown",
)