更改令人费解的 requirements.txt 方案

This commit is contained in:
2025-10-09 20:25:34 +08:00
parent b4e400b626
commit 4eac493de4
5 changed files with 29 additions and 143 deletions

24
.vscode/launch.json vendored
View File

@ -1,24 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "运行 Bot 并调试(自动重载)",
"type": "debugpy",
"request": "launch",
"module": "watchfiles",
"args": [
"bot.main"
],
"console": "integratedTerminal",
"justMyCode": true,
"env": {
"PYTHONPATH": "${workspaceFolder}"
},
"cwd": "${workspaceFolder}",
"presentation": {
"hidden": false,
"group": "bot"
}
}
]
}

30
.vscode/tasks.json vendored
View File

@ -1,30 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Poetry: Export requirements.txt (Production)",
"type": "shell",
"command": "poetry export -f requirements.txt --output requirements.txt --without-hashes",
"group": "build",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": [],
"detail": "导出生产环境依赖到 requirements.txt"
},
{
"label": "Bot: Run with Auto-reload",
"type": "shell",
"command": "poetry run watchfiles bot.main",
"group": "build",
"isBackground": true,
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": [],
"detail": "运行 bot 并启用自动重载功能"
}
]
}

View File

@ -1,8 +1,32 @@
FROM python:3.13-slim
# copied from https://www.martinrichards.me/post/python_poetry_docker/
FROM python:3.13-slim AS base
ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH"
FROM base AS builder
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache
WORKDIR /app
RUN pip install poetry
COPY pyproject.toml poetry.lock ./
RUN python -m poetry install --no-root && rm -rf $POETRY_CACHE_DIR
FROM base AS runtime
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
WORKDIR /app
COPY requirements.txt ./
RUN pip install -r requirements.txt --no-deps
COPY bot.py pyproject.toml .env.prod .env.test ./
COPY assets ./assets

View File

@ -65,10 +65,10 @@ code .
### 运行
你可以在 VSCode 的「运行与调试」窗口,启动 `运行 Bot 并调试(自动重载)` 任务来启动 Bot也可以使用命令行手动启动 Bot
使用命令行手动启动 Bot
```bash
poetry run watchfiles bot.main
poetry run watchfiles bot.main konabot
```
如果你不希望自动重载,只是想运行 Bot可以直接运行

View File

@ -1,84 +0,0 @@
aio-mc-rcon==3.4.1 ; python_version >= "3.12" and python_version < "4.0"
aiodns==3.5.0 ; python_version >= "3.12" and python_version < "4.0"
aiohappyeyeballs==2.6.1 ; python_version >= "3.12" and python_version < "4.0"
aiohttp==3.12.15 ; python_version >= "3.12" and python_version < "4.0"
aiosignal==1.4.0 ; python_version >= "3.12" and python_version < "4.0"
annotated-types==0.7.0 ; python_version >= "3.12" and python_version < "4.0"
anyio==4.11.0 ; python_version >= "3.12" and python_version < "4.0"
apscheduler==3.11.0 ; python_version >= "3.12" and python_version < "4.0"
arclet-alconna-tools==0.7.11 ; python_version >= "3.12" and python_version < "4.0"
arclet-alconna==1.8.40 ; python_version >= "3.12" and python_version < "4.0"
attrs==25.3.0 ; python_version >= "3.12" and python_version < "4.0"
beautifulsoup4==4.13.5 ; python_version >= "3.12" and python_version < "4.0"
brotli==1.1.0 ; python_version >= "3.12" and python_version < "4.0" and platform_python_implementation == "CPython"
brotlicffi==1.1.0.0 ; python_version >= "3.12" and python_version < "4.0" and platform_python_implementation != "CPython"
certifi==2025.8.3 ; python_version >= "3.12" and python_version < "4.0"
cffi==2.0.0 ; python_version >= "3.12" and python_version < "4.0"
charset-normalizer==3.4.3 ; python_version >= "3.12" and python_version < "4.0"
click==8.3.0 ; python_version >= "3.12" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.12" and python_version < "4.0" and (sys_platform == "win32" or platform_system == "Windows")
exceptiongroup==1.3.0 ; python_version >= "3.12" and python_version < "4.0"
fastapi==0.117.1 ; python_version >= "3.12" and python_version < "4.0"
frozenlist==1.7.0 ; python_version >= "3.12" and python_version < "4.0"
h11==0.16.0 ; python_version >= "3.12" and python_version < "4.0"
h2==4.3.0 ; python_version >= "3.12" and python_version < "4.0"
hpack==4.1.0 ; python_version >= "3.12" and python_version < "4.0"
httpcore==1.0.9 ; python_version >= "3.12" and python_version < "4.0"
httptools==0.6.4 ; python_version >= "3.12" and python_version < "4.0"
httpx==0.28.1 ; python_version >= "3.12" and python_version < "4.0"
hyperframe==6.1.0 ; python_version >= "3.12" and python_version < "4.0"
idna==3.10 ; python_version >= "3.12" and python_version < "4.0"
imagetext-py==2.2.0 ; python_version >= "3.12" and python_version < "4.0"
importlib-metadata==8.7.0 ; python_version >= "3.12" and python_version < "4.0"
linkify-it-py==2.0.3 ; python_version >= "3.12" and python_version < "4.0"
loguru==0.7.3 ; python_version >= "3.12" and python_version < "4.0"
lxml==6.0.2 ; python_version >= "3.12" and python_version < "4.0"
markdown-it-py==4.0.0 ; python_version >= "3.12" and python_version < "4.0"
mdit-py-plugins==0.5.0 ; python_version >= "3.12" and python_version < "4.0"
mdurl==0.1.2 ; python_version >= "3.12" and python_version < "4.0"
msgpack==1.1.1 ; python_version >= "3.12" and python_version < "4.0"
multidict==6.6.4 ; python_version >= "3.12" and python_version < "4.0"
nepattern==0.7.7 ; python_version >= "3.12" and python_version < "4.0"
nonebot-adapter-console==0.9.0 ; python_version >= "3.12" and python_version < "4.0"
nonebot-adapter-discord==0.1.8 ; python_version >= "3.12" and python_version < "4.0"
nonebot-adapter-minecraft==1.5.2 ; python_version >= "3.12" and python_version < "4.0"
nonebot-adapter-onebot==2.4.6 ; python_version >= "3.12" and python_version < "4.0"
nonebot-plugin-alconna==0.59.4 ; python_version >= "3.12" and python_version < "4.0"
nonebot-plugin-apscheduler==0.5.0 ; python_version >= "3.12" and python_version < "4.0"
nonebot-plugin-waiter==0.8.1 ; python_version >= "3.12" and python_version < "4.0"
nonebot2==2.4.3 ; python_version >= "3.12" and python_version < "4.0"
nonechat==0.6.1 ; python_version >= "3.12" and python_version < "4.0"
numpy==2.2.6 ; python_version >= "3.12" and python_version < "4.0"
opencv-python-headless==4.12.0.88 ; python_version >= "3.12" and python_version < "4.0"
pillow==11.3.0 ; python_version >= "3.12" and python_version < "4.0"
platformdirs==4.4.0 ; python_version >= "3.12" and python_version < "4.0"
propcache==0.3.2 ; python_version >= "3.12" and python_version < "4.0"
pycares==4.11.0 ; python_version >= "3.12" and python_version < "4.0"
pycparser==2.23 ; python_version >= "3.12" and python_version < "4.0" and implementation_name != "PyPy"
pydantic-core==2.33.2 ; python_version >= "3.12" and python_version < "4.0"
pydantic==2.11.9 ; python_version >= "3.12" and python_version < "4.0"
pygments==2.19.2 ; python_version >= "3.12" and python_version < "4.0"
pygtrie==2.5.0 ; python_version >= "3.12" and python_version < "4.0"
python-dotenv==1.1.1 ; python_version >= "3.12" and python_version < "4.0"
pyyaml==6.0.3 ; python_version >= "3.12" and python_version < "4.0"
requests==2.32.5 ; python_version >= "3.12" and python_version < "4.0"
returns==0.26.0 ; python_version >= "3.12" and python_version < "4.0"
rich==14.1.0 ; python_version >= "3.12" and python_version < "4.0"
sniffio==1.3.1 ; python_version >= "3.12" and python_version < "4.0"
soupsieve==2.8 ; python_version >= "3.12" and python_version < "4.0"
starlette==0.48.0 ; python_version >= "3.12" and python_version < "4.0"
tarina==0.6.8 ; python_version >= "3.12" and python_version < "4.0"
textual==3.7.1 ; python_version >= "3.12" and python_version < "4.0"
typing-extensions==4.15.0 ; python_version >= "3.12" and python_version < "4.0"
typing-inspection==0.4.1 ; python_version >= "3.12" and python_version < "4.0"
tzdata==2025.2 ; python_version >= "3.12" and python_version < "4.0" and platform_system == "Windows"
tzlocal==5.3.1 ; python_version >= "3.12" and python_version < "4.0"
uc-micro-py==1.0.3 ; python_version >= "3.12" and python_version < "4.0"
urllib3==2.5.0 ; python_version >= "3.12" and python_version < "4.0"
uvicorn==0.37.0 ; python_version >= "3.12" and python_version < "4.0"
uvloop==0.21.0 ; python_version >= "3.12" and python_version < "4.0" and sys_platform != "win32" and sys_platform != "cygwin" and platform_python_implementation != "PyPy"
watchfiles==1.1.0 ; python_version >= "3.12" and python_version < "4.0"
websockets==15.0.1 ; python_version >= "3.12" and python_version < "4.0"
win32-setctime==1.2.0 ; python_version >= "3.12" and python_version < "4.0" and sys_platform == "win32"
yarl==1.20.1 ; python_version >= "3.12" and python_version < "4.0"
zipp==3.23.0 ; python_version >= "3.12" and python_version < "4.0"