mirror of
https://git.oceanpay.cc/danial/kami_apple_exchage.git
synced 2025-12-18 23:05:11 +00:00
本次提交将后端的任务队列系统从Celery迁移到了Arq,以支持基于协程的任务处理。主要改动包括: - 更新文档和配置文件,反映架构变化。 - 修改健康检查和服务初始化逻辑,以适应Arq的使用。 - 移除与Celery相关的代码,并添加Arq任务定义和调度器。 - 更新Dockerfile和相关脚本,确保Arq worker能够正确运行。 - 调整API和业务服务中的任务处理逻辑,移除对Celery的依赖。 这些改动旨在提高系统的异步处理能力和整体性能。
236 lines
5.4 KiB
TOML
236 lines
5.4 KiB
TOML
[project]
|
|
name = "apple-exchange-backend"
|
|
version = "2.0.0"
|
|
description = "Apple Gift Card Exchange Backend - FastAPI异步微服务架构"
|
|
#readme = "README.md"
|
|
requires-python = ">=3.13"
|
|
authors = [
|
|
{name = "Apple Exchange Team", email = "team@apple-exchange.com"}
|
|
]
|
|
keywords = ["fastapi", "apple", "gift-card", "exchange", "async", "microservice"]
|
|
classifiers = [
|
|
"Development Status :: 4 - Beta",
|
|
"Intended Audience :: Developers",
|
|
"License :: OSI Approved :: MIT License",
|
|
"Programming Language :: Python :: 3",
|
|
"Programming Language :: Python :: 3.13",
|
|
"Framework :: FastAPI",
|
|
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
|
|
]
|
|
|
|
dependencies = [
|
|
"opentelemetry-instrumentation-fastapi>=0.57b0",
|
|
"opentelemetry-api>=1.36.0",
|
|
"python-multipart>=0.0.20",
|
|
"opentelemetry-sdk>=1.36.0",
|
|
"opentelemetry-exporter-otlp>=1.36.0",
|
|
"opentelemetry-instrumentation-redis>=0.57b0",
|
|
"opentelemetry-instrumentation-requests>=0.57b0",
|
|
"opentelemetry-instrumentation-httpx>=0.57b0",
|
|
"httpx>=0.28.1",
|
|
"aiohttp>=3.12.15",
|
|
"pydantic>=2.11.7",
|
|
"pydantic-settings>=2.10.1",
|
|
"alembic>=1.16.4",
|
|
"asyncpg>=0.30.0",
|
|
"aiosqlite>=0.21.0",
|
|
"psycopg2-binary>=2.9.10",
|
|
"uvicorn[standard]>=0.35.0",
|
|
"gunicorn>=23.0.0",
|
|
"sqlalchemy>=2.0.42",
|
|
"asyncio-mqtt>=0.16.2",
|
|
"playwright>=1.54.0",
|
|
"pandas>=2.3.2",
|
|
"openpyxl>=3.1.5",
|
|
"xlsxwriter>=3.2.5",
|
|
"structlog>=25.4.0",
|
|
"python-json-logger>=3.3.0",
|
|
"python-dotenv>=1.1.1",
|
|
"python-jose[cryptography]>=3.5.0",
|
|
"passlib[bcrypt]>=1.7.4",
|
|
"click>=8.2.1",
|
|
"rich>=14.1.0",
|
|
"typer>=0.16.1",
|
|
"psutil>=7.0.0",
|
|
"black>=25.1.0",
|
|
"isort>=6.0.1",
|
|
"flake8>=7.3.0",
|
|
"mypy>=1.17.1",
|
|
"pytest>=8.4.1",
|
|
"pytest-asyncio>=1.1.0",
|
|
"pytest-cov>=6.2.1",
|
|
"pre-commit>=4.3.0",
|
|
"opentelemetry-instrumentation-logging>=0.57b0",
|
|
"aiofiles>=24.1.0",
|
|
"pandas-stubs>=2.3.0.250703",
|
|
"kombu>=5.5.4",
|
|
"loguru>=0.7.3",
|
|
"opentelemetry-instrumentation-asyncpg>=0.57b0",
|
|
"build>=1.3.0",
|
|
"fastapi>=0.116.2",
|
|
"opentelemetry-instrumentation-sqlalchemy>=0.57b0",
|
|
"arq>=0.26.3",
|
|
"redis>=5.3.1",
|
|
"aioredis>=2.0.1",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
dev = [
|
|
"pytest>=7.4.3",
|
|
"pytest-asyncio>=0.21.1",
|
|
"pytest-cov>=4.1.0",
|
|
"pytest-mock>=3.12.0",
|
|
"httpx>=0.25.2",
|
|
"faker>=20.1.0",
|
|
]
|
|
|
|
test = [
|
|
"pytest>=7.4.3",
|
|
"pytest-asyncio>=0.21.1",
|
|
"pytest-cov>=4.1.0",
|
|
"pytest-mock>=3.12.0",
|
|
"coverage>=7.3.2",
|
|
]
|
|
|
|
docs = [
|
|
"mkdocs>=1.5.3",
|
|
"mkdocs-material>=9.4.8",
|
|
"mkdocstrings[python]>=0.24.0",
|
|
]
|
|
|
|
[project.urls]
|
|
Homepage = "https://github.com/apple-exchange/backend"
|
|
Documentation = "https://docs.apple-exchange.com"
|
|
Repository = "https://github.com/apple-exchange/backend.git"
|
|
Issues = "https://github.com/apple-exchange/backend/issues"
|
|
|
|
[project.scripts]
|
|
apple-exchange = "app.cli:main"
|
|
|
|
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[tool.hatch.version]
|
|
path = "app/__init__.py"
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["app"]
|
|
|
|
# Black代码格式化配置
|
|
[tool.black]
|
|
line-length = 88
|
|
target-version = ['py313']
|
|
include = '\.pyi?$'
|
|
extend-exclude = '''
|
|
/(
|
|
# directories
|
|
\.eggs
|
|
| \.git
|
|
| \.hg
|
|
| \.mypy_cache
|
|
| \.tox
|
|
| \.venv
|
|
| build
|
|
| dist
|
|
)/
|
|
'''
|
|
|
|
# isort导入排序配置
|
|
[tool.isort]
|
|
profile = "black"
|
|
multi_line_output = 3
|
|
line_length = 88
|
|
known_first_party = ["app"]
|
|
known_third_party = ["fastapi", "pydantic", "sqlalchemy", "redis", "playwright"]
|
|
|
|
# MyPy类型检查配置
|
|
[tool.mypy]
|
|
python_version = "3.13"
|
|
warn_return_any = true
|
|
warn_unused_configs = true
|
|
disallow_untyped_defs = true
|
|
disallow_incomplete_defs = true
|
|
check_untyped_defs = true
|
|
disallow_untyped_decorators = true
|
|
no_implicit_optional = true
|
|
warn_redundant_casts = true
|
|
warn_unused_ignores = true
|
|
warn_no_return = true
|
|
warn_unreachable = true
|
|
strict_equality = true
|
|
|
|
[[tool.mypy.overrides]]
|
|
module = [
|
|
"playwright.*",
|
|
"psutil.*",
|
|
"openpyxl.*",
|
|
"pandas.*",
|
|
]
|
|
ignore_missing_imports = true
|
|
|
|
# Pytest配置
|
|
[tool.pytest.ini_options]
|
|
minversion = "7.0"
|
|
addopts = "-ra -q --strict-markers --strict-config"
|
|
testpaths = ["tests"]
|
|
python_files = ["test_*.py", "*_test.py"]
|
|
python_classes = ["Test*"]
|
|
python_functions = ["test_*"]
|
|
markers = [
|
|
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
|
|
"integration: marks tests as integration tests",
|
|
"unit: marks tests as unit tests",
|
|
]
|
|
asyncio_mode = "auto"
|
|
|
|
# Coverage配置
|
|
[tool.coverage.run]
|
|
source = ["app"]
|
|
omit = [
|
|
"*/tests/*",
|
|
"*/test_*.py",
|
|
"*/__pycache__/*",
|
|
"*/migrations/*",
|
|
]
|
|
|
|
[tool.coverage.report]
|
|
exclude_lines = [
|
|
"pragma: no cover",
|
|
"def __repr__",
|
|
"if self.debug:",
|
|
"if settings.DEBUG",
|
|
"raise AssertionError",
|
|
"raise NotImplementedError",
|
|
"if 0:",
|
|
"if __name__ == .__main__.:",
|
|
"class .*\\bProtocol\\):",
|
|
"@(abc\\.)?abstractmethod",
|
|
]
|
|
|
|
# Ruff配置 (替代flake8)
|
|
[tool.ruff]
|
|
target-version = "py313"
|
|
line-length = 88
|
|
select = [
|
|
"E", # pycodestyle errors
|
|
"W", # pycodestyle warnings
|
|
"F", # pyflakes
|
|
"I", # isort
|
|
"B", # flake8-bugbear
|
|
"C4", # flake8-comprehensions
|
|
"UP", # pyupgrade
|
|
]
|
|
ignore = [
|
|
"E501", # line too long, handled by black
|
|
"B008", # do not perform function calls in argument defaults
|
|
"C901", # too complex
|
|
]
|
|
|
|
[tool.ruff.per-file-ignores]
|
|
"__init__.py" = ["F401"]
|
|
"tests/*" = ["B011"]
|
|
|
|
[tool.ruff.isort]
|
|
known-first-party = ["app"]
|