- 新增 .drone.yml 配置,实现基于 SSH 的自动构建和推送 Spider Base 镜像 - 检测 kami-spider-monorepo 目录代码变动,变动时触发基础镜像构建 - 基础镜像包含系统依赖、Python 环境、Playwright 及所有项目依赖 - 优化 Dockerfile,将应用镜像基于该预构建基础镜像构建,显著提升构建速度 - 新增 Makefile,标准化基础镜像和应用镜像的构建、测试、推送及清理流程 - 增加详细的 README,指导开发者快速上手构建和使用基础镜像 - 添加构建脚本 build-base-image.sh,实现基础镜像的统一构建及推送 - 引入生产环境入口脚本 docker-entrypoint.sh,优化启动流程和信号处理 - 统一依赖管理(pyproject.toml、uv.lock),确保基础镜像依赖完整一致 - 设定健康检查,提升容器运行稳定性和可监控性
144 lines
3.3 KiB
TOML
144 lines
3.3 KiB
TOML
[project]
|
|
name = "kami_spider"
|
|
version = "0.1.0"
|
|
description = "A stateless, production-ready FastAPI-based web service platform hosting multiple independent web applications"
|
|
readme = "README.md"
|
|
requires-python = ">=3.13"
|
|
dependencies = [
|
|
"fastapi>=0.120.0",
|
|
"uvicorn[standard]>=0.38.0",
|
|
"gunicorn>=23.0.0",
|
|
"sqlmodel>=0.0.24",
|
|
"pydantic>=2.12.3",
|
|
"pydantic-settings>=2.11.0",
|
|
"redis>=5.2.1",
|
|
"pymysql>=1.1.1",
|
|
"cryptography>=46.0.1",
|
|
"aiomysql>=0.2.0",
|
|
"alembic>=1.14.0",
|
|
"python-dotenv>=1.0.1",
|
|
"opentelemetry-api>=1.38.0",
|
|
"opentelemetry-sdk>=1.38.0",
|
|
"opentelemetry-instrumentation-fastapi>=0.59b0",
|
|
"opentelemetry-instrumentation-sqlalchemy>=0.59b0",
|
|
"opentelemetry-instrumentation-redis>=0.59b0",
|
|
"opentelemetry-instrumentation-httpx>=0.59b0",
|
|
"opentelemetry-instrumentation-logging>=0.59b0",
|
|
"opentelemetry-exporter-otlp-proto-grpc>=1.38.0",
|
|
"httpx>=0.28.1",
|
|
"python-multipart>=0.0.20",
|
|
"email-validator>=2.3.0",
|
|
"greenlet>=3.2.4",
|
|
"brotli>=1.1.0",
|
|
"psutil>=5.9.0",
|
|
"pycryptodome>=3.21.0",
|
|
"curl-cffi>=0.13.0",
|
|
"fake-useragent>=2.2.0",
|
|
"opentelemetry-instrumentation-requests>=0.59b0",
|
|
"ddddocr>=1.5.6",
|
|
"tenacity>=9.1.2",
|
|
"urllib3>=2.5.0",
|
|
"beautifulsoup4>=4.14.2",
|
|
"openai>=2.7.1",
|
|
"pandas>=2.3.3",
|
|
"lxml>=6.0.2",
|
|
"playwright>=1.55.0",
|
|
"aiofiles>=25.1.0",
|
|
"apscheduler>=3.10.0",
|
|
"orjson>=3.11.4",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
dev = [
|
|
"pytest>=8.3.4",
|
|
"pytest-asyncio>=0.24.0",
|
|
"pytest-cov>=6.0.0",
|
|
"pytest-mock>=3.14.0",
|
|
"httpx>=0.28.1",
|
|
"ruff>=0.8.4",
|
|
"mypy>=1.14.1",
|
|
]
|
|
|
|
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["apps", "core", "middleware", "observability"]
|
|
|
|
[tool.pytest.ini_options]
|
|
testpaths = ["tests"]
|
|
python_files = ["test_*.py"]
|
|
python_classes = ["Test*"]
|
|
python_functions = ["test_*"]
|
|
asyncio_mode = "auto"
|
|
addopts = [
|
|
"--strict-markers",
|
|
"--strict-config",
|
|
"--cov=.",
|
|
"--cov-report=term-missing",
|
|
"--cov-report=html",
|
|
]
|
|
|
|
[tool.coverage.run]
|
|
source = ["."]
|
|
omit = [
|
|
"tests/*",
|
|
"*/site-packages/*",
|
|
"*/__pycache__/*",
|
|
]
|
|
|
|
[tool.coverage.report]
|
|
exclude_lines = [
|
|
"pragma: no cover",
|
|
"def __repr__",
|
|
"raise AssertionError",
|
|
"raise NotImplementedError",
|
|
"if __name__ == .__main__.:",
|
|
"if TYPE_CHECKING:",
|
|
"class .*\\bProtocol\\):",
|
|
"@(abc\\.)?abstractmethod",
|
|
]
|
|
|
|
[tool.ruff]
|
|
line-length = 120
|
|
target-version = "py313"
|
|
|
|
[tool.ruff.lint]
|
|
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 formatter)
|
|
"B008", # do not perform function calls in argument defaults
|
|
"W191", # indentation contains tabs
|
|
]
|
|
|
|
[tool.ruff.lint.per-file-ignores]
|
|
"__init__.py" = ["F401"]
|
|
|
|
[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
|
|
no_implicit_optional = true
|
|
warn_redundant_casts = true
|
|
warn_unused_ignores = true
|
|
warn_no_return = true
|
|
strict_equality = true
|
|
|
|
[dependency-groups]
|
|
dev = [
|
|
"mypy>=1.18.2",
|
|
"ruff>=0.14.2",
|
|
]
|