From fcc1f2489b1b45c64eca9304f6cf553def0c5ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Mon, 8 May 2023 11:37:45 +0800 Subject: [PATCH] :sparkles: Add setup --- setup.py | 50 +++++++++++++++++++++++++++++++++++++++++++++ tests/test_setup.py | 5 +++++ 2 files changed, 55 insertions(+) create mode 100644 setup.py create mode 100644 tests/test_setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..41bebc2 --- /dev/null +++ b/setup.py @@ -0,0 +1,50 @@ +"""Run setuptools.""" +from pathlib import Path + +from setuptools import find_packages, setup + +from simnet.version import __version__ + + +def get_requirements(): + """Build the requirements list for this project""" + requirements_list = [] + + with Path("requirements.txt").open() as reqs: + for install in reqs: + if install.startswith("#"): + continue + requirements_list.append(install.strip()) + + return requirements_list + + +def get_setup_kwargs(): + """Builds a dictionary of kwargs for the setup function""" + requirements = get_requirements() + + kwargs = dict( + script_name="setup.py", + name="SIMNet", + version=__version__, + author="PaiGramTeam", + url="https://github.com/PaiGramTeam/SIMNet", + keywords="genshin and honkai api wrapper", + description="Modern API wrapper for Genshin Impact & Honkai: Star Rail built on asyncio and pydantic.", + long_description=open("README.md", "r", encoding="utf-8").read(), + long_description_content_type="text/markdown", + packages=find_packages(exclude=["tests*"]), + install_requires=requirements, + include_package_data=True, + python_requires=">=3.8", + ) + + return kwargs + + +def main(): # skipcq: PY-D0003 + setup(**get_setup_kwargs()) + + +if __name__ == "__main__": + main() diff --git a/tests/test_setup.py b/tests/test_setup.py new file mode 100644 index 0000000..557ac5a --- /dev/null +++ b/tests/test_setup.py @@ -0,0 +1,5 @@ +import os + + +def test_build(): + assert os.system("python setup.py") == 0 # pragma: no cover