From afcb1afc26f486d8bf42260b92386233a620f575 Mon Sep 17 00:00:00 2001 From: aicorein Date: Thu, 18 Apr 2024 15:09:55 +0800 Subject: [PATCH] [All] Minor updates to improve proj public infos. --- .github/workflows/mkdoc.yml | 11 +++++++---- .gitignore | 7 ++++--- README.md | 9 +++------ docs/source/conf.py | 3 ++- pyproject.toml | 34 +++++++++++++++++++++++++++++----- src/melobot/__init__.py | 6 ++++-- src/melobot/bot/init.py | 2 +- src/melobot/meta.py | 15 ++++++++++++--- 8 files changed, 62 insertions(+), 25 deletions(-) diff --git a/.github/workflows/mkdoc.yml b/.github/workflows/mkdoc.yml index 8a6a846..e548697 100644 --- a/.github/workflows/mkdoc.yml +++ b/.github/workflows/mkdoc.yml @@ -14,17 +14,20 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 - - name: Build the doc + - name: Setup Python uses: actions/setup-python@v5 with: python-version: '3.10' - - run: | + + - name: Build the doc + run: | cd docs/ && pip install -r requirements.txt make html && cd .. - - name: Commit doc changes + - name: Refresh changes and commit run: | git clone https://github.com/Meloland/melobot.git --branch gh-pages --single-branch gh-pages mkdir tmp-files && cd gh-pages diff --git a/.gitignore b/.gitignore index ef0fe06..c2f0515 100644 --- a/.gitignore +++ b/.gitignore @@ -3,12 +3,13 @@ __pycache__ *.bak tests/private dev - +*/build +dist .venv .vscode .mypy_cache -*/build -dist + +.pypirc .pdm-python .pdm-build .pdm.toml diff --git a/README.md b/README.md index 258a10f..5e805af 100644 --- a/README.md +++ b/README.md @@ -30,12 +30,9 @@ main 分支可接受**不与未来 v3 预期目标冲突**的 bug 修复与功 ## ⚠️ 声明 -1. melobot 是由热爱技术的开发者共同维护的开源项目。我们致力于提供一个可靠、高效的软件工具,以促进技术交流和创新。以下简称 melobot 项目为“本项目”。 -2. 本项目提供的所有代码和文档均以“原样”提供,不提供任何形式的保证,包括但不限于适销性、特定用途的适用性或不侵权的保证。用户在使用本项目时,应自行承担所有风险。 -3. 本项目严禁用于任何非法目的,包括但不限于侵犯版权、商标、商业机密或其他知识产权,以及违反任何适用的法律和法规。我们不对因非法使用本项目而产生的任何直接、间接、附带、特殊、惩罚性或后果性损害承担责任。 -4. 在任何情况下,本项目的开发团队、维护者或贡献者均不对因使用或无法使用该项目而产生的任何损失或损害承担责任,包括但不限于数据丢失、业务中断、计算机故障或其他商业损害。 -5. 所有向本项目贡献的代码、文档或其他资源,贡献者同意将其置于与项目相同的许可协议下。贡献者声明其贡献是原创的,或者他们有权使用和修改这些贡献,并且不会侵犯任何第三方的权益。 -6. 本项目的开发团队保留随时修改本免责声明的权利,无需事先通知。用户应定期查看本免责声明,以了解任何更改。 +melobot 是由热爱技术的开发者共同维护的开源项目。我们致力于提供一个可靠、高效的软件工具,以促进技术交流和创新。以下简称 melobot 项目为“本项目”。 + +本项目严禁用于任何非法目的,包括但不限于侵犯版权、商标、商业机密或其他知识产权,以及违反任何适用的法律和法规。我们不对因非法使用本项目而产生的任何直接、间接、附带、特殊、惩罚性或后果性损害承担责任。 diff --git a/docs/source/conf.py b/docs/source/conf.py index 63faf0c..85abc9a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -5,6 +5,7 @@ sys.path.insert(0, os.path.abspath("../../src/")) import melobot +import melobot.meta _need_ret_fix_funcs = melobot.context.action.__all__ @@ -19,7 +20,7 @@ project = "MeloBot" author = "contributors of this doc" copyright = f"{datetime.date.today().year}, {author}" -release = "2.5.13" +release = melobot.meta.MetaInfo.VER # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration diff --git a/pyproject.toml b/pyproject.toml index b8571e3..59d07b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,16 @@ [project] name = "melobot" -version = "2.5.13" -description = "A qq bot development framework with friendly APIs, session control and plugin-supported." +dynamic = ["version"] +description = "A bot development framework with friendly APIs, session control and plugin-supported." authors = [ {name = "aicorein", email = "melodyecho@glowmem.com"}, ] +maintainers = [ + {name = "aicorein", email = "melodyecho@glowmem.com"} +] dependencies = [ - "uvloop>=0.17.0; platform_system!=\"Windows\"", - "winloop>=0.1.2; platform_system==\"Windows\"", + "uvloop>=0.17.0; os_name != 'nt'", + "winloop>=0.1.2; os_name == 'nt'", "websockets>=10.4", "better-exceptions==0.3.3", "rich>=13.7.1", @@ -17,10 +20,29 @@ dependencies = [ ] requires-python = ">=3.10" readme = "README.md" -license = {text = "AGPL3"} +license = { text = "BSD"} +keywords = ["qq", "qq bot", "onebot", "bot framework", "asyncio", "coroutine", "concurrency"] +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: Implementation :: CPython", + "Topic :: Software Development :: Libraries :: Python Modules" +] + [project.urls] Homepage = "https://github.com/Meloland/melobot" +Documentation = "https://docs.melobot.org" +Repository = "https://github.com/Meloland/melobot.git" +Issues = "https://github.com/Meloland/melobot/issues" [build-system] requires = ["pdm-backend"] @@ -41,6 +63,8 @@ line_length = 88 [tool.pdm] distribution = true +version = { source = "file", path = "src/melobot/meta.py" } + [tool.pdm.scripts] isort = {shell = "isort src/melobot"} format = {shell = "black src/melobot"} diff --git a/src/melobot/__init__.py b/src/melobot/__init__.py index 5d350b2..4b7434e 100644 --- a/src/melobot/__init__.py +++ b/src/melobot/__init__.py @@ -1,6 +1,8 @@ -"""MeloBot 是插件化管理、基于异步会话机制的 qq 机器人开发框架。 +"""MeloBot 是插件化管理、基于异步会话机制的机器人开发框架。 -项目源码和文档,请参考:https://github.com/aicorein/melobot +v2 版本目前仅适用于构建与 OneBot 实现对接的机器人服务。 + +项目源码和文档,请参考:https://github.com/Meloland/melobot """ from .base import LogicMode, PriorLevel, SessionRule, User, lock, this_dir, timelimit diff --git a/src/melobot/bot/init.py b/src/melobot/bot/init.py index 3fd6545..0362c24 100644 --- a/src/melobot/bot/init.py +++ b/src/melobot/bot/init.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: from ..plugin.ipc import ShareObject -if MetaInfo.PLATFORM not in ("win32", "cygwin", "cli"): +if MetaInfo.OS_NAME != 'nt': import uvloop asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) diff --git a/src/melobot/meta.py b/src/melobot/meta.py index e8b2457..86d0a5f 100644 --- a/src/melobot/meta.py +++ b/src/melobot/meta.py @@ -32,6 +32,9 @@ def __call__(self, *args: Any, **kwargs: Any) -> Any: return super().__call__(*args, **kwargs) +__version__ = "2.5.14" + + class MetaInfo(metaclass=ReadOnly): """元信息类 @@ -41,7 +44,7 @@ class MetaInfo(metaclass=ReadOnly): 一般无需手动实例化该类,多数情况会直接使用本类的属性,或将本类用作类型注解。 """ - VER: str = "2.5.13" + VER: str = __version__ """melobot 版本 :meta hide-value: @@ -54,14 +57,14 @@ class MetaInfo(metaclass=ReadOnly): """ PROJ_DESC: str = ( - "A qq bot development framework with friendly APIs, session control and plugin-supported." + "A bot development framework with friendly APIs, session control and plugin-supported." ) """melobot 项目描述 :meta hide-value: """ - PROJ_SRC: str = "https://github.com/aicorein/melobot" + PROJ_SRC: str = "https://github.com/Meloland/melobot" """melobot 项目地址 :meta hide-value: @@ -73,6 +76,12 @@ class MetaInfo(metaclass=ReadOnly): :meta hide-value: """ + OS_NAME: str = os.name + """当前系统名称 + + :meta hide-value: + """ + PLATFORM: str = sys.platform """当前系统平台