feat: Add Docker support, GitHub Actions CI, and an MIT License, updating READMEs with deployment instructions and badges.
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
name: Python application CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["main"]
|
||||||
|
pull_request:
|
||||||
|
branches: ["main"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python 3.11
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.11"
|
||||||
|
cache: "pip"
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install ruff
|
||||||
|
# 如果需要测试,也可以考虑在这里安装 requirements.txt: pip install -r requirements.txt
|
||||||
|
|
||||||
|
- name: Lint with Ruff
|
||||||
|
run: |
|
||||||
|
# 检查代码错误 (如未定义变量, 未使用引入等)
|
||||||
|
# --output-format=github 可以在 PR 中直接以 annotations 的形式显示错误
|
||||||
|
ruff check . --output-format=github
|
||||||
|
|
||||||
|
- name: Check code formatting with Ruff
|
||||||
|
run: |
|
||||||
|
# 检查代码格式是否规范 (如果不规范,Actions 会提示报错)
|
||||||
|
ruff format --check .
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
FROM python:3.11-slim
|
||||||
|
|
||||||
|
# 设置工作目录
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# 设置环境变量
|
||||||
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PYTHONUNBUFFERED=1 \
|
||||||
|
TZ=UTC
|
||||||
|
|
||||||
|
# 安装系统依赖 (如果有必要的包可以取消注释)
|
||||||
|
# RUN apt-get update && apt-get install -y --no-install-recommends gcc && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# 复制 requirements 文件
|
||||||
|
COPY requirements.txt .
|
||||||
|
|
||||||
|
# 安装 Python 依赖
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# 复制项目代码
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# 启动机器人
|
||||||
|
CMD ["python", "bot_listener.py"]
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 Yuanzhen Yang (yangyuan-zhen)
|
||||||
|
|
||||||
|
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.
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
# 🌡️ PolyWeather: Intelligent Weather Quant Analysis Bot
|
# 🌡️ PolyWeather: Intelligent Weather Quant Analysis Bot
|
||||||
|
|
||||||
|
[](https://github.com/yangyuan-zhen/PolyWeather/actions/workflows/python-app.yml)
|
||||||
|
[](https://www.python.org/downloads/)
|
||||||
|
[](https://opensource.org/licenses/MIT)
|
||||||
[](https://deepwiki.com/yangyuan-zhen/PolyWeather)
|
[](https://deepwiki.com/yangyuan-zhen/PolyWeather)
|
||||||
|
|
||||||
PolyWeather is a weather analysis tool built for prediction markets like **Polymarket**. It aggregates multi-source forecasts, real-time airport METAR observations, a math-based probability engine, and AI-driven decision support to help users evaluate weather trading risks more scientifically.
|
PolyWeather is a weather analysis tool built for prediction markets like **Polymarket**. It aggregates multi-source forecasts, real-time airport METAR observations, a math-based probability engine, and AI-driven decision support to help users evaluate weather trading risks more scientifically.
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
@@ -74,15 +76,35 @@ Feeds all weather data into LLaMA 70B, analyzed via a **P1→P4 Priority Chain**
|
|||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
||||||
- **Python 3.11+**
|
- **Python 3.11+** or **Docker & Docker Compose**
|
||||||
- Install dependencies: `pip install -r requirements.txt`
|
- **Environment Variables**: Set parameters in your `.env` file (copy from `.env.example`).
|
||||||
- **Environment Variables**: Set `TELEGRAM_BOT_TOKEN` and `GROQ_API_KEY` in your `.env` file.
|
|
||||||
|
|
||||||
### VPS Quick Deployment
|
### 🐳 Docker Deployment (Recommended)
|
||||||
|
|
||||||
1. Clone the repository and install dependencies.
|
The easiest and most stable way to deploy without system dependency conflicts.
|
||||||
|
|
||||||
|
1. **Clone and configure**
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/yangyuan-zhen/PolyWeather.git
|
||||||
|
cd PolyWeather
|
||||||
|
cp .env.example .env
|
||||||
|
# Edit .env to add TELEGRAM_BOT_TOKEN, GROQ_API_KEY, etc.
|
||||||
|
nano .env
|
||||||
|
```
|
||||||
|
2. **Start the service in the background**
|
||||||
|
```bash
|
||||||
|
docker-compose up -d --build
|
||||||
|
```
|
||||||
|
3. **View live logs**
|
||||||
|
```bash
|
||||||
|
docker-compose logs -f
|
||||||
|
```
|
||||||
|
|
||||||
|
### 💻 Traditional VPS Deployment
|
||||||
|
|
||||||
|
1. Install dependencies: `pip install -r requirements.txt`
|
||||||
2. Configure your `.env` file.
|
2. Configure your `.env` file.
|
||||||
3. Use the following script for one-click updates and restarts:
|
3. Use the following script for one-click updates and restarts (for `nohup` background run):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cat > ~/update.sh << 'EOF'
|
cat > ~/update.sh << 'EOF'
|
||||||
|
|||||||
+29
-7
@@ -1,7 +1,9 @@
|
|||||||
# 🌡️ PolyWeather: 智能天气量化分析机器人
|
# 🌡️ PolyWeather: 智能天气量化分析机器人
|
||||||
|
|
||||||
|
[](https://github.com/yangyuan-zhen/PolyWeather/actions/workflows/python-app.yml)
|
||||||
|
[](https://www.python.org/downloads/)
|
||||||
|
[](https://opensource.org/licenses/MIT)
|
||||||
[](https://deepwiki.com/yangyuan-zhen/PolyWeather)
|
[](https://deepwiki.com/yangyuan-zhen/PolyWeather)
|
||||||
|
|
||||||
PolyWeather 是一款专为 **Polymarket** 等预测市场打造的天气分析工具。它通过聚合多源气象预报、实时机场 METAR 观测,并引入数学概率模型与 AI 决策支持,帮助用户更科学地评估天气博弈风险。
|
PolyWeather 是一款专为 **Polymarket** 等预测市场打造的天气分析工具。它通过聚合多源气象预报、实时机场 METAR 观测,并引入数学概率模型与 AI 决策支持,帮助用户更科学地评估天气博弈风险。
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
@@ -74,15 +76,35 @@ PolyWeather 是一款专为 **Polymarket** 等预测市场打造的天气分析
|
|||||||
|
|
||||||
### 环境要求
|
### 环境要求
|
||||||
|
|
||||||
- **Python 3.11+**
|
- **Python 3.11+** 或 **Docker & Docker Compose**
|
||||||
- 依赖安装: `pip install -r requirements.txt`
|
- **环境变量**: 在 `.env` 中设置关键参数(参考 `.env.example`)。
|
||||||
- **环境变量**: 在 `.env` 中设置 `TELEGRAM_BOT_TOKEN` 和 `GROQ_API_KEY`。
|
|
||||||
|
|
||||||
### VPS 快捷部署
|
### 🐳 Docker 推荐部署 (推荐)
|
||||||
|
|
||||||
1. 克隆仓库并安装依赖。
|
最简单、稳定的部署方式,避免系统依赖冲突。
|
||||||
|
|
||||||
|
1. **克隆项目并配置环境**
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/yangyuan-zhen/PolyWeather.git
|
||||||
|
cd PolyWeather
|
||||||
|
cp .env.example .env
|
||||||
|
# 编辑 .env 文件填入 TELEGRAM_BOT_TOKEN 和 GROQ_API_KEY 等
|
||||||
|
nano .env
|
||||||
|
```
|
||||||
|
2. **后台一键启动服务**
|
||||||
|
```bash
|
||||||
|
docker-compose up -d --build
|
||||||
|
```
|
||||||
|
3. **查看实时日志**
|
||||||
|
```bash
|
||||||
|
docker-compose logs -f
|
||||||
|
```
|
||||||
|
|
||||||
|
### 💻 传统 VPS 部署方案
|
||||||
|
|
||||||
|
1. 安装依赖: `pip install -r requirements.txt`
|
||||||
2. 配置 `.env` 文件。
|
2. 配置 `.env` 文件。
|
||||||
3. 使用以下脚本实现一键更新与重启:
|
3. 使用以下脚本实现一键更新与重启(仅适用于后台 `nohup` 运行):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cat > ~/update.sh << 'EOF'
|
cat > ~/update.sh << 'EOF'
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
polyweather:
|
||||||
|
build: .
|
||||||
|
container_name: polyweather_bot
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
volumes:
|
||||||
|
- ./data:/app/data # 挂载数据目录,确保历史数据持久化
|
||||||
|
- ./bot.log:/app/bot.log # 挂载日志文件
|
||||||
|
user: "${UID:-1000}:${GID:-1000}"
|
||||||
Reference in New Issue
Block a user