FastV — Laravel-style FastAPI Framework
一个基于 FastAPI 的全栈 Web 框架,把 Laravel 的架构范式(服务容器、门面、服务提供者、Eloquent 风格 ORM、Artisan 风格 CLI、中间件管道、任务队列、调度)带到 Python,同时保留 FastAPI 的高性能与异步特性。
特性
- 服务容器(IoC) — 依赖注入与自动装配,支持
bind/singleton/instance/alias - Eloquent 风格 ORM — 基于 SQLAlchemy 2.0,链式 QueryBuilder、软删除、分页、类型转换、访问器/修改器、变更追踪
- Artisan 风格 CLI — 代码生成器(
make:model/make:controller/make:migration)、数据库迁移、队列管理 - JWT 认证 — Guard、密码哈希(bcrypt)、token 签发/校验
- 缓存系统 — Array / File / Redis 三种驱动,键前缀、TTL
- 任务队列 — AsyncTasQ 集成,重试、延迟任务、限流任务
- 调度器 — APScheduler + Laravel 风格流式 DSL(
cron/every/daily_at…) - 中间件管道 — 可链式组合的 HTTP 中间件
- 事件系统 — 发布/订阅,支持通配符
- 统一异常处理 — 分层业务异常 + 统一 JSON 响应
- 健康检查 —
/health(liveness)与/health/ready(readiness,探活 DB/Redis)
安装
# 核心框架
pip install fastv
# 一键安装全部可选依赖(MySQL/PostgreSQL/SQLite 驱动 + 队列)
pip install fastv[all]
可选 extras:dev(测试/覆盖率/ruff)、mysql、postgres、sqlite、queue。
快速开始
# 1. 安装框架
pip install fastv
# 2. 创建项目目录并初始化(生成 app/、bootstrap/、config/、migrations/、.env)
mkdir myapp && cd myapp
fastv new
# 3. 启动开发服务器(热重载 + debug)
fastv start dev
# 4. 运行数据库迁移
fastv migrate
要求
- Python 3.12+
- FastAPI 0.139+
目录结构(框架目标)
myapp/
├── app/ # 应用代码(controller / model / service / middleware / route / validate / queue / command)
├── bootstrap/ # 应用入口 main.py
├── config/ # 配置文件(app / database / redis / auth / …)
├── migrations/ # Alembic 数据库迁移
├── storage/ # 日志、缓存等运行时目录
├── .env # 环境变量(含密钥,勿提交)
└── alembic.ini
许可证
MIT
Metadata
Release files for fastv 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastv-1.1.1.tar.gz | 125.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastv-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 287.7 kB
Release files / fastv-1.1.1.tar.gz
| Download URL | fastv-1.1.1.tar.gz |
|---|---|
| Size | 125.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93b5a1b7b3c6dc97bf8dcdeed894af4592216a88f0d36db61a7bedc553fde8a1
|
|
BLAKE2b-256 checksum How to use checksums |
6058131570e890f7c0f4d2edbc6924528c1fd595be1779340cc5f9879219bafd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / fastv-1.1.1-py3-none-any.whl
| Download URL | fastv-1.1.1-py3-none-any.whl |
|---|---|
| Size | 162.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab89685820be590f675db72657b7cf07a7b886922be49b87ea132447222d5a9f
|
|
BLAKE2b-256 checksum How to use checksums |
a0608314dffc0061096bb1ad3c6f41e9fecb6c26a9383d3ea6ab09d1020583e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|