🔧 Change dependency tool to pdm

This commit is contained in:
omg-xtao 2024-06-04 19:35:23 +08:00 committed by GitHub
parent 2092f0274e
commit ad484294d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 2985 additions and 76 deletions

View File

@ -5,8 +5,7 @@
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bookworm", "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bookworm",
"features": { "features": {
"ghcr.io/devcontainers-contrib/features/pdm:2": {}, "ghcr.io/devcontainers-contrib/features/pdm:2": {}
"ghcr.io/devcontainers-contrib/features/poetry:2": {}
}, },
// Features to add to the dev container. More info: https://containers.dev/features. // Features to add to the dev container. More info: https://containers.dev/features.
@ -16,7 +15,7 @@
// "forwardPorts": [], // "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created. // Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "poetry install --extras all" "postCreateCommand": "pdm install"
// Configure tool-specific properties. // Configure tool-specific properties.
// "customizations": {}, // "customizations": {},

2
.gitignore vendored
View File

@ -26,7 +26,7 @@ share/python-wheels/
.installed.cfg .installed.cfg
*.egg *.egg
MANIFEST MANIFEST
poetry.lock .pdm-python
# PyInstaller # PyInstaller
# Usually these files are written by a python script from a template # Usually these files are written by a python script from a template

View File

@ -10,14 +10,13 @@ RUN echo "deb http://ftp.us.debian.org/debian bookworm main non-free" >> /etc/ap
&& apt install git wget curl ffmpeg -y \ && apt install git wget curl ffmpeg -y \
&& git clone -b main --recursive https://github.com/PaiGramTeam/PaiGram.git /app \ && git clone -b main --recursive https://github.com/PaiGramTeam/PaiGram.git /app \
# install dependencies \ # install dependencies \
&& pip install virtualenv poetry \ && pip install virtualenv pdm \
&& python3 -m virtualenv venv/ \ && python3 -m virtualenv venv/ \
&& . venv/bin/activate \ && . venv/bin/activate \
&& poetry config virtualenvs.create false \ && pdm config python.use_venv false \
&& poetry source add --default mirrors https://pypi.tuna.tsinghua.edu.cn/simple/ \ && pdm config pypi.url https://pypi.tuna.tsinghua.edu.cn/simple/ \
&& poetry source add --secondary mirrors https://mirrors.aliyun.com/pypi/simple \ && pdm install \
&& poetry install \ && pdm install -G :all \
&& poetry install --extras all \
&& playwright install chromium \ && playwright install chromium \
&& playwright install-deps chromium \ && playwright install-deps chromium \
## set timezone ## set timezone
@ -33,6 +32,7 @@ RUN echo "deb http://ftp.us.debian.org/debian bookworm main non-free" >> /etc/ap
/var/tmp/* \ /var/tmp/* \
~/.cache/pip \ ~/.cache/pip \
~/.cache/pypoetry \ ~/.cache/pypoetry \
~/.cache/pdm \
# Add the wait script to the image # Add the wait script to the image
&& wget -O /wait https://github.com/ufoscout/docker-compose-wait/releases/download/2.12.1/wait \ && wget -O /wait https://github.com/ufoscout/docker-compose-wait/releases/download/2.12.1/wait \
&& chmod +x /wait && chmod +x /wait

View File

@ -74,15 +74,15 @@ venv\Scripts\activate.bat
**Install Dependencies:** **Install Dependencies:**
```bash ```bash
pip install poetry pip install pdm
poetry install --extras all pdm install
playwright install chromium playwright install chromium
``` ```
Optional Dependencies Optional Dependencies
```bash ```bash
poetry install --extras all pdm install -G :all
``` ```
**Edit Config:** **Edit Config:**

View File

@ -72,15 +72,15 @@ venv\Scripts\activate.bat
**安装依赖:** **安装依赖:**
```bash ```bash
pip install poetry pip install pdm
poetry install --extras all pdm install
playwright install chromium playwright install chromium
``` ```
可选依赖 可选依赖
```bash ```bash
poetry install --extras all pdm install -G :all
``` ```
**编辑配置文件:** **编辑配置文件:**

View File

@ -68,10 +68,10 @@
``` ```
- Install pip dependencies - Install pip dependencies
``` ```
(venv) ~/PaiGram $ pip install poetry (venv) ~/PaiGram $ pip install pdm
Collecting poetry Collecting pdm
... ...
(venv) ~/PaiGram $ poetry install --extras all (venv) ~/PaiGram $ pdm install
Installing dependencies from lock file Installing dependencies from lock file
Package operations: 88 installs, 3 updates, 0 removals Package operations: 88 installs, 3 updates, 0 removals
... ...

View File

@ -69,10 +69,10 @@
``` ```
- 安装依赖 - 安装依赖
``` ```
(venv) ~/PaiGram $ pip install poetry (venv) ~/PaiGram $ pip install pdm
Collecting poetry Collecting pdm
... ...
(venv) ~/PaiGram $ poetry install --extras all (venv) ~/PaiGram $ pdm install
Installing dependencies from lock file Installing dependencies from lock file
Package operations: 88 installs, 3 updates, 0 removals Package operations: 88 installs, 3 updates, 0 removals
... ...

2798
pdm.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -59,7 +59,7 @@ class UpdatePlugin(Plugin):
await execute("git pull --all") await execute("git pull --all")
await execute("git submodule update") await execute("git submodule update")
if len(args) > 1: if len(args) > 1:
await execute(f"{executable} -m poetry install --extras all") await execute(f"{executable} -m pdm install")
logger.info("更新成功 正在重启") logger.info("更新成功 正在重启")
await reply_text.edit_text("更新成功 正在重启") await reply_text.edit_text("更新成功 正在重启")
async with async_open(UPDATE_DATA, mode="w", encoding="utf-8") as file: async with async_open(UPDATE_DATA, mode="w", encoding="utf-8") as file:

View File

@ -1,64 +1,66 @@
[tool.poetry] [project]
name = "PaiGram" name = "PaiGram"
version = "0.4.0" version = "0.4.0"
description = "Telegarm robot, query the official genshin information." description = "Telegarm robot, query the official genshin information."
authors = ["洛水居室", "zhxy-CN", "Chuangbo Li", "kotoriのねこ", "omg-xtao", "艾迪", "Karako", "SiHuaN"] authors = [
license = "AGPL-3.0" {name = "洛水居室"},
{name = "zhxy-CN"},
{name = "Chuangbo Li"},
{name = "kotoriのねこ"},
{name = "omg-xtao"},
{name = "艾迪"},
{name = "Karako"},
{name = "SiHuaN"},
]
dependencies = [
"httpx<1.0.0,>=0.25.0",
"ujson<6.0.0,>=5.9.0",
"Jinja2<4.0.0,>=3.1.2",
"python-telegram-bot[ext,rate-limiter]<21.0,>=20.7",
"sqlmodel<1.0.0,>=0.0.16",
"colorlog<7.0.0,>=6.8.0",
"fakeredis<3.0.0,>=2.19.0",
"redis<6.0.0,>=5.0.1",
"beautifulsoup4<5.0.0,>=4.12.1",
"asyncmy<1.0.0,>=0.2.9",
"aiofiles<24.0.0,>=23.2.1",
"python-dotenv<2.0.0,>=1.0.0",
"alembic<2.0.0,>=1.13.0",
"black<25.0.0,>=24.1.1",
"rich<14.0.0,>=13.6.0",
"enkanetwork-py @ git+https://github.com/PaiGramTeam/EnkaNetwork.py",
"lxml<6.0.0,>=5.0.0",
"arko-wrapper<1.0.0,>=0.2.8",
"fastapi<1.0.0,>=0.110.0",
"uvicorn[standard]<1.0.0,>=0.28.0",
"sentry-sdk<2.0.0,>=1.31.0",
"GitPython<4.0.0,>=3.1.30",
"openpyxl<4.0.0,>=3.1.1",
"async-lru<3.0.0,>=2.0.4",
"thefuzz<1.0.0,>=0.22.1",
"cryptography<43.0.0,>=42.0.2",
"pillow<11.0.0,>=10.0.1",
"playwright==1.39.0",
"aiosqlite[sqlite]<1.0.0,>=0.20.0",
"simnet @ git+https://github.com/PaiGramTeam/SIMNet",
"gcsim-pypi<3.0.0.0,>=2.8.2.10",
"psutil<6.0.0,>=5.9.6",
]
requires-python = "<4.0,>=3.8"
readme = "README.md" readme = "README.md"
license = {text = "AGPL-3.0"}
[tool.poetry.dependencies] [project.optional-dependencies]
python = "^3.8" pyro = ["TgCrypto<2.0.0,>=1.2.5", "Pyrogram<3.0.0,>=2.0.102"]
httpx = "^0.25.0" test = ["pytest<8.0.0,>=7.3.0", "pytest-asyncio<1.0.0,>=0.23.2", "flaky<4.0.0,>=3.7.0"]
ujson = "^5.9.0" genshin-artifact = ["python-genshin-artifact<2.0.0,>=1.0.4"]
Jinja2 = "^3.1.2"
python-telegram-bot = { version = "^20.7", extras = ["ext", "rate-limiter"] }
sqlmodel = "^0.0.16"
colorlog = "^6.8.0"
fakeredis = "^2.19.0"
redis = "^5.0.1"
beautifulsoup4 = "^4.12.1"
asyncmy = "^0.2.9"
aiofiles = "^23.2.1"
python-dotenv = "^1.0.0"
alembic = "^1.13.0"
black = "^24.1.1"
rich = "^13.6.0"
enkanetwork-py = { git = "https://github.com/mrwan200/EnkaNetwork.py" }
TgCrypto = { version = "^1.2.5", optional = true }
Pyrogram = { version = "^2.0.102", optional = true }
pytest = { version = "^7.3.0", optional = true }
pytest-asyncio = { version = "^0.23.2", optional = true }
flaky = { version = "^3.7.0", optional = true }
lxml = "^5.0.0"
arko-wrapper = "^0.2.8"
fastapi = "^0.110.0"
uvicorn = { extras = ["standard"], version = "^0.28.0" }
sentry-sdk = "^1.31.0"
GitPython = "^3.1.30"
openpyxl = "^3.1.1"
async-lru = "^2.0.4"
thefuzz = "^0.22.1"
cryptography = "^42.0.2"
pillow = "^10.0.1"
playwright = "1.39.0"
aiosqlite = { extras = ["sqlite"], version = "^0.20.0" }
simnet = { git = "https://github.com/PaiGramTeam/SIMNet" }
gcsim-pypi = "^2.8.2.10"
python-genshin-artifact = { version = "^1.0.4", optional = true }
psutil = "^5.9.6"
[tool.poetry.extras] [tool.pdm]
genshin-artifact = ["python-genshin-artifact"] distribution = false
pyro = ["Pyrogram", "TgCrypto"]
test = ["pytest", "pytest-asyncio", "flaky"]
sqlite = ["aiosqlite"]
all = ["pytest", "pytest-asyncio", "flaky", "Pyrogram", "TgCrypto", "aiosqlite", "python-genshin-artifact"]
[build-system] [tool.pdm.build]
requires = ["poetry-core"] includes = []
build-backend = "poetry.core.masonry.api"
# pytest配置
[tool.pytest.ini_options] [tool.pytest.ini_options]
asyncio_mode = "auto" asyncio_mode = "auto"
log_cli = true log_cli = true

110
requirements.txt Normal file
View File

@ -0,0 +1,110 @@
# This file is @generated by PDM.
# Please do not edit it manually.
aiofiles==23.2.1
aiohttp==3.9.5
aiolimiter==1.1.0
aiosignal==1.3.1
aiosqlite==0.20.0
alembic==1.13.1
anyio==4.4.0
apscheduler==3.10.4
arko-wrapper==0.2.8
async-lru==2.0.4
async-timeout==4.0.3; python_full_version < "3.11.3"
asyncmy==0.2.9
attrs==23.2.0
backports-zoneinfo==0.2.1; python_version < "3.9"
beautifulsoup4==4.12.3
black==24.4.2
cachetools==5.3.3
certifi==2024.6.2
cffi==1.16.0; platform_python_implementation != "PyPy"
click==8.1.7
colorama==0.4.6; sys_platform == "win32" or platform_system == "Windows"
colorlog==6.8.2
cryptography==42.0.7
dnspython==2.6.1
email-validator==2.1.1
enkanetwork-py @ git+https://github.com/PaiGramTeam/EnkaNetwork.py@71de88274d8bf11e1d91fd7782c7cdafb9bbd325
et-xmlfile==1.1.0
exceptiongroup==1.2.1; python_version < "3.11"
fakeredis==2.23.2
fastapi==0.111.0
fastapi-cli==0.0.4
flaky==3.8.1
frozenlist==1.4.1
gcsim-pypi==2.22.23
gitdb==4.0.11
gitpython==3.1.43
greenlet==3.0.0
h11==0.14.0
httpcore==1.0.5
httptools==0.6.1
httpx==0.26.0
idna==3.7
importlib-metadata==7.1.0; python_version < "3.9"
importlib-resources==6.4.0; python_version < "3.9"
iniconfig==2.0.0
jinja2==3.1.4
lxml==5.2.2
mako==1.3.5
markdown-it-py==3.0.0
markupsafe==2.1.5
mdurl==0.1.2
multidict==6.0.5
mypy-extensions==1.0.0
openpyxl==3.1.3
orjson==3.10.3
packaging==24.0
pathspec==0.12.1
pillow==10.3.0
platformdirs==4.2.2
playwright==1.39.0
pluggy==1.5.0
psutil==5.9.8
pyaes==1.6.1
pycparser==2.22; platform_python_implementation != "PyPy"
pydantic==1.10.15
pyee==11.0.1
pygments==2.18.0
pyrogram==2.0.106
pysocks==1.7.1
pytest==7.4.4
pytest-asyncio==0.23.7
python-dotenv==1.0.1
python-genshin-artifact==1.0.7
python-multipart==0.0.9
python-telegram-bot==20.8
pytz==2024.1
pyyaml==6.0.1
rapidfuzz==3.9.3
redis==5.0.4
rich==13.7.1
sentry-sdk==1.45.0
shellingham==1.5.4
simnet @ git+https://github.com/PaiGramTeam/SIMNet@5c02e769820f005a9b81ca954bd454b521acca4b
six==1.16.0
smmap==5.0.1
sniffio==1.3.1
sortedcontainers==2.4.0
soupsieve==2.5
sqlalchemy==2.0.30
sqlmodel==0.0.18
starlette==0.37.2
tgcrypto==1.2.5
thefuzz==0.22.1
tomli==2.0.1; python_version < "3.11"
tornado==6.4
typer==0.12.3
typing-extensions==4.12.1
tzdata==2024.1; platform_system == "Windows"
tzlocal==5.2
ujson==5.10.0
urllib3==2.2.1; python_version >= "3.6"
uvicorn==0.30.0
uvloop==0.19.0; (sys_platform != "cygwin" and sys_platform != "win32") and platform_python_implementation != "PyPy"
watchfiles==0.22.0
websockets==12.0
yarl==1.9.4
zipp==3.19.1; python_version < "3.9"