dc63632e77
- app/utils/geo.py: reverse_geocoder 单例(mode=1 单进程 KDTree),经纬度→最近聚居点 - app/utils/meituan_city.py: 坐标→美团 city_id(省份/城市名桥接 + 多级兜底 + lru_cache 量化) - feed(rec) / top-sales: 按解析出的 city_id 过滤离线库;城市解析不出 / 老客户端不带坐标 → degraded - top-sales 与 rec 一致置空库内距离(相对城市默认点,对用户无意义) - main.py 启动预热 KDTree;pyproject 加 reverse_geocoder 依赖 + 分发 city_dict.txt - 新增 geo / meituan_city 测试(56 例);scripts/load_meituan_coupon_tsv.py 灌样本到本地 SQLite - .gitignore 忽略样本 TSV 与 .claude 本地设置 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
71 lines
1.7 KiB
TOML
71 lines
1.7 KiB
TOML
[project]
|
|
name = "shaguabijia-app-server"
|
|
version = "0.1.0"
|
|
description = "Shaguabijia 正式 App 后端 (FastAPI + SQLAlchemy + JWT)"
|
|
requires-python = ">=3.10"
|
|
dependencies = [
|
|
# Web 框架 & ASGI
|
|
"fastapi>=0.115.0",
|
|
"uvicorn[standard]>=0.32.0",
|
|
|
|
# 数据校验
|
|
"pydantic>=2.9.0",
|
|
"pydantic-settings>=2.5.0",
|
|
"email-validator>=2.2.0",
|
|
|
|
# ORM & 迁移
|
|
"sqlalchemy>=2.0.35",
|
|
"alembic>=1.13.3",
|
|
|
|
# PostgreSQL 驱动 (psycopg3, SQLAlchemy 2.0 时代默认, 不要再装 psycopg2)
|
|
"psycopg[binary]>=3.1",
|
|
|
|
# JWT 签名 / 校验
|
|
"pyjwt[crypto]>=2.9.0",
|
|
|
|
# 极光一键登录:RSA 解密极光返回的加密手机号
|
|
"cryptography>=42.0.0",
|
|
|
|
# HTTP 客户端 (调极光 REST)
|
|
"httpx>=0.27.0",
|
|
|
|
# multipart form (FastAPI 表单上传依赖)
|
|
"python-multipart>=0.0.9",
|
|
|
|
# admin 后台账号密码 hash(用户侧是手机号+验证码登录,不需要密码;admin 才用)
|
|
"bcrypt>=4.0.0",
|
|
|
|
# 邀请指纹归因:解析浏览器 UA 拿手机型号(Build.MODEL),跨端匹配用
|
|
"user-agents>=2.2.0",
|
|
|
|
# 离线经纬度→城市反查(美团 CPS 按城市过滤);会带入 numpy/scipy 依赖
|
|
"reverse_geocoder>=1.5.1",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
dev = [
|
|
"pytest>=8.0.0",
|
|
"pytest-asyncio>=0.24.0",
|
|
"httpx>=0.27.0",
|
|
"ruff>=0.6.0",
|
|
]
|
|
|
|
[tool.setuptools.packages.find]
|
|
include = ["app*"]
|
|
|
|
# 随包分发的运行时数据文件(美团城市词典;被 app/utils/meituan_city.py 加载)
|
|
[tool.setuptools.package-data]
|
|
"app.utils" = ["data/*.txt"]
|
|
|
|
[tool.pytest.ini_options]
|
|
asyncio_mode = "auto"
|
|
testpaths = ["tests"]
|
|
|
|
[tool.ruff]
|
|
line-length = 100
|
|
target-version = "py311"
|
|
|
|
[tool.ruff.lint]
|
|
select = ["E", "F", "W", "I", "B", "UP"]
|
|
ignore = ["E501"]
|