mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-11 03:18:29 +08:00
Compare commits
17 Commits
d6e7acf45f
...
feat/uv
| Author | SHA1 | Date | |
|---|---|---|---|
| e1c97aacad | |||
|
2645314899
|
|||
|
979f6b4cb2
|
|||
|
1274093622
|
|||
|
0f1fe1515f
|
|||
|
99c949691e
|
|||
|
5bd67ad7ad
|
|||
|
cac5e09f71
|
|||
|
08c8bb955f
|
|||
|
6c8b37f085
|
|||
|
8550ff975a
|
|||
|
8c6e77dd94
|
|||
|
93b6055391
|
|||
| 5a5b27d285 | |||
| c8df2b3cc2 | |||
| e20aba9040 | |||
| 5a7396bada |
+13
-8
@@ -1,19 +1,24 @@
|
|||||||
*.ini
|
*.ini
|
||||||
*.yaml
|
#*.yaml
|
||||||
*.yml
|
*.yml
|
||||||
*.md
|
*.md
|
||||||
*.json
|
#*.json
|
||||||
*.toml
|
|
||||||
*.xml
|
*.xml
|
||||||
tests
|
tests
|
||||||
node_modules
|
node_modules
|
||||||
admin-frontend
|
#admin-frontend
|
||||||
data*
|
data*
|
||||||
htmlcov
|
htmlcov
|
||||||
docker
|
docker
|
||||||
dist
|
dist
|
||||||
docs
|
docs
|
||||||
.*
|
venv
|
||||||
|
.venv
|
||||||
!pyproject.toml
|
/admin-frontend/node_modules
|
||||||
!README.md
|
/LICENSE
|
||||||
|
/.editorconfig
|
||||||
|
/.gitattributes
|
||||||
|
/.prettierignore
|
||||||
|
/.prettierrc
|
||||||
|
/.devcontainer/
|
||||||
|
/.github/
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ inputs:
|
|||||||
description: Python version
|
description: Python version
|
||||||
required: false
|
required: false
|
||||||
default: "3.10"
|
default: "3.10"
|
||||||
|
install-deps:
|
||||||
|
description: Install dependencies
|
||||||
|
required: false
|
||||||
|
default: "false"
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
@@ -14,7 +18,14 @@ runs:
|
|||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: ${{ inputs.python-version }}
|
python-version: ${{ inputs.python-version }}
|
||||||
- name: Setup Poetry
|
|
||||||
uses: Gr1N/setup-poetry@v9
|
- name: Install the latest version of uv
|
||||||
|
uses: astral-sh/setup-uv@v4
|
||||||
with:
|
with:
|
||||||
poetry-version: "1.7.1"
|
version: "latest"
|
||||||
|
enable-cache: true
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
if: ${{ inputs.install-deps == 'true' }}
|
||||||
|
run: uv sync --frozen
|
||||||
|
shell: bash
|
||||||
|
|||||||
+14
-24
@@ -11,7 +11,7 @@ on:
|
|||||||
- nonebot_bison/**
|
- nonebot_bison/**
|
||||||
- tests/**
|
- tests/**
|
||||||
- pyproject.toml
|
- pyproject.toml
|
||||||
- poetry.lock
|
- uv.lock
|
||||||
- docker.env.prod
|
- docker.env.prod
|
||||||
- .github/**
|
- .github/**
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -21,7 +21,7 @@ on:
|
|||||||
- nonebot_bison/**
|
- nonebot_bison/**
|
||||||
- tests/**
|
- tests/**
|
||||||
- pyproject.toml
|
- pyproject.toml
|
||||||
- poetry.lock
|
- uv.lock
|
||||||
- docker.env.prod
|
- docker.env.prod
|
||||||
- .github/**
|
- .github/**
|
||||||
types:
|
types:
|
||||||
@@ -72,12 +72,13 @@ jobs:
|
|||||||
uses: ./.github/actions/setup-python
|
uses: ./.github/actions/setup-python
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
install-deps: "true"
|
||||||
|
|
||||||
- name: Install prerequisites
|
- name: Install playwright
|
||||||
run: poetry install
|
run: uv run playwright install
|
||||||
|
|
||||||
- name: Run Pytest
|
- name: Run Pytest
|
||||||
run: poetry run pytest --cov-report xml --cov=./nonebot_bison -k 'not compare and not render' -n auto
|
run: uv run pytest --cov-report xml --cov=./nonebot_bison -k 'not compare and not render' -n auto
|
||||||
|
|
||||||
- name: Upload coverage report
|
- name: Upload coverage report
|
||||||
uses: codecov/codecov-action@v5
|
uses: codecov/codecov-action@v5
|
||||||
@@ -106,12 +107,13 @@ jobs:
|
|||||||
uses: ./.github/actions/setup-python
|
uses: ./.github/actions/setup-python
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
install-deps: "true"
|
||||||
|
|
||||||
- name: Install prerequisites
|
- name: Install playwright
|
||||||
run: poetry install
|
run: uv run playwright install
|
||||||
|
|
||||||
- name: Run Pytest
|
- name: Run Pytest
|
||||||
run: poetry run pytest --cov-report xml --cov=./nonebot_bison -k 'not compare' -n auto
|
run: uv run pytest --cov-report xml --cov=./nonebot_bison -k 'not compare' -n auto
|
||||||
|
|
||||||
- name: Upload coverage report
|
- name: Upload coverage report
|
||||||
uses: codecov/codecov-action@v5
|
uses: codecov/codecov-action@v5
|
||||||
@@ -127,12 +129,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download frontend files
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: frontend
|
|
||||||
path: ./nonebot_bison/admin_page/dist
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
@@ -144,7 +140,7 @@ jobs:
|
|||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./docker/Dockerfile_with_frontend
|
file: ./docker/Dockerfile
|
||||||
push: false
|
push: false
|
||||||
load: true
|
load: true
|
||||||
tags: felinae98/nonebot-bison:dummy
|
tags: felinae98/nonebot-bison:dummy
|
||||||
@@ -174,7 +170,7 @@ jobs:
|
|||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./docker/Dockerfile_with_frontend
|
file: ./docker/Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: felinae98/nonebot-bison:${{ env.GIT_BRANCH_NAME }}
|
tags: felinae98/nonebot-bison:${{ env.GIT_BRANCH_NAME }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
@@ -188,12 +184,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download frontend files
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: frontend
|
|
||||||
path: ./nonebot_bison/admin_page/dist
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
@@ -215,8 +205,8 @@ jobs:
|
|||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./docker/Dockerfile_with_frontend_sentry
|
file: ./docker/Dockerfile_without_browser
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: felinae98/nonebot-bison:${{ env.GIT_BRANCH_NAME }}-sentry
|
tags: felinae98/nonebot-bison:${{ env.GIT_BRANCH_NAME }}-nobrowser
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|||||||
@@ -9,35 +9,12 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-frontend:
|
|
||||||
name: Build Frontend
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Build Frontend
|
|
||||||
uses: ./.github/actions/build-frontend
|
|
||||||
|
|
||||||
- name: Upload dist
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: frontend
|
|
||||||
path: ./admin-frontend/build/
|
|
||||||
|
|
||||||
docker-main:
|
docker-main:
|
||||||
name: Docker main
|
name: Docker main
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build-frontend]
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download frontend files
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: frontend
|
|
||||||
path: ./src/plugins/nonebot_bison/admin_page/dist
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
@@ -54,7 +31,7 @@ jobs:
|
|||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./docker/Dockerfile_with_frontend
|
file: ./docker/Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: felinae98/nonebot-bison:${{ inputs.dockerTag }}
|
tags: felinae98/nonebot-bison:${{ inputs.dockerTag }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
@@ -63,16 +40,9 @@ jobs:
|
|||||||
docker-main-sentry:
|
docker-main-sentry:
|
||||||
name: Docker main sentry
|
name: Docker main sentry
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build-frontend]
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download frontend files
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: frontend
|
|
||||||
path: ./src/plugins/nonebot_bison/admin_page/dist
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
@@ -89,7 +59,7 @@ jobs:
|
|||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./docker/Dockerfile_with_frontend_sentry
|
file: ./docker/Dockerfile_without_browser
|
||||||
tags: felinae98/nonebot-bison:${{ inputs.dockerTag }}-sentry
|
tags: felinae98/nonebot-bison:${{ inputs.dockerTag }}-nobrowser
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ on:
|
|||||||
- nonebot_bison/**
|
- nonebot_bison/**
|
||||||
- tests/**
|
- tests/**
|
||||||
- pyproject.toml
|
- pyproject.toml
|
||||||
- poetry.lock
|
- uv.lock
|
||||||
- docker.env.prod
|
- docker.env.prod
|
||||||
- .github/**
|
- .github/**
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -21,7 +21,7 @@ on:
|
|||||||
- nonebot_bison/**
|
- nonebot_bison/**
|
||||||
- tests/**
|
- tests/**
|
||||||
- pyproject.toml
|
- pyproject.toml
|
||||||
- poetry.lock
|
- uv.lock
|
||||||
- docker.env.prod
|
- docker.env.prod
|
||||||
- .github/**
|
- .github/**
|
||||||
types:
|
types:
|
||||||
@@ -55,7 +55,10 @@ jobs:
|
|||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
- name: Install prerequisites
|
- name: Install prerequisites
|
||||||
run: poetry add pydantic@^1.10 && poetry install
|
run: uv add pydantic==1.10 && uv sync --frozen
|
||||||
|
|
||||||
|
- name: Install playwright
|
||||||
|
run: uv run playwright install
|
||||||
|
|
||||||
- name: Run Pytest
|
- name: Run Pytest
|
||||||
run: poetry run pytest -k 'not compare and not render' -n auto
|
run: uv run pytest -k 'not compare and not render' -n auto
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ jobs:
|
|||||||
- name: Setup Python environment
|
- name: Setup Python environment
|
||||||
uses: ./.github/actions/setup-python
|
uses: ./.github/actions/setup-python
|
||||||
|
|
||||||
- run: echo "TAG_NAME=v$(poetry version -s)" >> $GITHUB_ENV
|
- run: echo "TAG_NAME=v$(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Archive Changelog
|
- name: Archive Changelog
|
||||||
uses: docker://ghcr.io/nonebot/auto-changelog:master
|
uses: docker://ghcr.io/nonebot/auto-changelog:master
|
||||||
@@ -30,6 +30,6 @@ jobs:
|
|||||||
git config user.name github-actions[bot]
|
git config user.name github-actions[bot]
|
||||||
git config user.email github-actions[bot]@users.noreply.github.com
|
git config user.email github-actions[bot]@users.noreply.github.com
|
||||||
git add .
|
git add .
|
||||||
git commit -m ":bookmark: Release $(poetry version -s)"
|
git commit -m ":bookmark: Release ${{ env.TAG_NAME }}"
|
||||||
git tag ${{ env.TAG_NAME }}
|
git tag ${{ env.TAG_NAME }}
|
||||||
git push && git push --tags
|
git push && git push --tags
|
||||||
|
|||||||
@@ -54,24 +54,17 @@ jobs:
|
|||||||
|
|
||||||
- name: Publish PyPI and Github
|
- name: Publish PyPI and Github
|
||||||
run: |
|
run: |
|
||||||
poetry publish --build -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} || echo "Already pushed to pypi"
|
uv publish --build -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} || echo "Already pushed to pypi"
|
||||||
gh release upload --clobber ${{ env.TAG_NAME }} dist/*
|
gh release upload --clobber ${{ env.TAG_NAME }} dist/*
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
publish-docker:
|
publish-docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build-frontend
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download frontend files
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: frontend
|
|
||||||
path: ./nonebot_bison/admin_page/dist
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
@@ -92,7 +85,7 @@ jobs:
|
|||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./docker/Dockerfile_with_frontend
|
file: ./docker/Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
felinae98/nonebot-bison:latest
|
felinae98/nonebot-bison:latest
|
||||||
@@ -104,10 +97,10 @@ jobs:
|
|||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./docker/Dockerfile_with_frontend_sentry
|
file: ./docker/Dockerfile_without_browser
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
felinae98/nonebot-bison:${{ env.TAG_NAME }}-sentry
|
felinae98/nonebot-bison:${{ env.TAG_NAME }}-nobrowser
|
||||||
felinae98/nonebot-bison:sentry
|
felinae98/nonebot-bison:nobrowser
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|||||||
+190
-14
@@ -1,16 +1,192 @@
|
|||||||
FROM node:22.11.0 as frontend
|
# syntax=docker/dockerfile:1.10
|
||||||
ADD . /app
|
FROM python:3.12-slim AS metadata-stage
|
||||||
WORKDIR /app/admin-frontend
|
|
||||||
RUN npm install -g pnpm
|
WORKDIR /tmp
|
||||||
RUN pnpm install && pnpm build
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive \
|
||||||
|
PYTHONUNBUFFERED=1 \
|
||||||
|
TZ=Asia/Shanghai
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
curl \
|
||||||
|
python3-pip \
|
||||||
|
git \
|
||||||
|
&& pip install toml \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
COPY ./pyproject.toml ./
|
||||||
|
|
||||||
|
RUN echo "📋 Collecting metadata..." && \
|
||||||
|
export CREATED_DATE="$(date -u '+%Y-%m-%d %H:%M:%S UTC')" && \
|
||||||
|
export PYPROJECT_NAME=$(python3 -c 'import toml; print(toml.load("pyproject.toml")["project"]["name"])') && \
|
||||||
|
export DESCRIPTION=$(python3 -c 'import toml; print(toml.load("pyproject.toml")["project"]["description"])') && \
|
||||||
|
export AUTHOR=$(python3 -c 'import toml; print(toml.load("pyproject.toml")["project"]["authors"][0]["name"])') && \
|
||||||
|
echo "⏰ Created Date: $CREATED_DATE" && \
|
||||||
|
echo "📝 Project Name: $PYPROJECT_NAME" && \
|
||||||
|
echo "📄 Description: $DESCRIPTION" && \
|
||||||
|
echo "👤 Author: $AUTHOR" && \
|
||||||
|
echo "$CREATED_DATE" > /tmp/CREATED_DATE && \
|
||||||
|
echo "$PYPROJECT_NAME" > /tmp/PYPROJECT_NAME && \
|
||||||
|
echo "$DESCRIPTION" > /tmp/DESCRIPTION && \
|
||||||
|
echo "$AUTHOR" > /tmp/AUTHOR
|
||||||
|
|
||||||
|
|
||||||
|
RUN --mount=type=bind,source=./.git/,target=/tmp/.git/ \
|
||||||
|
echo "🏷️ Checking version information..." && \
|
||||||
|
VERSION=$(git describe --tags --exact-match 2>/dev/null || git rev-parse --short HEAD || echo "unknown") && \
|
||||||
|
echo "📌 Version: $VERSION" && \
|
||||||
|
echo "$VERSION" > /tmp/VERSION
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.created="$(cat /tmp/CREATED_DATE)" \
|
||||||
|
org.opencontainers.image.authors="$(cat /tmp/AUTHOR)" \
|
||||||
|
org.opencontainers.image.description="$(cat /tmp/DESCRIPTION)" \
|
||||||
|
org.opencontainers.image.name="$(cat /tmp/PYPROJECT_NAME)" \
|
||||||
|
org.opencontainers.image.version="$(cat /tmp/VERSION)"
|
||||||
|
|
||||||
|
FROM node:20-slim AS frontend-stage
|
||||||
|
|
||||||
|
WORKDIR /tmp/admin-frontend
|
||||||
|
|
||||||
|
ENV TZ=Asia/Shanghai \
|
||||||
|
PNPM_HOME="/pnpm" \
|
||||||
|
PATH="$PNPM_HOME:$PATH"
|
||||||
|
|
||||||
|
COPY ./admin-frontend/package.json ./admin-frontend/pnpm-lock.yaml ./
|
||||||
|
|
||||||
|
RUN corepack enable && \
|
||||||
|
corepack prepare pnpm@9.15.1 --activate && \
|
||||||
|
echo "🔔 Verifying Node.js installation..." && \
|
||||||
|
if NODE_VERSION=$(node --version 2>&1); then \
|
||||||
|
echo "✅ Node.js version ${NODE_VERSION} installed successfully"; \
|
||||||
|
else \
|
||||||
|
echo "❌ Node.js installation failed" && exit 1; \
|
||||||
|
fi && \
|
||||||
|
echo "🔔 Verifying pnpm installation..." && \
|
||||||
|
if PNPM_VERSION=$(pnpm --version 2>&1); then \
|
||||||
|
echo "✅ pnpm version ${PNPM_VERSION} installed successfully"; \
|
||||||
|
else \
|
||||||
|
echo "❌ pnpm installation failed" && exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
RUN pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
COPY ./admin-frontend .
|
||||||
|
RUN mkdir -p ../nonebot_bison/admin_page/dist
|
||||||
|
|
||||||
|
RUN echo "🏗️ Starting frontend build..." && \
|
||||||
|
pnpm run build && \
|
||||||
|
echo "✅ Frontend build completed"
|
||||||
|
|
||||||
|
FROM python:3.12-slim AS playwright-stage
|
||||||
|
|
||||||
|
WORKDIR /tmp
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive \
|
||||||
|
PYTHONUNBUFFERED=1 \
|
||||||
|
TZ=Asia/Shanghai
|
||||||
|
|
||||||
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||||
|
|
||||||
|
|
||||||
|
RUN echo "📦 Installing playwright..." && \
|
||||||
|
uvx playwright install --with-deps chromium && \
|
||||||
|
echo "✅ Playwright installed successfully"
|
||||||
|
|
||||||
|
FROM python:3.12-slim AS production
|
||||||
|
|
||||||
FROM python:3.11
|
|
||||||
RUN python3 -m pip install poetry && poetry config virtualenvs.create false
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY ./README.md ./pyproject.toml ./poetry.lock* /app/
|
|
||||||
RUN poetry install --only=main,docker
|
#ENV UV_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
|
||||||
ADD src /app/src
|
ENV DEBIAN_FRONTEND=noninteractive \
|
||||||
ADD bot.py /app/
|
UV_COMPILE_BYTECODE=1 \
|
||||||
COPY --from=frontend /app/nonebot_bison/admin_page/dist /app/nonebot_bison/admin_page/dist
|
UV_SYSTEM_PYTHON=true \
|
||||||
ENV HOST=0.0.0.0
|
PYTHONUNBUFFERED=1 \
|
||||||
CMD ["nb", "run"]
|
UV_LINK_MODE=copy \
|
||||||
|
TZ=Asia/Shanghai \
|
||||||
|
SHELL="/bin/bash"
|
||||||
|
|
||||||
|
RUN echo "📦 Installing system dependencies..." && \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
curl \
|
||||||
|
xvfb \
|
||||||
|
fonts-noto-color-emoji \
|
||||||
|
fonts-unifont \
|
||||||
|
libfontconfig1 \
|
||||||
|
libfreetype6 \
|
||||||
|
xfonts-scalable \
|
||||||
|
fonts-liberation \
|
||||||
|
fonts-ipafont-gothic \
|
||||||
|
fonts-wqy-zenhei \
|
||||||
|
fonts-tlwg-loma-otf \
|
||||||
|
at-spi2-common \
|
||||||
|
fonts-freefont-ttf \
|
||||||
|
libasound2 \
|
||||||
|
libasound2-data \
|
||||||
|
libatk-bridge2.0-0 \
|
||||||
|
libatk1.0-0 \
|
||||||
|
libatspi2.0-0 \
|
||||||
|
libavahi-client3 \
|
||||||
|
libavahi-common-data \
|
||||||
|
libavahi-common3 \
|
||||||
|
libcairo2 \
|
||||||
|
libcups2 \
|
||||||
|
libdatrie1 \
|
||||||
|
libdbus-1-3 \
|
||||||
|
libfribidi0 \
|
||||||
|
libgbm1 \
|
||||||
|
libglib2.0-0 \
|
||||||
|
libgraphite2-3 \
|
||||||
|
libharfbuzz0b \
|
||||||
|
libnspr4 \
|
||||||
|
libnss3 \
|
||||||
|
libpango-1.0-0 \
|
||||||
|
libthai-data \
|
||||||
|
libthai0 \
|
||||||
|
libwayland-server0 \
|
||||||
|
libxcb-render0 \
|
||||||
|
libxcomposite1 \
|
||||||
|
libxdamage1 \
|
||||||
|
libxi6 \
|
||||||
|
libxkbcommon0 && \
|
||||||
|
fc-cache -fv && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
echo "✅ System dependencies installed successfully"
|
||||||
|
|
||||||
|
|
||||||
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||||
|
RUN echo "🔔 Verifying uv installation..." && \
|
||||||
|
if UV_VERSION=$(uv --version 2>&1); then \
|
||||||
|
echo "✅ uv version ${UV_VERSION} installed successfully"; \
|
||||||
|
else \
|
||||||
|
echo "❌ uv installation failed" && exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
COPY ./pyproject.toml ./uv.lock ./
|
||||||
|
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/ \
|
||||||
|
--mount=type=cache,target=/root/.uv \
|
||||||
|
echo "📦 Installing bison dependencies..." && \
|
||||||
|
uv pip install --extra=docker --requirement pyproject.toml --no-cache && \
|
||||||
|
echo "✅ Dependencies installed successfully" && \
|
||||||
|
echo "🔔 Cleaning up uv..." && \
|
||||||
|
rm -rf /bin/uv /bin/uvx && \
|
||||||
|
echo "✅ UV cleanup completed"
|
||||||
|
|
||||||
|
COPY --from=metadata-stage /tmp/VERSION /app/VERSION
|
||||||
|
COPY nonebot_bison/ /app/nonebot_bison/
|
||||||
|
COPY --from=frontend-stage /tmp/nonebot_bison/admin_page/dist ./nonebot_bison/admin_page/dist
|
||||||
|
COPY --from=playwright-stage /root/.cache/ms-playwright /root/.cache/ms-playwright
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
RUN echo '#!/bin/bash' > /app/start.sh && \
|
||||||
|
echo 'echo "📌 Current bison Version: $(cat /app/VERSION)"' >> /app/start.sh && \
|
||||||
|
echo 'echo "🚀 Starting service..."' >> /app/start.sh && \
|
||||||
|
echo 'nb run' >> /app/start.sh && \
|
||||||
|
chmod +x /app/start.sh
|
||||||
|
|
||||||
|
CMD ["/app/start.sh"]
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
FROM python:3.11
|
|
||||||
RUN apt-get update && apt-get install -y fonts-wqy-microhei chromium nano
|
|
||||||
RUN python3 -m pip config set global.index-url https://mirrors.aliyun.com/pypi/simple
|
|
||||||
RUN python3 -m pip install poetry && poetry config virtualenvs.create false
|
|
||||||
WORKDIR /app
|
|
||||||
COPY ./README.md ./pyproject.toml ./poetry.lock* /app/
|
|
||||||
RUN poetry install --only=main,docker
|
|
||||||
ENV BISON_BROWSER=local:/usr/bin/chromium
|
|
||||||
ADD src /app/src
|
|
||||||
ENV HOST=0.0.0.0
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
FROM python:3.11
|
|
||||||
RUN python3 -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
|
||||||
RUN python3 -m pip install poetry && poetry config virtualenvs.create false
|
|
||||||
WORKDIR /app
|
|
||||||
COPY ./README.md ./pyproject.toml ./poetry.lock* /app/
|
|
||||||
RUN poetry install --only=main,docker
|
|
||||||
ADD src /app/src
|
|
||||||
ENV HOST=0.0.0.0
|
|
||||||
CMD ["nb", "run"]
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1.10
|
|
||||||
FROM python:3.11-slim-bullseye as base
|
|
||||||
|
|
||||||
FROM base as builder
|
|
||||||
|
|
||||||
ENV PYTHONFAULTHANDLER=1 \
|
|
||||||
PYTHONUNBUFFERED=1 \
|
|
||||||
PYTHONHASHSEED=random \
|
|
||||||
PIP_NO_CACHE_DIR=off \
|
|
||||||
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
|
||||||
PIP_DEFAULT_TIMEOUT=100 \
|
|
||||||
POETRY_NO_INTERACTION=1 \
|
|
||||||
POETRY_VIRTUALENVS_CREATE=false \
|
|
||||||
PATH="$PATH:/runtime/bin" \
|
|
||||||
PYTHONPATH="$PYTHONPATH:/runtime/lib/python3.10/site-packages" \
|
|
||||||
# Versions:
|
|
||||||
POETRY_VERSION=1.7.1
|
|
||||||
RUN apt-get update && apt-get install -y build-essential unzip wget python-dev git
|
|
||||||
RUN pip install "poetry==$POETRY_VERSION"
|
|
||||||
|
|
||||||
WORKDIR /src
|
|
||||||
|
|
||||||
COPY README.md pyproject.toml poetry.lock /src/
|
|
||||||
|
|
||||||
RUN poetry export --only=main,docker --without-hashes --no-interaction --no-ansi -f requirements.txt -o requirements.txt
|
|
||||||
RUN pip install --prefix=/runtime --force-reinstall -r requirements.txt
|
|
||||||
|
|
||||||
FROM base as runtime
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
RUN --mount=type=cache,target=/var/cache/apt \
|
|
||||||
--mount=type=cache,target=/var/lib/apt \
|
|
||||||
apt-get update && apt-get install -y xvfb fonts-noto-color-emoji ttf-unifont \
|
|
||||||
libfontconfig1 libfreetype6 xfonts-cyrillic xfonts-scalable fonts-liberation \
|
|
||||||
fonts-ipafont-gothic fonts-wqy-zenhei fonts-tlwg-loma-otf \
|
|
||||||
fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 \
|
|
||||||
libcairo2 libcups2 libdbus-1-3 libdrm2 libegl1 libgbm1 libglib2.0-0 libgtk-3-0 \
|
|
||||||
libnspr4 libnss3 libpango-1.0-0 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
|
|
||||||
libxdamage1 libxext6 libxfixes3 libxrandr2 libxshmfence1 nano
|
|
||||||
|
|
||||||
COPY --from=builder /runtime /usr/local
|
|
||||||
ADD . /app/
|
|
||||||
RUN pip install -e . && playwright install chromium
|
|
||||||
RUN mv docker.env.prod .env.prod && \
|
|
||||||
nb adapter install nonebot-adapter-red && \
|
|
||||||
nb adapter install nonebot-adapter-qq
|
|
||||||
ENV HOST=0.0.0.0
|
|
||||||
CMD ["nb", "run"]
|
|
||||||
|
|
||||||
# vim: ft=dockerfile
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1.10
|
|
||||||
FROM python:3.11-slim-bullseye as base
|
|
||||||
|
|
||||||
FROM base as builder
|
|
||||||
|
|
||||||
ENV PYTHONFAULTHANDLER=1 \
|
|
||||||
PYTHONUNBUFFERED=1 \
|
|
||||||
PYTHONHASHSEED=random \
|
|
||||||
PIP_NO_CACHE_DIR=off \
|
|
||||||
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
|
||||||
PIP_DEFAULT_TIMEOUT=100 \
|
|
||||||
POETRY_NO_INTERACTION=1 \
|
|
||||||
POETRY_VIRTUALENVS_CREATE=false \
|
|
||||||
PATH="$PATH:/runtime/bin" \
|
|
||||||
PYTHONPATH="$PYTHONPATH:/runtime/lib/python3.10/site-packages" \
|
|
||||||
# Versions:
|
|
||||||
POETRY_VERSION=1.7.1
|
|
||||||
RUN apt-get update && apt-get install -y build-essential unzip wget python3-dev git
|
|
||||||
RUN pip install "poetry==$POETRY_VERSION"
|
|
||||||
|
|
||||||
WORKDIR /src
|
|
||||||
|
|
||||||
COPY pyproject.toml poetry.lock /src/
|
|
||||||
|
|
||||||
RUN poetry export --only=main,docker --without-hashes --no-interaction --no-ansi -f requirements.txt -o requirements.txt
|
|
||||||
RUN pip install --prefix=/runtime --force-reinstall -r requirements.txt
|
|
||||||
|
|
||||||
FROM base as runtime
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
RUN --mount=type=cache,target=/var/cache/apt \
|
|
||||||
--mount=type=cache,target=/var/lib/apt \
|
|
||||||
apt-get update && apt-get install -y xvfb fonts-noto-color-emoji ttf-unifont \
|
|
||||||
libfontconfig1 libfreetype6 xfonts-cyrillic xfonts-scalable fonts-liberation \
|
|
||||||
fonts-ipafont-gothic fonts-wqy-zenhei fonts-tlwg-loma-otf \
|
|
||||||
fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 \
|
|
||||||
libcairo2 libcups2 libdbus-1-3 libdrm2 libegl1 libgbm1 libglib2.0-0 libgtk-3-0 \
|
|
||||||
libnspr4 libnss3 libpango-1.0-0 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
|
|
||||||
libxdamage1 libxext6 libxfixes3 libxrandr2 libxshmfence1 nano
|
|
||||||
|
|
||||||
COPY --from=builder /runtime /usr/local
|
|
||||||
ADD . /app/
|
|
||||||
RUN pip install -e . && playwright install chromium
|
|
||||||
RUN mv docker.env.prod .env.prod && \
|
|
||||||
nb adapter install nonebot-adapter-red && \
|
|
||||||
nb adapter install nonebot-adapter-qq && \
|
|
||||||
nb plugin install nonebot-plugin-sentry
|
|
||||||
ENV HOST=0.0.0.0
|
|
||||||
CMD ["nb", "run"]
|
|
||||||
|
|
||||||
# vim: ft=dockerfile
|
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
# syntax=docker/dockerfile:1.10
|
||||||
|
FROM python:3.12-slim AS metadata-stage
|
||||||
|
|
||||||
|
WORKDIR /tmp
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive \
|
||||||
|
PYTHONUNBUFFERED=1 \
|
||||||
|
TZ=Asia/Shanghai
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
curl \
|
||||||
|
python3-pip \
|
||||||
|
git \
|
||||||
|
&& pip install toml \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
COPY ./pyproject.toml ./
|
||||||
|
|
||||||
|
RUN echo "📋 Collecting metadata..." && \
|
||||||
|
export CREATED_DATE="$(date -u '+%Y-%m-%d %H:%M:%S UTC')" && \
|
||||||
|
export PYPROJECT_NAME=$(python3 -c 'import toml; print(toml.load("pyproject.toml")["project"]["name"])') && \
|
||||||
|
export DESCRIPTION=$(python3 -c 'import toml; print(toml.load("pyproject.toml")["project"]["description"])') && \
|
||||||
|
export AUTHOR=$(python3 -c 'import toml; print(toml.load("pyproject.toml")["project"]["authors"][0]["name"])') && \
|
||||||
|
echo "⏰ Created Date: $CREATED_DATE" && \
|
||||||
|
echo "📝 Project Name: $PYPROJECT_NAME" && \
|
||||||
|
echo "📄 Description: $DESCRIPTION" && \
|
||||||
|
echo "👤 Author: $AUTHOR" && \
|
||||||
|
echo "$CREATED_DATE" > /tmp/CREATED_DATE && \
|
||||||
|
echo "$PYPROJECT_NAME" > /tmp/PYPROJECT_NAME && \
|
||||||
|
echo "$DESCRIPTION" > /tmp/DESCRIPTION && \
|
||||||
|
echo "$AUTHOR" > /tmp/AUTHOR
|
||||||
|
|
||||||
|
|
||||||
|
RUN --mount=type=bind,source=./.git/,target=/tmp/.git/ \
|
||||||
|
echo "🏷️ Checking version information..." && \
|
||||||
|
VERSION=$(git describe --tags --exact-match 2>/dev/null || git rev-parse --short HEAD || echo "unknown") && \
|
||||||
|
echo "📌 Version: $VERSION" && \
|
||||||
|
echo "$VERSION" > /tmp/VERSION
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.created="$(cat /tmp/CREATED_DATE)" \
|
||||||
|
org.opencontainers.image.authors="$(cat /tmp/AUTHOR)" \
|
||||||
|
org.opencontainers.image.description="$(cat /tmp/DESCRIPTION)" \
|
||||||
|
org.opencontainers.image.name="$(cat /tmp/PYPROJECT_NAME)" \
|
||||||
|
org.opencontainers.image.version="$(cat /tmp/VERSION)"
|
||||||
|
|
||||||
|
FROM node:20-slim AS frontend-stage
|
||||||
|
|
||||||
|
WORKDIR /tmp/admin-frontend
|
||||||
|
|
||||||
|
ENV TZ=Asia/Shanghai \
|
||||||
|
PNPM_HOME="/pnpm" \
|
||||||
|
PATH="$PNPM_HOME:$PATH"
|
||||||
|
|
||||||
|
COPY ./admin-frontend/package.json ./admin-frontend/pnpm-lock.yaml ./
|
||||||
|
|
||||||
|
RUN corepack enable && \
|
||||||
|
corepack prepare pnpm@9.15.1 --activate && \
|
||||||
|
echo "🔔 Verifying Node.js installation..." && \
|
||||||
|
if NODE_VERSION=$(node --version 2>&1); then \
|
||||||
|
echo "✅ Node.js version ${NODE_VERSION} installed successfully"; \
|
||||||
|
else \
|
||||||
|
echo "❌ Node.js installation failed" && exit 1; \
|
||||||
|
fi && \
|
||||||
|
echo "🔔 Verifying pnpm installation..." && \
|
||||||
|
if PNPM_VERSION=$(pnpm --version 2>&1); then \
|
||||||
|
echo "✅ pnpm version ${PNPM_VERSION} installed successfully"; \
|
||||||
|
else \
|
||||||
|
echo "❌ pnpm installation failed" && exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
RUN pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
COPY ./admin-frontend .
|
||||||
|
RUN mkdir -p ../nonebot_bison/admin_page/dist
|
||||||
|
|
||||||
|
RUN echo "🏗️ Starting frontend build..." && \
|
||||||
|
pnpm run build && \
|
||||||
|
echo "✅ Frontend build completed"
|
||||||
|
|
||||||
|
FROM python:3.12-slim AS playwright-stage
|
||||||
|
|
||||||
|
WORKDIR /tmp
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive \
|
||||||
|
PYTHONUNBUFFERED=1 \
|
||||||
|
TZ=Asia/Shanghai
|
||||||
|
|
||||||
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||||
|
|
||||||
|
|
||||||
|
RUN echo "📦 Installing playwright..." && \
|
||||||
|
uvx playwright install --with-deps chromium && \
|
||||||
|
echo "✅ Playwright installed successfully"
|
||||||
|
|
||||||
|
FROM python:3.12-slim AS production
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive \
|
||||||
|
UV_COMPILE_BYTECODE=1 \
|
||||||
|
UV_SYSTEM_PYTHON=true \
|
||||||
|
PYTHONUNBUFFERED=1 \
|
||||||
|
UV_LINK_MODE=copy \
|
||||||
|
TZ=Asia/Shanghai \
|
||||||
|
SHELL="/bin/bash"
|
||||||
|
|
||||||
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||||
|
RUN echo "🔔 Verifying uv installation..." && \
|
||||||
|
if UV_VERSION=$(uv --version 2>&1); then \
|
||||||
|
echo "✅ uv version ${UV_VERSION} installed successfully"; \
|
||||||
|
else \
|
||||||
|
echo "❌ uv installation failed" && exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
COPY ./pyproject.toml ./uv.lock ./
|
||||||
|
COPY ./docker.env.prod ./.env
|
||||||
|
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/ \
|
||||||
|
--mount=type=cache,target=/root/.uv \
|
||||||
|
echo "📦 Installing bison dependencies..." && \
|
||||||
|
uv pip install --extra=docker --requirement pyproject.toml --no-cache && \
|
||||||
|
echo "✅ Dependencies installed successfully" && \
|
||||||
|
echo "🔔 Cleaning up uv..." && \
|
||||||
|
rm -rf /bin/uv /bin/uvx && \
|
||||||
|
echo "✅ UV cleanup completed"
|
||||||
|
|
||||||
|
COPY --from=metadata-stage /tmp/VERSION /app/VERSION
|
||||||
|
COPY nonebot_bison/ /app/nonebot_bison/
|
||||||
|
COPY --from=frontend-stage /tmp/nonebot_bison/admin_page/dist ./nonebot_bison/admin_page/dist
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
ENV BISON_SKIP_BROWSER_CHECK=True \
|
||||||
|
BISON_USE_BROWSER=False
|
||||||
|
|
||||||
|
RUN echo '#!/bin/bash' > /app/start.sh && \
|
||||||
|
echo 'echo "📌 Current bison Version: $(cat /app/VERSION)"' >> /app/start.sh && \
|
||||||
|
echo 'echo "🚀 Starting service..."' >> /app/start.sh && \
|
||||||
|
echo 'nb run' >> /app/start.sh && \
|
||||||
|
chmod +x /app/start.sh
|
||||||
|
|
||||||
|
CMD ["/app/start.sh"]
|
||||||
@@ -9,14 +9,16 @@ from nonebot import logger, require
|
|||||||
from playwright.async_api import Cookie
|
from playwright.async_api import Cookie
|
||||||
|
|
||||||
from nonebot_bison.config.db_model import Cookie as CookieModel
|
from nonebot_bison.config.db_model import Cookie as CookieModel
|
||||||
|
from nonebot_bison.plugin_config import plugin_config
|
||||||
from nonebot_bison.utils import Site, http_client
|
from nonebot_bison.utils import Site, http_client
|
||||||
from nonebot_bison.utils.site import CookieClientManager
|
from nonebot_bison.utils.site import CookieClientManager
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .platforms import Bilibili
|
from .platforms import Bilibili
|
||||||
|
|
||||||
require("nonebot_plugin_htmlrender")
|
if plugin_config.bison_use_browser:
|
||||||
from nonebot_plugin_htmlrender import get_browser
|
require("nonebot_plugin_htmlrender")
|
||||||
|
from nonebot_plugin_htmlrender import get_browser
|
||||||
|
|
||||||
B = TypeVar("B", bound="Bilibili")
|
B = TypeVar("B", bound="Bilibili")
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import httpx
|
|||||||
from nonebot_bison.plugin_config import plugin_config
|
from nonebot_bison.plugin_config import plugin_config
|
||||||
|
|
||||||
http_args = {
|
http_args = {
|
||||||
"proxies": plugin_config.bison_proxy or None,
|
"proxy": plugin_config.bison_proxy or None,
|
||||||
}
|
}
|
||||||
http_headers = {"user-agent": plugin_config.bison_ua}
|
http_headers = {"user-agent": plugin_config.bison_ua}
|
||||||
|
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ class SiteMeta(type):
|
|||||||
elif not kwargs.get("abstract"):
|
elif not kwargs.get("abstract"):
|
||||||
# this is the subclass
|
# this is the subclass
|
||||||
if "name" in namespace:
|
if "name" in namespace:
|
||||||
site_manager[namespace["name"]] = cls
|
site_manager[namespace["name"]] = cls # type: ignore[reportArgumentType]
|
||||||
super().__init__(name, bases, namespace, **kwargs)
|
super().__init__(name, bases, namespace, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Generated
-5067
File diff suppressed because it is too large
Load Diff
+65
-69
@@ -1,13 +1,34 @@
|
|||||||
[tool.poetry]
|
[project]
|
||||||
|
authors = [{ name = "felinae98", email = "felinae225@qq.com" }]
|
||||||
|
license = { text = "MIT" }
|
||||||
|
requires-python = "<4.0.0,>=3.10"
|
||||||
|
dependencies = [
|
||||||
|
"beautifulsoup4==4.12.3",
|
||||||
|
"feedparser==6.0.11",
|
||||||
|
"httpx==0.27.2",
|
||||||
|
"nonebot2[fastapi]==2.3.3",
|
||||||
|
"nonebot-adapter-onebot==2.4.5",
|
||||||
|
"nonebot-plugin-htmlrender==0.3.5",
|
||||||
|
"nonebot-plugin-datastore==1.3.0",
|
||||||
|
"nonebot-plugin-apscheduler==0.5.0",
|
||||||
|
"nonebot-plugin-send-anything-anywhere==0.7.1",
|
||||||
|
"pillow==11.0.0",
|
||||||
|
"pyjwt==2.9.0",
|
||||||
|
"python-socketio==5.11.4",
|
||||||
|
"tinydb==4.8.0",
|
||||||
|
"qrcode==7.4.2",
|
||||||
|
"Pydantic==2.9.2",
|
||||||
|
"lxml==5.3.0",
|
||||||
|
"yarl==1.11.1",
|
||||||
|
"hishel==0.0.30",
|
||||||
|
"expiringdictx==1.1.0",
|
||||||
|
"rapidfuzz==3.9.7",
|
||||||
|
]
|
||||||
name = "nonebot-bison"
|
name = "nonebot-bison"
|
||||||
version = "0.9.5"
|
version = "0.9.5"
|
||||||
description = "Subscribe message from social medias"
|
description = "Subscribe message from social medias"
|
||||||
authors = ["felinae98 <felinae225@qq.com>"]
|
|
||||||
license = "MIT"
|
|
||||||
homepage = "https://github.com/felinae98/nonebot-bison"
|
|
||||||
keywords = ["nonebot", "nonebot2", "qqbot"]
|
keywords = ["nonebot", "nonebot2", "qqbot"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
include = ["nonebot_bison/admin_page/dist/**/*"]
|
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Development Status :: 4 - Beta",
|
"Development Status :: 4 - Beta",
|
||||||
"Operating System :: POSIX :: Linux",
|
"Operating System :: POSIX :: Linux",
|
||||||
@@ -20,69 +41,49 @@ classifiers = [
|
|||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[project.urls]
|
||||||
python = ">=3.10,<4.0.0"
|
homepage = "https://github.com/felinae98/nonebot-bison"
|
||||||
beautifulsoup4 = ">=4.12.3"
|
|
||||||
feedparser = "^6.0.11"
|
|
||||||
httpx = ">=0.27.2"
|
|
||||||
nonebot2 = { extras = ["fastapi"], version = "^2.3.3" }
|
|
||||||
nonebot-adapter-onebot = "^2.4.5"
|
|
||||||
nonebot-plugin-htmlrender = ">=0.3.5"
|
|
||||||
nonebot-plugin-datastore = ">=1.3.0,<2.0.0"
|
|
||||||
nonebot-plugin-apscheduler = ">=0.5.0"
|
|
||||||
nonebot-plugin-send-anything-anywhere = ">=0.7.1,<0.7.2"
|
|
||||||
pillow = ">=11.0.0,<11.1"
|
|
||||||
pyjwt = "^2.9.0"
|
|
||||||
python-socketio = "^5.11.4"
|
|
||||||
tinydb = "^4.8.0"
|
|
||||||
qrcode = "^7.4.2"
|
|
||||||
pydantic = ">=2.9.2,<3.0.0,!=2.5.0,!=2.5.1"
|
|
||||||
lxml = ">=5.3.0"
|
|
||||||
yarl = ">=1.11.1"
|
|
||||||
hishel = "^0.0.30"
|
|
||||||
expiringdictx = "^1.1.0"
|
|
||||||
rapidfuzz = "^3.9.7"
|
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[project.entry-points.nb_scripts]
|
||||||
ipdb = "^0.13.13"
|
|
||||||
nonemoji = "^0.1.4"
|
|
||||||
nb-cli = "^1.4.2"
|
|
||||||
pre-commit = "^4.0.1"
|
|
||||||
ruff = "^0.8.2"
|
|
||||||
|
|
||||||
[tool.poetry.group.test.dependencies]
|
|
||||||
flaky = "^3.8.1"
|
|
||||||
nonebug = "^0.3.7"
|
|
||||||
nonebug-saa = "^0.4.1"
|
|
||||||
pytest = ">=8.3.3,<9.0.0"
|
|
||||||
pytest-asyncio = ">=0.24.0,<0.24.1"
|
|
||||||
pytest-cov = ">=6.0.0,<7"
|
|
||||||
pytest-mock = "^3.14.0"
|
|
||||||
pytest-xdist = { extras = ["psutil"], version = "^3.6.1" }
|
|
||||||
respx = ">=0.21.1,<0.22"
|
|
||||||
freezegun = "^1.5.1"
|
|
||||||
|
|
||||||
[tool.poetry.group.docker]
|
|
||||||
optional = true
|
|
||||||
|
|
||||||
[tool.poetry.group.docker.dependencies]
|
|
||||||
nb-cli = "^1.4.2"
|
|
||||||
nonebot2 = { extras = ["fastapi", "aiohttp"], version = "^2.3.3" }
|
|
||||||
nonebot-adapter-red = "^0.9.0"
|
|
||||||
nonebot-adapter-qq = "^1.5.1"
|
|
||||||
poetry-core = "^1.9.0"
|
|
||||||
|
|
||||||
[tool.poetry.extras]
|
|
||||||
cli = ["anyio", "click", "typing-extensions"]
|
|
||||||
yaml = ["pyyaml"]
|
|
||||||
all = ["anyio", "click", "typing-extensions", "pyyaml"]
|
|
||||||
|
|
||||||
[tool.poetry.plugins.nb_scripts]
|
|
||||||
bison = "nonebot_bison.script.cli:main"
|
bison = "nonebot_bison.script.cli:main"
|
||||||
|
|
||||||
|
[dependency-groups]
|
||||||
|
dev = [
|
||||||
|
"ipdb==0.13.13",
|
||||||
|
"nonemoji==0.1.4",
|
||||||
|
"nb-cli==1.4.2",
|
||||||
|
"pre-commit==4.0.1",
|
||||||
|
"ruff==0.8.2",
|
||||||
|
]
|
||||||
|
test = [
|
||||||
|
"flaky==3.8.1",
|
||||||
|
"nonebug==0.3.7",
|
||||||
|
"pytz==2024.2",
|
||||||
|
"nonebug-saa==0.4.1",
|
||||||
|
"pytest==8.3.3",
|
||||||
|
"pytest-asyncio==0.24.0",
|
||||||
|
"pytest-cov==6.0.0",
|
||||||
|
"pytest-mock==3.14.0",
|
||||||
|
"pytest-xdist[psutil]==3.6.1",
|
||||||
|
"respx==0.21.1",
|
||||||
|
"freezegun==1.5.1",
|
||||||
|
]
|
||||||
|
|
||||||
|
[project.optional-dependencies]
|
||||||
|
docker = [
|
||||||
|
"nb-cli==1.4.2",
|
||||||
|
"nonebot2[aiohttp,fastapi]==2.3.3",
|
||||||
|
"nonebot-adapter-red==0.9.0",
|
||||||
|
"nonebot-adapter-qq==1.5.1",
|
||||||
|
"poetry-core==1.9.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.uv]
|
||||||
|
default-groups = ["dev", "test"]
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core>=1.9.0"]
|
requires = ["pdm-backend"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "pdm.backend"
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
markers = [
|
markers = [
|
||||||
@@ -157,8 +158,3 @@ executionEnvironments = [
|
|||||||
{ root = "./" },
|
{ root = "./" },
|
||||||
]
|
]
|
||||||
defineConstant = { PYDANTIC_V2 = true }
|
defineConstant = { PYDANTIC_V2 = true }
|
||||||
|
|
||||||
[[tool.poetry.source]]
|
|
||||||
name = "offical-source"
|
|
||||||
url = "https://pypi.org/simple/"
|
|
||||||
priority = "primary"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user