mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-16 03:55:26 +00:00
🔧 Change pdm to uv
This commit is contained in:
parent
c69df5eb50
commit
e1becdf3da
15
Dockerfile
15
Dockerfile
@ -10,13 +10,10 @@ RUN echo "deb http://ftp.us.debian.org/debian bookworm main non-free" >> /etc/ap
|
||||
&& apt install git wget curl ffmpeg -y \
|
||||
&& git clone -b sr --recursive https://github.com/PaiGramTeam/PamGram.git /app \
|
||||
# install dependencies \
|
||||
&& pip install virtualenv pdm \
|
||||
&& python3 -m virtualenv venv/ \
|
||||
&& . venv/bin/activate \
|
||||
&& pdm use -f venv \
|
||||
&& pdm config pypi.url https://pypi.tuna.tsinghua.edu.cn/simple/ \
|
||||
&& pdm install \
|
||||
&& pdm install -G :all \
|
||||
&& pip install virtualenv uv \
|
||||
&& python3 -m uv venv .venv \
|
||||
&& . .venv/bin/activate \
|
||||
&& uv sync --all-extras \
|
||||
&& playwright install chromium \
|
||||
&& playwright install-deps chromium \
|
||||
## set timezone
|
||||
@ -31,8 +28,8 @@ RUN echo "deb http://ftp.us.debian.org/debian bookworm main non-free" >> /etc/ap
|
||||
/var/lib/apt/lists/* \
|
||||
/var/tmp/* \
|
||||
~/.cache/pip \
|
||||
~/.cache/pypoetry \
|
||||
~/.cache/uv \
|
||||
# Add the wait script to the image
|
||||
&& wget -O /wait https://github.com/ufoscout/docker-compose-wait/releases/download/2.12.1/wait \
|
||||
&& chmod +x /wait
|
||||
ENTRYPOINT /wait && venv/bin/alembic upgrade head && venv/bin/python run.py
|
||||
ENTRYPOINT /wait && .venv/bin/alembic upgrade head && .venv/bin/python run.py
|
||||
|
115
README.md
115
README.md
@ -9,84 +9,129 @@
|
||||
|
||||
<p>
|
||||
<img src="https://user-images.githubusercontent.com/70872201/190447002-119a8819-b111-4a96-a0b3-701c5e256137.png" align="right" width="100px" alt="">
|
||||
<h2 align="left">简介</h2>
|
||||
<h2 align="left">Introduction</h2>
|
||||
|
||||
基于 [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot) 的 PaiGram
|
||||
PaiGram based on [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot)
|
||||
|
||||
![Alt](https://repobeats.axiom.co/api/embed/f73c1121006cb86196f83da2170242b7a97f8be0.svg "Repobeats analytics image")
|
||||
|
||||
## 环境需求
|
||||
[中文文档](/docs/README_ZH.md)
|
||||
|
||||
## System Dependencies
|
||||
|
||||
- Python 3.11+
|
||||
- MySQL or SQLite
|
||||
- Redis
|
||||
|
||||
## 使用方法
|
||||
## Usage
|
||||
|
||||
### 1. 安装 `poetry`
|
||||
Depending on your preferred environment, follow one of the setups below:
|
||||
|
||||
### WSL2 Ubuntu 22.04 Setup
|
||||
|
||||
For contributors using WSL2 on Ubuntu 22.04, follow the [detailed guide here](/docs/wsl/EN.md).
|
||||
|
||||
### Standard Setup (All Environments)
|
||||
|
||||
#### 1. Clone PaiGram from Git
|
||||
|
||||
```bash
|
||||
pip install --upgrade poetry
|
||||
git clone git@github.com:PaiGramTeam/PaiGram.git
|
||||
cd PaiGram/
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
### 2. 安装依赖
|
||||
#### 2. Project Setup
|
||||
|
||||
It's recommended to use a virtual environment. You can set it up via `venv` or `virtualenv`.
|
||||
|
||||
**Create Virtual environment:**
|
||||
|
||||
```bash
|
||||
poetry install
|
||||
poetry run playwright install chromium
|
||||
python3 -m venv venv
|
||||
```
|
||||
|
||||
**Activate the virtual environment:**
|
||||
|
||||
*For Linux:*
|
||||
|
||||
```bash
|
||||
pip install git+https://github.com/PaiGramTeam/genshin.py@sr
|
||||
source venv/bin/activate
|
||||
```
|
||||
|
||||
#### 可选依赖项
|
||||
*For Windows Command Prompt:*
|
||||
|
||||
```bash
|
||||
poetry install --extras pyro
|
||||
venv\Scripts\activate.bat
|
||||
```
|
||||
|
||||
### 3. 修改配置
|
||||
*For Windows PowerShell:*
|
||||
|
||||
创建 `.env` 文件并填写数据库连接和 bot token 等参数。
|
||||
```bash
|
||||
.\venv\Scripts\Activate.ps1
|
||||
```
|
||||
|
||||
**Install Dependencies:**
|
||||
|
||||
```bash
|
||||
pip install uv
|
||||
uv sync
|
||||
playwright install chromium
|
||||
```
|
||||
|
||||
Optional Dependencies
|
||||
|
||||
```bash
|
||||
uv sync --all-extras
|
||||
```
|
||||
|
||||
**Edit Config:**
|
||||
|
||||
Create a dotenv config (`.env`) based on the given example. Ensure to provide the necessary database connection
|
||||
details and bot token parameters.
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
详细配置说明见 [Wiki/Env Settings](https://github.com/PaiGramTeam/PaiGram/wiki/Env-Settings)
|
||||
For detailed configurations, refer to the [Wiki/Env Settings](https://github.com/PaiGramTeam/PaiGram/wiki/Env-Settings).
|
||||
|
||||
### 4. 初始化数据库
|
||||
#### 3. Database Setup with Alembic
|
||||
|
||||
```bash
|
||||
poetry run alembic upgrade head
|
||||
alembic upgrade head
|
||||
```
|
||||
|
||||
### 5. 运行
|
||||
#### 4. Run PaiGram
|
||||
|
||||
Ensure the `venv` is still active:
|
||||
|
||||
```bash
|
||||
poetry run python ./run.py
|
||||
python ./run.py
|
||||
```
|
||||
|
||||
## 使用 Docker 部署
|
||||
### Alternative Deployments
|
||||
|
||||
详见 [Wiki/Deploy with Docker](https://github.com/PaiGramTeam/PaiGram/wiki/Deploy-with-Docker)
|
||||
- **Docker:** For deployments using Docker, see
|
||||
the [Wiki/Deploy with Docker](https://github.com/PaiGramTeam/PaiGram/wiki/Deploy-with-Docker).
|
||||
|
||||
## 使用 Podman 部署
|
||||
- **Podman:** For deployments using Podman, see
|
||||
the [Wiki/Deploy with Podman](https://github.com/PaiGramTeam/PaiGram/wiki/Deploy-with-Podman).
|
||||
|
||||
详见 [Wiki/Deploy with Podman](https://github.com/PaiGramTeam/PaiGram/wiki/Deploy-with-Podman)
|
||||
## Additional Information
|
||||
|
||||
## 其他说明
|
||||
This project is currently being expanded,
|
||||
adding more entertainment and information query features related to Genshin Impact.
|
||||
Stay tuned!
|
||||
|
||||
这个项目目前正在扩展,加入更多原神相关娱乐和信息查询功能,敬请期待。
|
||||
## Acknowledgments
|
||||
|
||||
## Thanks
|
||||
|
||||
| Nickname | Introduce |
|
||||
| :---------------------------------------------------------------------------: | -------------------------------- |
|
||||
| [原神抽卡全机制总结](https://www.bilibili.com/read/cv10468091) | 本项目抽卡模拟器使用的逻辑 |
|
||||
| [西风驿站 猫冬](https://bbs.mihoyo.com/ys/accountCenter/postList?id=74019947) | 本项目攻略图图源 |
|
||||
| [Yunzai-Bot](https://github.com/Le-niao/Yunzai-Bot) | 本项使用的抽卡图片和前端资源来源 |
|
||||
| [Crawler-ghhw](https://github.com/DGP-Studio/Crawler-ghhw) | 本项目参考的爬虫代码 |
|
||||
| [Enka.Network](https://enka.network) | 角色卡片的数据来源 |
|
||||
| [miao-plugin](https://github.com/yoimiya-kokomi/miao-plugin) | 角色卡片的参考项目 |
|
||||
| Nickname | Introduce |
|
||||
|:-----------------------------------------------------------------------:|------------------|
|
||||
| [原神抽卡全机制总结](https://www.bilibili.com/read/cv10468091) | 本项目抽卡模拟器使用的逻辑 |
|
||||
| [西风驿站 猫冬](https://bbs.mihoyo.com/ys/accountCenter/postList?id=74019947) | 本项目攻略图图源 |
|
||||
| [Yunzai-Bot](https://github.com/Le-niao/Yunzai-Bot) | 本项使用的抽卡图片和前端资源来源 |
|
||||
| [Crawler-ghhw](https://github.com/DGP-Studio/Crawler-ghhw) | 本项目参考的爬虫代码 |
|
||||
| [Enka.Network](https://enka.network) | 角色卡片的数据来源 |
|
||||
| [miao-plugin](https://github.com/yoimiya-kokomi/miao-plugin) | 角色卡片的参考项目 |
|
||||
| [DGP HuTao API](https://hut.ao/en/) | 深渊数据来源 |
|
||||
|
@ -59,7 +59,7 @@ class UpdatePlugin(Plugin):
|
||||
await execute("git pull --all")
|
||||
await execute("git submodule update")
|
||||
if len(args) > 1:
|
||||
await execute(f"{executable} -m pdm install")
|
||||
await execute("uv sync --all-extras")
|
||||
logger.info("更新成功 正在重启")
|
||||
await reply_text.edit_text("更新成功 正在重启")
|
||||
async with async_open(UPDATE_DATA, mode="w", encoding="utf-8") as file:
|
||||
|
Loading…
Reference in New Issue
Block a user