Last active
November 3, 2022 07:19
-
-
Save frontdevops/7f43e6077ee9b0e7f0a540e7029ec032 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import pathlib | |
import tomllib | |
from setuptools import find_packages, setup | |
WORK_DIR = pathlib.Path(__file__).parent | |
# Check python version | |
MINIMAL_PY_VERSION = (3, 10, 8) | |
if sys.version_info < MINIMAL_PY_VERSION: | |
raise RuntimeError("aiogram works only with Python {}+".format(".".join(map(str, MINIMAL_PY_VERSION)))) | |
def get_description() -> str: | |
with open("README.md", "r", encoding="utf-8") as f: | |
return f.read() | |
def get_meta_info() -> dict: | |
try: | |
with open("pyproject.toml", "rb") as f: | |
return tomllib.load(f) | |
except IndexError: | |
raise RuntimeError('Unable to determine version.') | |
project_meta = get_meta_info() | |
project_dir = project_meta["project"]["name"].replace("-", "_") | |
setup( | |
license="MIT", | |
name=project_meta["project"]["name"], | |
version=project_meta["project"]["version"], | |
author=project_meta["project"]["authors"][0]["name"], | |
author_email=project_meta["project"]["authors"][0]["email"], | |
description=project_meta["project"]["description"], | |
long_description=get_description(), | |
long_description_content_type="text/markdown", | |
url="https://github.com/frontdevops/magic-config", | |
download_url=("https://github.com/frontdevops/magic-config/archive/refs/tags/" | |
f"{project_meta['project']['version']}.tar.gz"), | |
project_urls={ | |
"Documentation": "https://github.com/frontdevops/magic-config/blob/main/README.md", | |
"Source": "https://github.com/frontdevops/magic-config", | |
"Bug Tracker": "https://github.com/frontdevops/magic-config/issues", | |
}, | |
keywords=["pypi", "config", "storage", "registry"], | |
classifiers=[ | |
"Development Status :: 5 - Production/Stable", | |
"License :: OSI Approved :: MIT License", | |
"Programming Language :: Python :: 3", | |
"Programming Language :: Python :: 3.10.8", | |
"Programming Language :: Python :: 3.11", | |
"Topic :: Software Development :: Libraries :: Application Utilities", | |
], | |
package_dir={"": project_dir}, | |
packages=find_packages( | |
where=project_dir, | |
exclude=("tests", "tests.*", "examples.*", "docs",), | |
), | |
include_package_data=False, | |
python_requires=">=3.10.8", | |
install_requires=[ | |
"python-dotenv>=0.21.0", | |
], | |
extras_require={ | |
"dev": [ | |
"pytest >= 3.7", | |
"check-manifest", | |
"twine" | |
] | |
}, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment