-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
254 lines (229 loc) · 10.2 KB
/
pyproject.toml
File metadata and controls
254 lines (229 loc) · 10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# SPDX-FileCopyrightText: 2026 The Botanu Authors
# SPDX-License-Identifier: Apache-2.0
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
# ---------------------------------------------------------------------------
# Project metadata (PEP 621)
# ---------------------------------------------------------------------------
[project]
name = "botanu"
dynamic = ["version"]
description = "OpenTelemetry-native run-level cost attribution for AI workflows"
readme = "README.md"
license = "Apache-2.0"
requires-python = ">=3.9"
authors = [
{ name = "The Botanu Authors", email = "oss@botanu.ai" },
]
keywords = [
"opentelemetry",
"tracing",
"observability",
"ai",
"llm",
"cost-attribution",
"mlops",
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: System :: Monitoring",
"Typing :: Typed",
]
# All dependencies included in base install. OTel instrumentation packages
# are lightweight shims (~few KB each) that silently no-op when the target
# library is not installed, so there is zero bloat for unused instrumentations.
dependencies = [
# ── OTel core + SDK + exporter ─────────────────────────────────
"opentelemetry-api >= 1.20.0",
"opentelemetry-sdk >= 1.20.0",
"opentelemetry-exporter-otlp-proto-http >= 1.20.0",
"opentelemetry-instrumentation >= 0.41b0",
# ── HTTP clients ───────────────────────────────────────────────
"opentelemetry-instrumentation-httpx >= 0.41b0",
"opentelemetry-instrumentation-requests >= 0.41b0",
"opentelemetry-instrumentation-urllib3 >= 0.41b0",
"opentelemetry-instrumentation-urllib >= 0.41b0",
"opentelemetry-instrumentation-aiohttp-client >= 0.41b0",
"opentelemetry-instrumentation-aiohttp-server >= 0.41b0",
# ── Web frameworks ─────────────────────────────────────────────
"opentelemetry-instrumentation-fastapi >= 0.41b0",
"opentelemetry-instrumentation-flask >= 0.41b0",
"opentelemetry-instrumentation-django >= 0.41b0",
"opentelemetry-instrumentation-starlette >= 0.41b0",
"opentelemetry-instrumentation-falcon >= 0.41b0",
"opentelemetry-instrumentation-pyramid >= 0.41b0",
"opentelemetry-instrumentation-tornado >= 0.41b0",
# ── gRPC ───────────────────────────────────────────────────────
"opentelemetry-instrumentation-grpc >= 0.41b0",
# ── Databases ──────────────────────────────────────────────────
"opentelemetry-instrumentation-sqlalchemy >= 0.41b0",
"opentelemetry-instrumentation-psycopg2 >= 0.41b0",
"opentelemetry-instrumentation-psycopg >= 0.41b0",
"opentelemetry-instrumentation-asyncpg >= 0.41b0",
"opentelemetry-instrumentation-aiopg >= 0.41b0",
"opentelemetry-instrumentation-pymongo >= 0.41b0",
"opentelemetry-instrumentation-redis >= 0.41b0",
"opentelemetry-instrumentation-mysql >= 0.41b0",
"opentelemetry-instrumentation-mysqlclient >= 0.41b0",
"opentelemetry-instrumentation-pymysql >= 0.41b0",
"opentelemetry-instrumentation-sqlite3 >= 0.41b0",
"opentelemetry-instrumentation-elasticsearch >= 0.41b0",
"opentelemetry-instrumentation-cassandra >= 0.41b0",
"opentelemetry-instrumentation-tortoiseorm >= 0.41b0",
"opentelemetry-instrumentation-pymemcache >= 0.41b0",
# ── Messaging / Task queues ────────────────────────────────────
"opentelemetry-instrumentation-celery >= 0.41b0",
"opentelemetry-instrumentation-kafka-python >= 0.41b0",
"opentelemetry-instrumentation-confluent-kafka >= 0.41b0",
"opentelemetry-instrumentation-aiokafka >= 0.41b0",
"opentelemetry-instrumentation-pika >= 0.41b0",
"opentelemetry-instrumentation-aio-pika >= 0.41b0",
# ── AWS ────────────────────────────────────────────────────────
"opentelemetry-instrumentation-botocore >= 0.41b0",
"opentelemetry-instrumentation-boto3sqs >= 0.41b0",
# ── GenAI / AI ─────────────────────────────────────────────────
"opentelemetry-instrumentation-openai-v2 >= 2.0b0",
"opentelemetry-instrumentation-anthropic >= 0.1b0; python_version >= '3.10'",
"opentelemetry-instrumentation-vertexai >= 0.1b0; python_version >= '3.10'",
"opentelemetry-instrumentation-google-generativeai >= 0.1b0; python_version >= '3.10'",
"opentelemetry-instrumentation-langchain >= 0.1b0; python_version >= '3.10'",
"opentelemetry-instrumentation-ollama >= 0.1b0",
"opentelemetry-instrumentation-crewai >= 0.1b0; python_version >= '3.10'",
# ── Runtime / Concurrency ──────────────────────────────────────
"opentelemetry-instrumentation-logging >= 0.41b0",
"opentelemetry-instrumentation-threading >= 0.41b0",
]
[project.urls]
Homepage = "https://github.com/botanu-ai/botanu-sdk-python"
Documentation = "https://docs.botanu.ai"
Repository = "https://github.com/botanu-ai/botanu-sdk-python"
Changelog = "https://github.com/botanu-ai/botanu-sdk-python/blob/main/CHANGELOG.md"
Issues = "https://github.com/botanu-ai/botanu-sdk-python/issues"
# ---------------------------------------------------------------------------
# Optional extras
# ---------------------------------------------------------------------------
[project.optional-dependencies]
# Cloud resource detectors — lightweight, auto-detect env and no-op elsewhere.
# K8s: use the OTel Operator or K8s downward API to set OTEL_RESOURCE_ATTRIBUTES.
# EKS/GKE detection is included in the aws/gcp extras respectively.
aws = ["opentelemetry-resource-detector-aws >= 0.1b0"]
gcp = ["opentelemetry-resource-detector-gcp >= 0.1b0"]
azure = ["opentelemetry-resource-detector-azure >= 0.1b0"]
container = ["opentelemetry-resource-detector-container >= 0.1b0"]
cloud = [
"opentelemetry-resource-detector-aws >= 0.1b0",
"opentelemetry-resource-detector-gcp >= 0.1b0",
"opentelemetry-resource-detector-azure >= 0.1b0",
"opentelemetry-resource-detector-container >= 0.1b0",
]
dev = [
"pytest >= 7.4.0",
"pytest-asyncio >= 0.21.0",
"pytest-cov >= 4.1.0",
"coverage[toml] >= 7.0",
"httpx >= 0.24.0, < 0.28.0",
"starlette >= 0.27.0, < 0.30.0",
"ruff >= 0.4.0",
"mypy >= 1.7.0",
"pre-commit >= 3.5.0",
]
# ---------------------------------------------------------------------------
# Hatch — build targets & versioning
# ---------------------------------------------------------------------------
[tool.hatch.version]
source = "vcs"
[tool.hatch.version.raw-options]
version_scheme = "guess-next-dev"
local_scheme = "no-local-version"
[tool.hatch.build.targets.sdist]
include = ["src/botanu/**", "LICENSE", "NOTICE", "README.md"]
[tool.hatch.build.targets.wheel]
packages = ["src/botanu"]
# ---------------------------------------------------------------------------
# Ruff (linter + formatter)
# ---------------------------------------------------------------------------
[tool.ruff]
line-length = 120
target-version = "py39"
src = ["src"]
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"UP", # pyupgrade
"S", # flake8-bandit (security)
"RUF", # ruff-specific
]
ignore = [
"E501", # line too long — handled by formatter
"S101", # assert in tests is fine
"S110", # try-except-pass is intentional in resource detection
"UP006", # dict vs Dict — keep Dict[] for 3.9 compat
"UP007", # X | Y syntax — keep Optional[] for 3.9 compat
"UP035", # typing.Dict deprecated — keep for 3.9 compat
"UP045", # X | None vs Optional — keep Optional[] for 3.9 compat
"RUF002", # ambiguous dash — intentional in docstrings
"RUF022", # __all__ not sorted — grouped logically
]
[tool.ruff.lint.per-file-ignores]
"tests/**" = ["S101", "S106"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
line-ending = "auto"
# ---------------------------------------------------------------------------
# mypy
# ---------------------------------------------------------------------------
[tool.mypy]
python_version = "3.9"
warn_return_any = false
warn_unused_configs = true
ignore_missing_imports = true
strict = false
# OTel SDK types are not always precise; runtime behavior is correct
disable_error_code = ["arg-type", "attr-defined", "operator", "misc"]
# ---------------------------------------------------------------------------
# pytest
# ---------------------------------------------------------------------------
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]
addopts = [
"--strict-markers",
"--tb=short",
]
markers = [
"integration: marks tests that require external services",
]
# ---------------------------------------------------------------------------
# coverage
# ---------------------------------------------------------------------------
[tool.coverage.run]
source = ["botanu"]
branch = true
[tool.coverage.report]
show_missing = true
fail_under = 70
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"if __name__ == .__main__.",
]
# Exclude integration-heavy modules that require full OTel SDK setup
omit = [
"src/botanu/sdk/bootstrap.py",
"src/botanu/sdk/middleware.py",
]