- uv 工程(Python 3.12,pyproject + uv.lock,dev: pytest/ruff) - 分层包结构:api / application / domain / infrastructure / quant(qlib_adapter) / agent / core - app.core.config:加载根 config.yaml + .env,sqlite 相对路径解析到项目根 data/ - SQLAlchemy Base + Session 工厂(Infrastructure 层,业务走 Repository) - Alembic 迁移环境就位(env.py 复用应用配置,render_as_batch 兼容 SQLite) - GET /api/health + pytest 冒烟 6 项通过 / ruff clean / uvicorn 启动验证
22 lines
494 B
Python
22 lines
494 B
Python
"""FastAPI 应用入口。
|
||
|
||
启动:cd backend && uv run uvicorn app.main:app --reload
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
from fastapi import FastAPI
|
||
|
||
from app.api.router import api_router
|
||
from app.core.config import get_settings
|
||
|
||
settings = get_settings()
|
||
|
||
app = FastAPI(
|
||
title=settings.app_name,
|
||
version=settings.app_version,
|
||
description="A股个人量化研究平台 API(Qlib 引擎 / Tushare 数据源)",
|
||
)
|
||
|
||
app.include_router(api_router, prefix=settings.api_prefix)
|