Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

2.7 KB
Raw Blame
[project]
name = "llm-gateway"
version = "0.1.0"
description = "LLM Gateway"
readme = "README.md"
requires-python = ">=3.14"
authors = [
    { name = "PostHog", email = "[email protected]" },
]
dependencies = [
    "fastapi>=0.115.0",
    "uvicorn[standard]>=0.32.0",
    "gunicorn>=23.0.0",
    "pydantic>=2.5.0",
    "pydantic-settings>=2.1.0",
    "asyncpg>=0.30.0",
    "redis==5.3.1",
    "litellm==1.93.2",
    "orjson>=3.10.0",
    "prometheus-client>=0.21.0",
    "prometheus-fastapi-instrumentator>=7.0.0",
    "structlog>=24.4.0",
    "httpx>=0.28.0",
    "posthoganalytics>=7.84.1",
    "cachetools>=5.5.0",
    "python-multipart>=0.0.9",
    "boto3>=1.42.65",
]

[dependency-groups]
dev = [
    "ruff>=0.8.0",
    "pytest>=8.0.0",
    "pytest-asyncio>=0.24.0",
    "pytest-cov>=6.0.0",
    "pytest-rerunfailures>=16.0",
    "mypy>=1.13.0",
    "respx>=0.22.0",
    "openai>=2.20.0",
    "anthropic>=0.80.0",
    "fakeredis==2.23.3",
    "asyncpg-stubs>=0.30.0",
    "types-cachetools>=5.5.0",
]

[project.scripts]
reset-posthog-code-usage = "llm_gateway.cli.reset_posthog_code_usage:main"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/llm_gateway"]

[tool.hatch.build.targets.sdist]
exclude = [
    ".venv/",
    "dist/",
    "*.egg-info/",
]

[tool.ruff]
# Pinned apart from requires-python, like the root: py314 makes ruff format drop the
# parentheses in `except (A, B):` (PEP 758).
target-version = "py313"
line-length = 120
indent-width = 4

[tool.ruff.lint]
select = [
    "E",
    "W",
    "F",
    "I",
    "B",
    "C4",
    "PLC0415",
    "UP",
]
ignore = [
    "E501",
]

# PLC0415 exemptions.
# Run `ruff check <path> --select PLC0415 --statistics` before removing an entry.
[tool.ruff.lint.per-file-ignores]
"src/**" = ["PLC0415"]
"tests/**" = ["PLC0415"]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"

[tool.pytest.ini_options]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
testpaths = ["tests"]
pythonpath = ["src"]
# No --reruns: retries mask the raw flake signal Trunk quarantining relies on.
# xunit1 keeps per-test file paths in the junit XML for Trunk flake attribution.
addopts = ["--junitxml=junit.xml", "-o", "junit_family=xunit1"]

[tool.mypy]
python_version = "3.14"
strict = true
warn_return_any = true
warn_unused_ignores = true

[tool.uv]
managed = true
exclude-newer = "7 days"
exclude-newer-package = { certifi = false, posthoganalytics = false }
# The SDK release bot resets the posthoganalytics spec to a floor on every release, so
# this constraint is what keeps a new major out until its migration PR.
constraint-dependencies = ["posthoganalytics<8"]