From 0e125f7c816b17e562da157948f830c0de8bcd88 Mon Sep 17 00:00:00 2001 From: snowy Date: Sun, 18 Aug 2024 01:25:11 +0800 Subject: [PATCH] =?UTF-8?q?:children=5Fcrossing:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pypi-publish.yml | 26 ++++++ .gitignore | 4 + liteyuki/bot/__init__.py | 3 +- liteyuki/dev/observer.py | 1 - liteyuki/plugin/load.py | 7 +- liteyuki/plugins/plugins_loader/__init__.py | 4 +- pyproject.toml | 82 +++++++------------ .../liteyuki_crt_utils/__init__.py | 3 +- 8 files changed, 66 insertions(+), 64 deletions(-) create mode 100644 .github/workflows/pypi-publish.yml diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml new file mode 100644 index 00000000..d759b66f --- /dev/null +++ b/.github/workflows/pypi-publish.yml @@ -0,0 +1,26 @@ +name: Publish + +on: + push: + branches: + - main + tags: + - '*' + workflow_dispatch: + +jobs: + pypi-publish: + name: upload release to PyPI + runs-on: ubuntu-latest + permissions: + # 这个权限是为了私有仓库。 + contents: read + # 重要提示:这个权限对于可信发布是必需的。 + id-token: write + steps: + - uses: actions/checkout@v3 + + - uses: pdm-project/setup-pdm@v3 + + - name: Publish package distributions to PyPI + run: pdm publish \ No newline at end of file diff --git a/.gitignore b/.gitignore index 67716fee..1124b9e7 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,7 @@ prompt.txt # js **/echarts.js .env + + +# pdm +.pdm-python \ No newline at end of file diff --git a/liteyuki/bot/__init__.py b/liteyuki/bot/__init__.py index b5804ce5..cfffc3ca 100644 --- a/liteyuki/bot/__init__.py +++ b/liteyuki/bot/__init__.py @@ -10,11 +10,10 @@ from typing import Any, Optional from liteyuki.bot.lifespan import (LIFESPAN_FUNC, Lifespan) from liteyuki.comm.channel import get_channel -from liteyuki.comm.storage import shared_memory -from liteyuki.utils import IS_MAIN_PROCESS from liteyuki.core.manager import ProcessManager from liteyuki.log import init_log, logger from liteyuki.plugin import load_plugins +from liteyuki.utils import IS_MAIN_PROCESS __all__ = [ "LiteyukiBot", diff --git a/liteyuki/dev/observer.py b/liteyuki/dev/observer.py index fb31f6d0..6871481a 100644 --- a/liteyuki/dev/observer.py +++ b/liteyuki/dev/observer.py @@ -2,7 +2,6 @@ 此模块用于注册观察者函数,使用watchdog监控文件变化并重启bot 启用该模块需要在配置文件中设置`dev_mode`为True """ -import functools import time from typing import Callable, TypeAlias diff --git a/liteyuki/plugin/load.py b/liteyuki/plugin/load.py index a997f1e2..5b02bf7f 100644 --- a/liteyuki/plugin/load.py +++ b/liteyuki/plugin/load.py @@ -13,8 +13,7 @@ import traceback from pathlib import Path from typing import Optional -from nonebot import logger - +from liteyuki.log import logger from liteyuki.plugin.model import Plugin, PluginMetadata from importlib import import_module @@ -23,8 +22,8 @@ from liteyuki.utils import path_to_module_name _plugins: dict[str, Plugin] = {} __all__ = [ - "load_plugin", - "load_plugins", + "load_plugin", + "load_plugins", ] diff --git a/liteyuki/plugins/plugins_loader/__init__.py b/liteyuki/plugins/plugins_loader/__init__.py index facefd15..b4210e0c 100644 --- a/liteyuki/plugins/plugins_loader/__init__.py +++ b/liteyuki/plugins/plugins_loader/__init__.py @@ -8,13 +8,11 @@ Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved @File : __init__.py.py @Software: PyCharm """ -from liteyuki import get_config, load_plugin, get_bot +from liteyuki import get_config, load_plugin from liteyuki.plugin import PluginMetadata, load_plugins __plugin_meta__ = PluginMetadata( name="外部轻雪插件加载器", - version="0.1.0", - author="snowykami", description="插件加载器,用于加载轻雪原生插件" ) diff --git a/pyproject.toml b/pyproject.toml index 6e76ab61..c4ad74b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,58 +1,36 @@ # PEP 621 project metadata # See https://www.python.org/dev/peps/pep-0621/ -# This file is for project use, but don`t use with nb-cli -# 此文件为项目所用,请不要和nb-cli一起使用以防被修改 -[tool.poetry] -name = "liteyuki-bot" -version = "6" -description = "based on nonebot2" -authors = ["Snowykami"] -license = "MIT & LSO" -package-mode = false +# This file is liteyuki framework use only, don`t use it with applications or nb-cli. +# 此文件仅供 liteyuki 框架使用,请勿用于应用程序及nb-cli,请使用pip进行安装。 +[project] +name = "liteyukibot" +version = "6.3.2" +description = "A lightweight bot process management framework and application." +readme = "README.md" +requires-python = ">=3.10" +authors = [ + { name = "snowykami", email = "snowykami@outlook.com" }, + { name = "LiteyukiStudio", email = "studio@liteyuki.icu" }, +] +license = { text = "MIT&LSO" } - -#[tool.poetry.dependencies] -#python = "^3.10" -#aiofiles = "~23.2.1" -#aiohttp = "~3.9.3" -#aiosqlite3 = "~0.3.0" -#colored = "~2.2.4" -#fastapi = "~0.110.0" -#GitPython = "~3.1.42" -#httpx = "~0.27.0" -#importlib_metadata = "~7.0.2" -#jieba = "~0.42.1" -#loguru = "~0.7.2" -#nb-cli = "~1.4.1" -#nonebot-adapter-onebot = "~2.4.3" -#nonebot-adapter-satori = "~0.11.5" -#nonebot-plugin-alconna = "~0.46.3" -#nonebot-plugin-apscheduler = "~0.4.0" -#nonebot-plugin-htmlrender = "~0.3.1" -#nonebot2 = { version = "~2.3.0", extras = ["fastapi", "httpx", "websockets"] } -#numpy = "~2.0.0" -#packaging = "~23.1" -#psutil = "~5.9.8" -#py-cpuinfo = "~9.0.0" -#pydantic = "~2.7.0" -#Pygments = "~2.17.2" -#python-dotenv = "~1.0.1" -#pytest = "~8.3.1" -#pytz = "~2024.1" -#PyYAML = "~6.0.1" -#requests = "~2.31.0" -#starlette = "~0.36.3" -#watchdog = "~4.0.0" - - -[[tool.poetry.source]] -name = "tuna" -url = "https://pypi.tuna.tsinghua.edu.cn/simple" - -[tool.nonebot] +dependencies = [ + "loguru~=0.7.2", + "pydantic==2.8.2", + "PyYAML==6.0.2", + "toml==0.10.2", + "watchdog==4.0.1", +] [project.urls] -homepage = "https://bot.liteyuki.icu" -repository = "https://github.com/LiteyukiStudio/LiteyukiBot" -documentation = "https://bot.liteyuki.icu" +Homepage = "https://bot.liteyuki.icu" +Repository = "https://github.com/LiteyukiStudio/LiteyukiBot" +"Issue Tracker" = "https://github.com/LiteyukiStudio/LiteyukiBot/issues/new?assignees=&labels=&projects=&template=%E9%97%AE%E9%A2%98%E5%8F%8D%E9%A6%88.md&title=" + +[build-system] +requires = ["pdm-backend"] +build-backend = "pdm.backend" + +[tool.pdm] +includes = ["liteyuki"] diff --git a/src/nonebot_plugins/liteyuki_crt_utils/__init__.py b/src/nonebot_plugins/liteyuki_crt_utils/__init__.py index 0a4eaf45..c2437128 100644 --- a/src/nonebot_plugins/liteyuki_crt_utils/__init__.py +++ b/src/nonebot_plugins/liteyuki_crt_utils/__init__.py @@ -16,5 +16,4 @@ __plugin_meta__ = PluginMetadata( "toggleable" : True, "default_enable": True, } -) -print(get_bot()) \ No newline at end of file +) \ No newline at end of file