From b96a45895265df996ca2c2de7e8dab3bbcca568e Mon Sep 17 00:00:00 2001 From: Bigsk Date: Mon, 14 Oct 2024 16:15:30 +0800 Subject: [PATCH] basic config --- .gitignore | 5 +++-- README.md | 3 +-- richka/__init__.py | 1 + richka/__main__.py | 0 richka/__version__.py | 8 ++++++++ richka/config.py | 13 +++++++++++++ richka/core.py | 0 setup.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 richka/__init__.py create mode 100644 richka/__main__.py create mode 100644 richka/__version__.py create mode 100644 richka/config.py create mode 100644 richka/core.py create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 4dfac57..6d249e6 100644 --- a/.gitignore +++ b/.gitignore @@ -158,7 +158,7 @@ cython_debug/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ +.idea/ # ---> VisualStudio ## Ignore Visual Studio temporary files, build results, and @@ -596,7 +596,8 @@ FodyWeavers.xsd .LSOverride # Icon must end with two \r -Icon +Icon + # Thumbnails ._* diff --git a/README.md b/README.md index 2e6d143..432c2f6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,2 @@ -# Richka +# Richka - Python Async Download Engine -Python Async Download Engine \ No newline at end of file diff --git a/richka/__init__.py b/richka/__init__.py new file mode 100644 index 0000000..d085c3a --- /dev/null +++ b/richka/__init__.py @@ -0,0 +1 @@ +from .config import * \ No newline at end of file diff --git a/richka/__main__.py b/richka/__main__.py new file mode 100644 index 0000000..e69de29 diff --git a/richka/__version__.py b/richka/__version__.py new file mode 100644 index 0000000..8a6a77f --- /dev/null +++ b/richka/__version__.py @@ -0,0 +1,8 @@ +__title__ = "richka" +__description__ = "Python Async Download Engine." +__url__ = "https://github.com/ghinknet/richka" +__version__ = '0.0.1' +__author__ = "Ian Xia" +__author_email__ = "xia@ghink.net" +__license__ = "MIT" +__copyright__ = "Copyright Ian Xia" \ No newline at end of file diff --git a/richka/config.py b/richka/config.py new file mode 100644 index 0000000..cb5a0d9 --- /dev/null +++ b/richka/config.py @@ -0,0 +1,13 @@ +import richka + +__VERSION = ("Alpha", 0, 0, 1) +USER_AGENT = f"Richka{__VERSION[0]}/{__VERSION[1]}.{__VERSION[2]}.{__VERSION[3]}" +HEADERS = {"user-agent": USER_AGENT} + +def set_user_agent(user_agent: str) -> None: + richka.USER_AGENT = user_agent + richka.HEADERS["user-agent"] = user_agent + +def set_headers(headers: dict) -> None: + for key, value in headers.items(): + richka.HEADERS[key.lower()] = value \ No newline at end of file diff --git a/richka/core.py b/richka/core.py new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..181ca3b --- /dev/null +++ b/setup.py @@ -0,0 +1,42 @@ +import os +import sys + +from setuptools import setup, find_packages + +about = {} +here = os.path.abspath(os.path.dirname(__file__)) +with open(os.path.join(here, "richka", "__version__.py"), "r") as f: + exec(f.read(), about) + +with open("README.md", "r") as f: + readme = f.read() + +if sys.argv[-1] == "publish": + os.system("python setup.py sdist bdist_wheel") + os.system("twine upload dist/*") + sys.exit() + +setup( + name=about["__title__"], + version=about["__version__"], + description=about["__description__"], + packages=find_packages(), + url=about["__url__"], + license=about["__license__"], + author=about["__author__"], + author_email=about["__author_email__"], + long_description_content_type="text/markdown", + long_description=readme, + install_requires=[ + ], + classifiers=[ + 'License :: OSI Approved :: MIT License', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3 :: Only', + ], + entry_points={ + 'console_scripts': ['richka=richka.__main__:main'], + }, + package_data={'': ['README.md']}, + include_package_data=True, + zip_safe=False) \ No newline at end of file