[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "openjiuwen-runtime-foundation"
version = "0.1.0"
description = "OpenJiuwen Runtime"
requires-python = ">=3.11"
dependencies = [
    # service
    "build>=1.0.0",
    "aiohttp>=3.9.0",
    # config
    "pyyaml>=6.0",
    # db
    "sqlalchemy>=2.0.41",
    "greenlet>=3.0.0",
    "pymysql==1.1.1",
    "cryptography>=42.0.0",
    "pydantic>=2.11.7",
    "pydantic-settings>=2.5.2",
    "aiomysql==0.2.0",
    "aiosqlite>=0.21.0",
    "redis==7.1.0",
    # audit_v2: OTEL Logs emit(Batch + OTLP/HTTP)
    "opentelemetry-api>=1.30,<2",
    "opentelemetry-sdk>=1.30,<2",
    "opentelemetry-exporter-otlp-proto-http>=1.30,<2",
]

[project.optional-dependencies]
link-mtls = [
    "httpx>=0.28.1,<0.29",
    "httpcore>=1.0.9,<1.1",
    "uvicorn>=0.42,<0.47",
]
gaussdb = [
    "async-gaussdb>=0.30.4",
]
amqp = [
    "aio-pika>=9.4",
]
# 兼容旧安装名;grpc exporter 仅在需要时安装
audit-otel = [
    "opentelemetry-api>=1.30,<2",
    "opentelemetry-sdk>=1.30,<2",
    "opentelemetry-exporter-otlp-proto-http>=1.30,<2",
    "opentelemetry-exporter-otlp-proto-grpc>=1.30,<2",
]

[tool.uv]
default-groups = ['dev']

[dependency-groups]
dev = [
    # Lint tooling is not a dependency of applications using foundation.
    "ruff==0.9.10",
    # test
    "coverage==7.8.0",
    "pytest==8.3.5",
    "pytest-asyncio==1.2.0",
    "pytest-mock==3.14.0",
    "httpx>=0.28.1,<0.29",
    "uvicorn>=0.42,<0.47",
    "fastapi>=0.115",
    "opentelemetry-api>=1.30,<2",
    "opentelemetry-sdk>=1.30,<2",
    "opentelemetry-exporter-otlp-proto-http>=1.30,<2",
]

[[tool.uv.index]]
url = "https://mirrors.aliyun.com/pypi/simple/"

[tool.setuptools.packages.find]
where = ["."]
exclude = ["*.egg-info", "tests", "*.tests", "*.tests.*"]
include = ["openjiuwen_runtime*"]

[tool.setuptools.package-data]
"openjiuwen_runtime.foundation" = ["config/logging.yaml"]
	 
[tool.pytest.ini_options]
testpaths = [
    "tests",
    "openjiuwen_runtime/foundation/audit/tests",
]
pythonpath = ["."]
# 默认跳过 perf;显式跑:pytest -m perf -s
addopts = "-m 'not perf'"
markers = [
    "perf: performance / stress tests (opt-in via -m perf)",
]