From 14c85e388f828a83d17870f96fc99e1081d0cc66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=B4=E7=8C=AB?= Date: Sun, 15 Mar 2026 07:18:12 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E9=A1=B9=E7=AE=A1=E7=90=86=EF=BC=8C=E4=BC=98=E5=8C=96=20pyproj?= =?UTF-8?q?ect.toml=20=E5=92=8C=20requirements.txt=20=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 28 ++++++++++++------- requirements.txt | 16 ++++------- scripts/make_scripts/generate_requirements.py | 6 ++-- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e2f97d54..f6dd6646 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,20 +1,26 @@ +[build-system] +requires = ["setuptools>=80.9.0"] +build-backend = "setuptools.build_meta" + [project] name = "MaiBot" version = "1.0.0" description = "MaiCore 是一个基于大语言模型的可交互智能体" requires-python = ">=3.10" dependencies = [ - "aiohttp-cors>=0.8.1", - "aiohttp>=3.12.14", "Babel>=2.17.0", + "aiohttp>=3.12.14", + "certifi", "colorama>=0.4.6", "faiss-cpu>=1.11.0", "fastapi>=0.116.0", "google-genai>=1.39.1", + "httpx", "jieba>=0.42.1", "json-repair>=0.47.6", "maim-message>=0.6.2", - "matplotlib>=3.10.3", + "maibot-plugin-sdk>=1.2.3", + "msgpack>=1.1.2", "numpy>=2.2.6", "openai>=1.95.0", "pandas>=2.3.1", @@ -25,21 +31,23 @@ dependencies = [ "python-dotenv>=1.1.1", "python-multipart>=0.0.20", "python-levenshtein", - "pytz>=2024.1", # Babel 的依赖,需要显式声明 "quick-algo>=0.1.4", "rich>=14.0.0", - "ruff>=0.12.2", - "setuptools>=80.9.0", "sqlalchemy>=2.0.40", "sqlmodel>=0.0.24", "structlog>=25.4.0", - "toml>=0.10.2", "tomlkit>=0.13.3", - "urllib3>=2.5.0", + "typing-extensions", "uvicorn>=0.35.0", - "msgpack>=1.1.2", "watchfiles>=1.1.1", - "maibot-plugin-sdk>=1.2.3", +] + +[dependency-groups] +dev = [ + "pytest", + "pytest-asyncio", + "ruff>=0.12.2", + "zstandard", ] diff --git a/requirements.txt b/requirements.txt index 1b2367db..6a72e1e4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,15 @@ Babel>=2.17.0 -aiohttp-cors>=0.8.1 aiohttp>=3.12.14 +certifi colorama>=0.4.6 faiss-cpu>=1.11.0 fastapi>=0.116.0 google-genai>=1.39.1 +httpx jieba>=0.42.1 json-repair>=0.47.6 -maibot-plugin-sdk>=1.2.3 maim-message>=0.6.2 -matplotlib>=3.10.3 +maibot-plugin-sdk>=1.2.3 msgpack>=1.1.2 numpy>=2.2.6 openai>=1.95.0 @@ -19,18 +19,14 @@ pyarrow>=20.0.0 pydantic>=2.11.7 pypinyin>=0.54.0 python-dotenv>=1.1.1 -python-levenshtein python-multipart>=0.0.20 -pytz>=2024.1 +python-levenshtein quick-algo>=0.1.4 rich>=14.0.0 -ruff>=0.12.2 -setuptools>=80.9.0 sqlalchemy>=2.0.40 sqlmodel>=0.0.24 structlog>=25.4.0 -toml>=0.10.2 tomlkit>=0.13.3 -urllib3>=2.5.0 +typing-extensions uvicorn>=0.35.0 -watchfiles>=1.1.1 \ No newline at end of file +watchfiles>=1.1.1 diff --git a/scripts/make_scripts/generate_requirements.py b/scripts/make_scripts/generate_requirements.py index f52e6877..f56b6b89 100644 --- a/scripts/make_scripts/generate_requirements.py +++ b/scripts/make_scripts/generate_requirements.py @@ -8,7 +8,7 @@ def generate_requirements(pyproject_path="pyproject.toml", output_path="requirem pyproject_data = tomlkit.load(file) # 获取 pyproject.toml 中的 dependencies 列表 - pyproject_dependencies = set(pyproject_data.get("project", {}).get("dependencies", [])) + pyproject_dependencies = pyproject_data.get("project", {}).get("dependencies", []) if not pyproject_dependencies: print("未找到 dependencies 部分,无法生成 requirements.txt") return @@ -20,14 +20,14 @@ def generate_requirements(pyproject_path="pyproject.toml", output_path="requirem except FileNotFoundError: requirements = set() - if extra_dependencies := requirements - pyproject_dependencies: + if extra_dependencies := requirements - set(pyproject_dependencies): print("警告: 以下依赖项存在于 requirements.txt 中,但未在 pyproject.toml 中找到:") for dep in extra_dependencies: print(f" - {dep}") # 写入更新后的 requirements.txt 文件 with open(output_path, "w", encoding="utf-8") as file: - file.write("\n".join(sorted(pyproject_dependencies))) + file.write("\n".join(pyproject_dependencies)) print(f"requirements.txt 文件已生成: {output_path}") except FileNotFoundError: