Metadata-Version: 2.4
Name: algoflow
Version: 0.1.0
Summary: A FastAPI-based algorithm flow management system with Tortoise ORM and Aerich for database migrations
Project-URL: Homepage, https://github.com/chenxingyuu/AlgoFlow
Project-URL: Repository, https://github.com/chenxingyuu/AlgoFlow
Project-URL: Documentation, https://github.com/chenxingyuu/AlgoFlow#readme
Project-URL: Bug Tracker, https://github.com/chenxingyuu/AlgoFlow/issues
Author-email: Chen Xingyu <chenxingyu@ndnu.edu.cn>
License: MIT
License-File: LICENSE
Keywords: aerich,algorithm,fastapi,tortoise-orm,workflow
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.12.9
Requires-Dist: aerich==0.7.2
Requires-Dist: aiomysql==0.2.0
Requires-Dist: bcrypt==3.1.7
Requires-Dist: build>=1.2.2.post1
Requires-Dist: cryptography==44.0.1
Requires-Dist: email-validator==2.2.0
Requires-Dist: fastapi-socketio==0.0.10
Requires-Dist: fastapi~=0.108.0
Requires-Dist: ghkit==0.0.4
Requires-Dist: httpx~=0.27.2
Requires-Dist: minio==7.2.15
Requires-Dist: nacos-sdk-python~=2.0.6
Requires-Dist: passlib==1.7.4
Requires-Dist: pre-commit==3.5.0
Requires-Dist: pydantic~=2.11.5
Requires-Dist: pymysql==1.1.1
Requires-Dist: pytest-asyncio==0.26.0
Requires-Dist: pytest-cov==6.1.1
Requires-Dist: pytest==8.3.5
Requires-Dist: python-jose==3.4.0
Requires-Dist: python-multipart==0.0.19
Requires-Dist: python-socketio==5.11.4
Requires-Dist: redis==5.2.0
Requires-Dist: requests==2.32.3
Requires-Dist: rq==2.1.0
Requires-Dist: schedule~=1.2.2
Requires-Dist: starlette~=0.32.0.post1
Requires-Dist: tortoise-orm==0.21.5
Requires-Dist: twine>=6.1.0
Requires-Dist: uvicorn==0.30.1
Requires-Dist: websockets~=13.1
Provides-Extra: dev
Requires-Dist: pre-commit>=3.5.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.26.0; extra == 'dev'
Requires-Dist: pytest-cov>=6.1.1; extra == 'dev'
Requires-Dist: pytest>=8.3.5; extra == 'dev'
Description-Content-Type: text/markdown

# FastAPI 模板

一个用于构建 FastAPI 应用程序的模板项目，包含 Tortoise ORM 和 Aerich 用于数据库迁移。

## 特性

- FastAPI、Tortoise ORM、Aerich 和 Pydantic 构建
- Docker Compose 快速部署
- Github Actions CI/CD

## 使用

### 安装

1. **克隆仓库：**

    ```bash
    git clone https://github.com/chenxingyuu/fastapi_template.git
    cd fastapi-template
    ```

2. **创建并激活虚拟环境：**

    ```bash
    python -m venv venv
    source venv/bin/activate  # 在 Windows 上使用 `venv\Scripts\activate`
    ```

3. **安装依赖项：**

    ```bash
    pip install -r requirements.txt
    ```

### 迁移

1. **初始化 Aerich：**

    ```bash
    make init
    ```

2. **初始化数据库：**

    ```bash
    make init-db
    ```

3. **创建并应用迁移：**

    ```bash
    make migrate
    make upgrade
    ```
4. **回滚迁移：**

    ```bash
    make downgrade
    ```

### 运行

1. **设置配置文件路径：**

   在 Linux 或 macOS 上：
    ```bash
    export CONFIG_FILE_PATH=/path/to/your/config.ini
    ```

   在 Windows 上：
    ```cmd
    set CONFIG_FILE_PATH=C:\path\to\your\config.ini
    ```

2. **启动 FastAPI 应用程序：**

    ```bash
    uvicorn app.main:app --reload
    ```

3. **访问应用程序：**

   打开浏览器并访问 `http://127.0.0.1:8000`。

### 使用 Docker

1. **构建 Docker 镜像：**

    ```bash
    docker build -t algo-flow:0.1.0 .
    ```

2. **运行 Docker 容器：**

    ```bash
    docker run -d -p 8000:8000 --name algo-flow-api algo-flow:0.1.0
    ```

3. **访问应用程序：**

   打开浏览器并访问 `http://127.0.0.1:8000`。

### 使用 Docker Compose

1. **启动服务：**

    ```bash
    docker-compose up -d
    ```

2. **访问应用程序：**

   打开浏览器并访问 `http://127.0.0.1:8000`。

3. **停止服务：**

    ```bash
    docker-compose down
    ```

## 开发

1. **安装 pre-commit 钩子：**

    ```bash
    pre-commit install
    ```

2. **运行测试：**

    ```bash
   # 运行所有测试
    pytest -v
   # 如果你想生成覆盖率报告，可以使用以下命令：
    pytest --cov-report=html -v
    ```

3. **检查代码并格式化：**

    ```bash
    pre-commit run --all-file
    ```

4. **在开发模式下运行应用程序：**

    ```bash
    uvicorn app.main:app --reload
    ```

## 配置

配置通过 `config.ini` 文件进行管理。在运行应用程序之前，请确保将 `CONFIG_FILE_PATH` 环境变量设置为指向你的配置文件。