From 5500c55b711ad2ebc3116859c1ef412f06563eaf Mon Sep 17 00:00:00 2001 From: MangoFanFanw Date: Sun, 26 Apr 2026 18:40:21 +0800 Subject: [PATCH] =?UTF-8?q?v0.1.4=20=E4=BF=AE=E5=A4=8D=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E6=97=B6=20playwright=20=E5=91=BD=E4=BB=A4=E6=9C=AA?= =?UTF-8?q?=E6=89=BE=E5=88=B0=E3=80=81=E8=A1=A5=E5=85=85=E5=85=83=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 初始化时,运行 playwright install chromium 时,现在会指定 sys.excuteable 来避免未找到 playwright 命令。 2. 遵循 AI 和 pypi 的建议在 pyproject.toml 中补充了一些元数据。 --- LICENSE.txt | 21 +++++++++++++++++++++ pyproject.toml | 23 +++++++++++++++++++++++ src/njupt_suan_api/manage.py | 8 ++++++-- 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..a7f91f2 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 MangoFanFanw + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/pyproject.toml b/pyproject.toml index c2ae9a4..5435fdd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,22 @@ version = "0.1.3" description = "API and MCP server for NJUPT infomation ~" readme = "README.md" requires-python = ">=3.13" +license = "MIT" + +authors = [ + { name = "MangoFanFanw", email = "mangofanfanw@icloud.com" } +] + +maintainers = [ + { name = "MangoFanFanw", email = "mangofanfanw@icloud.com" } +] + +classifiers = [ + "Development Status :: 3 - Alpha", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3.13", +] + dependencies = [ "aiofiles>=25.1.0", "beautifulsoup4>=4.14.3", @@ -23,6 +39,13 @@ dependencies = [ "websockets>=16.0", ] +[project.urls] +Homepage = "https://suan.mangofanfan.cn" +Documentation = "https://suan.mangofanfan.cn" +Repository = "https://github.com/mangofanfan/NJUPT-Suan-API.git" +Changelog = "https://github.com/mangofanfan/NJUPT-Suan-API/blob/master/CHANGELOG.md" +Issues = "https://github.com/mangofanfan/NJUPT-Suan-API/issues" + [project.scripts] njupt-suan-api = "njupt_suan_api.manage:app" diff --git a/src/njupt_suan_api/manage.py b/src/njupt_suan_api/manage.py index ee1377b..0e296fb 100644 --- a/src/njupt_suan_api/manage.py +++ b/src/njupt_suan_api/manage.py @@ -1,4 +1,5 @@ import subprocess +import sys from secrets import token_urlsafe import typer @@ -52,7 +53,10 @@ def main( CLI 入口回调,所有子命令执行前都会经过这里。 可以在这里放全局初始化(如日志级别、环境检查)。 """ - pass # 没有 --version 时就正常放行,继续执行子命令 + # 没有 --version 时就正常放行,继续执行子命令 + console.print( + "[bright_black]NJUPT Suan API 仍然处于极早期的阶段。如果遇到任何问题,请告诉芒果帆帆喵![/bright_black]\n" + ) @app.command() @@ -89,7 +93,7 @@ def init(force: bool = typer.Option(False, "--force", "-f", help="强制初始 # 3 执行 uv run playwright install chromium console.print("[bright_black]即将安装 playwright 的 chromium,这可能是耗时最长的部分。[/bright_black]") - cp3 = subprocess.run(["playwright", "install", "chromium"], cwd=WORKSPACE_DIR) + cp3 = subprocess.run([sys.executable, "-m", "playwright", "install", "chromium"], cwd=WORKSPACE_DIR) if cp3.returncode != 0: console.print("[yellow]运行 playwright install chromuim 失败,双是什么原因呢?[/yellow]") raise typer.Exit(code=cp3.returncode)