v0.1.4 修复初始化时 playwright 命令未找到、补充元数据

1. 初始化时,运行 playwright install chromium 时,现在会指定 sys.excuteable 来避免未找到
playwright 命令。
2. 遵循 AI 和 pypi 的建议在 pyproject.toml 中补充了一些元数据。
This commit is contained in:
2026-04-26 18:40:21 +08:00
parent 2aee776bad
commit 5500c55b71
3 changed files with 50 additions and 2 deletions

21
LICENSE.txt Normal file
View File

@@ -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.

View File

@@ -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"

View File

@@ -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)