-
Notifications
You must be signed in to change notification settings - Fork 264
Expand file tree
/
Copy pathpyproject.toml
More file actions
380 lines (357 loc) · 15.3 KB
/
Copy pathpyproject.toml
File metadata and controls
380 lines (357 loc) · 15.3 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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "logfire"
version = "4.37.0"
description = "The best Python observability tool! 🪵🔥"
requires-python = ">=3.10"
authors = [
{ name = "Pydantic Team", email = "engineering@pydantic.dev" },
{ name = "Samuel Colvin", email = "samuel@pydantic.dev" },
{ name = "Hasan Ramezani", email = "hasan@pydantic.dev" },
{ name = "Adrian Garcia Badaracco", email = "adrian@pydantic.dev" },
{ name = "David Montague", email = "david@pydantic.dev" },
{ name = "Marcelo Trylesinski", email = "marcelo@pydantic.dev" },
{ name = "David Hewitt", email = "david.hewitt@pydantic.dev" },
{ name = "Alex Hall", email = "alex@pydantic.dev" },
{ name = "Jiri Kuncar", email = "jiri@pydantic.dev" },
]
license = "MIT"
license-files = ["LICENSE"]
readme = "README.md"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"Operating System :: Unix",
"Operating System :: POSIX :: Linux",
"Environment :: Console",
"Environment :: MacOS X",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Internet",
"Framework :: OpenTelemetry",
"Framework :: OpenTelemetry :: Distros",
"Framework :: OpenTelemetry :: Exporters",
"Framework :: OpenTelemetry :: Instrumentations",
]
dependencies = [
"opentelemetry-sdk >= 1.39.0, < 1.44.0",
"opentelemetry-exporter-otlp-proto-http >= 1.39.0, < 1.44.0",
"opentelemetry-instrumentation >= 0.41b0",
"rich >= 13.4.2",
"protobuf >= 4.23.4",
"typing-extensions >= 4.1.0",
"tomli >= 2.0.1; python_version < '3.11'",
"executing >= 2.0.1",
]
[project.optional-dependencies]
gateway = ["httpx>=0.27.0", "starlette>=0.37.0", "uvicorn>=0.30.0"]
system-metrics = ["opentelemetry-instrumentation-system-metrics >= 0.42b0"]
asgi = ["opentelemetry-instrumentation-asgi >= 0.42b0"]
wsgi = ["opentelemetry-instrumentation-wsgi >= 0.42b0"]
aiohttp = ["opentelemetry-instrumentation-aiohttp-client >= 0.42b0"]
aiohttp-client = ["opentelemetry-instrumentation-aiohttp-client >= 0.42b0"]
aiohttp-server = ["opentelemetry-instrumentation-aiohttp-server >= 0.55b0"]
celery = ["opentelemetry-instrumentation-celery >= 0.42b0"]
django = ["opentelemetry-instrumentation-django >= 0.42b0", "opentelemetry-instrumentation-asgi >= 0.42b0"]
fastapi = ["opentelemetry-instrumentation-fastapi >= 0.42b0"]
flask = ["opentelemetry-instrumentation-flask >= 0.42b0"]
httpx = ["opentelemetry-instrumentation-httpx >= 0.42b0"]
starlette = ["opentelemetry-instrumentation-starlette >= 0.42b0"]
sqlalchemy = ["opentelemetry-instrumentation-sqlalchemy >= 0.42b0"]
asyncpg = ["opentelemetry-instrumentation-asyncpg >= 0.42b0"]
psycopg = ["opentelemetry-instrumentation-psycopg >= 0.42b0", "packaging"]
psycopg2 = ["opentelemetry-instrumentation-psycopg2 >= 0.42b0", "packaging"]
pymongo = ["opentelemetry-instrumentation-pymongo >= 0.42b0"]
redis = ["opentelemetry-instrumentation-redis >= 0.42b0"]
requests = ["opentelemetry-instrumentation-requests >= 0.42b0"]
mysql = ["opentelemetry-instrumentation-mysql >= 0.42b0"]
sqlite3 = ["opentelemetry-instrumentation-sqlite3 >= 0.42b0"]
aws-lambda = ["opentelemetry-instrumentation-aws-lambda >= 0.42b0"]
google-genai = ["opentelemetry-instrumentation-google-genai >= 0.4b0"]
litellm = ["openinference-instrumentation-litellm >= 0"]
dspy = ["openinference-instrumentation-dspy >= 0"]
datasets = ["httpx>=0.27.2", "pydantic>=2", "pydantic-evals>=1.0.0"]
variables = ["pydantic>=2", "pydantic-handlebars>=0.2.1"]
[project.urls]
Homepage = "https://pydantic.dev/logfire"
Source = "https://github.com/pydantic/logfire"
Documentation = "https://pydantic.dev/docs/logfire/"
Changelog = "https://github.com/pydantic/logfire/blob/main/CHANGELOG.md"
[project.scripts]
logfire = "logfire.cli:main"
[project.entry-points."pydantic"]
logfire-plugin = "logfire.integrations.pydantic:plugin"
[project.entry-points."pytest11"]
logfire = "logfire.testing"
pytest_logfire = "logfire._internal.integrations.pytest"
[dependency-groups]
dev = [
"httpx >= 0.27.2",
"aiohttp >= 3.10.9",
"redis >= 5.1.1",
"pymongo >= 4.10.1",
"fastapi != 0.124.3, != 0.124.4",
"Flask >= 3.0.3",
"django >= 4.2.16",
"dirty-equals >= 0.8.0",
"pytest >= 8.3.4",
"pytest-django >= 4.6.0",
"pytest-pretty >= 1.2.0",
"pydantic >= 2.11.0",
"requests >= 2.31.0",
# requests >= 2.34 bundles inline (py.typed) annotations shaped differently from
# the types-requests stubs the code was written against. Concretely, it types
# Session.headers as CaseInsensitiveDict[str], which rejects the str|bytes header
# values requests accepts at runtime and that our DiskRetryer passes to a Session
# (exporters/otlp.py); types-requests types it as MutableMapping[str, str|bytes].
# Keep depending on types-requests so its stubs take priority; it previously came
# in transitively via openai-agents.
"types-requests",
"sqlalchemy >= 1.4.54",
"pandas>=2.1.2",
"attrs >= 23.1.0",
"openai >= 1.108.1",
"opentelemetry-instrumentation-aiohttp-client>=0.42b0",
"opentelemetry-instrumentation-aiohttp-server>=0.55b0",
"opentelemetry-instrumentation-asgi>=0.42b0",
"opentelemetry-instrumentation-wsgi>=0.42b0",
"opentelemetry-instrumentation-fastapi>=0.42b0",
"opentelemetry-instrumentation-starlette>=0.42b0",
"opentelemetry-instrumentation-flask>=0.42b0",
"opentelemetry-instrumentation-django>=0.42b0",
"opentelemetry-instrumentation-httpx>=0.42b0",
"opentelemetry-instrumentation-requests>=0.42b0",
"opentelemetry-instrumentation-sqlalchemy>=0.42b0",
"opentelemetry-instrumentation-system-metrics>=0.42b0",
"opentelemetry-instrumentation-asyncpg>=0.42b0",
"opentelemetry-instrumentation-psycopg>=0.42b0",
"opentelemetry-instrumentation-psycopg2>=0.42b0",
"opentelemetry-instrumentation-redis>=0.42b0",
"opentelemetry-instrumentation-pymongo>=0.42b0",
"opentelemetry-instrumentation-celery>=0.42b0",
"opentelemetry-instrumentation-mysql>=0.42b0",
"opentelemetry-instrumentation-sqlite3>=0.42b0",
"opentelemetry-instrumentation-aws-lambda>=0.42b0",
"eval-type-backport >= 0.2.0",
"requests-mock >= 1.12.1",
"inline-snapshot >= 0.32.5",
"structlog >= 24.4.0",
"loguru >= 0.7.3",
"ruff >= 0.8.3",
"pyright != 1.1.407",
"pre-commit>=3.5.0",
"coverage[toml]>=7.13.0",
"psycopg[binary] >= 3.2.3",
"psycopg2-binary >= 2.9.10",
"asyncpg >= 0.30.0",
"pymysql >= 1.1.1",
# >=48.0.1 ships a non-vulnerable OpenSSL (GHSA-537c-gmf6-5ccf).
"cryptography >= 48.0.1",
"cloudpickle>=3.0.0",
"anthropic>=0.27.0",
"sqlmodel>=0.0.15",
"mypy>=1.10.0",
"celery>=5.4.0",
"faststream[redis]>=0.5.0",
# https://github.com/testcontainers/testcontainers-python/issues/874
"testcontainers<4.13",
"mysql-connector-python>=8.0",
"pyarrow>=17.0.0; python_version < '3.13'",
"pyarrow>=18.1.0; python_version >= '3.13'",
# It looks like numpy didn't use to have `requires-python`, so we need to specify the version.
"numpy>=2.0; python_version < '3.12'",
"pytest-recording>=0.13.2",
# >=8.2.1 includes the aiohttp 3.14 compatibility fix and a fix for arbitrary
# code execution via unsafe YAML deserialization of cassettes (GHSA-rpj2-4hq8-938g).
"vcrpy>=8.2.1",
"uvicorn>=0.30.6",
"logfire-api",
"setuptools>=75.3.0",
# https://github.com/omnilib/aiosqlite/issues/369
"aiosqlite!=0.22.*",
"boto3 >= 1.28.57",
"botocore >= 1.31.57",
"greenlet >= 3.1.1",
"pytest-xdist>=3.6.1",
"openai-agents[voice]>=0.14.0",
"pydantic-ai-slim[mcp]>=2",
"pydantic-evals>=2",
# >=1.3.9 fixes path traversal / sandbox escape in file-search middleware and loaders (GHSA-gr75-jv2w-4656).
"langchain>=1.3.9",
"langchain-openai>=0.3.17",
"langgraph >= 0",
"opentelemetry-instrumentation-google-genai >= 0.4b0",
"google-genai >= 0",
"openinference-instrumentation-litellm >= 0",
"litellm != 1.80.9",
"openinference-instrumentation-dspy >= 0",
"dspy >= 3.1.0",
"pip >= 0",
"surrealdb >= 0",
"pytest-examples>=0.0.18",
"pytest-timeout>=2.4.0",
"pytest-asyncio>=0.24.0",
"pydantic-handlebars>=0.2.1",
"claude-agent-sdk>=0",
]
[tool.inline-snapshot]
default-flags = ["disable"]
format-command = "ruff format --stdin-filename {filename}"
[tool.uv.sources]
logfire-api = { workspace = true }
[tool.uv]
default-groups = ["dev"]
exclude-newer = "1 week"
[tool.uv.exclude-newer-package]
# These are our own packages, not worth defending from supply chain attacks on them.
pydantic_ai_slim = false
pydantic-graph = false
pydantic-evals = false
pydantic = false
pydantic-core = false
pydantic-handlebars = false
[tool.uv.workspace]
members = ["logfire-api"]
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.build.targets.wheel]
packages = ["logfire"]
[tool.hatch.build.targets.sdist]
include = ["/README.md", "CHANGELOG.md", "/Makefile", "/logfire", "/tests"]
# https://beta.ruff.rs/docs/configuration/
[tool.ruff]
line-length = 120
extend-exclude = ["logfire-api/logfire_api/*", "tests/auto_trace_samples/param_spec.py"]
[tool.ruff.lint]
extend-select = [
"Q", # https://docs.astral.sh/ruff/rules/#flake8-quotes-q
"RUF100", # https://docs.astral.sh/ruff/rules/unused-noqa/
"C90", # https://docs.astral.sh/ruff/rules/#mccabe-c90
"UP", # https://docs.astral.sh/ruff/rules/#pyupgrade-up
"I", # https://docs.astral.sh/ruff/rules/#isort-i
"D", # https://docs.astral.sh/ruff/rules/#pydocstyle-d
"DTZ005", # https://docs.astral.sh/ruff/rules/call-datetime-now-without-tzinfo/
"FA", # https://docs.astral.sh/ruff/rules/#flake8-future-annotations-fa
]
flake8-quotes = { inline-quotes = "single", multiline-quotes = "double" }
isort = { combine-as-imports = true, known-first-party = [
"logfire",
"logfire_api",
] }
mccabe = { max-complexity = 14 }
ignore = [
"D107", # ignore missing docstring in __init__ methods
"D100", # ignore missing docstring in module
"D104", # ignore missing docstring in public package
"D105", # ignore missing docstring in magic methods
"D418", # allow docstrings on overloads for the sake of logfire-api stubs
"C901", # ignore too complex functions, doesn't seem to be worth it
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = ["D"]
"docs/**/*.py" = ["D"]
"logfire-api/logfire_api/**/*.py" = ["D"]
[tool.ruff.format]
docstring-code-format = true
quote-style = "single"
[tool.pyright]
typeCheckingMode = "strict"
reportUnnecessaryTypeIgnoreComment = true
reportMissingTypeStubs = false
include = ["logfire", "tests"]
venvPath = "."
venv = ".venv"
[tool.pytest.ini_options]
xfail_strict = true
# The langsmith pytest plugin messes with test_langchain.py
addopts = "-p no:langsmith_plugin"
filterwarnings = [
"error",
# fastapi uses deprecated pydantic functions
"ignore:`FieldValidationInfo` is deprecated.*:DeprecationWarning:pydantic_core:",
"ignore:`general_(before|after|wrap|plain)_validator_function` is deprecated.*:DeprecationWarning:fastapi:",
"ignore:`general_(before|after|wrap|plain)_validator_function` is deprecated.*:DeprecationWarning:pydantic_core:",
# google packages are using deprecated APIs
"ignore::DeprecationWarning:pkg_resources*:",
"ignore::DeprecationWarning:google*:",
"ignore:.* google._upb._message.*:DeprecationWarning",
# OTEL uses some deprecated APIs
"ignore:pkg_resources:DeprecationWarning:opentelemetry.instrumentation.dependencies*:",
# To be able to test numpy.matrix
"ignore:the matrix subclass is not the recommended way.*:PendingDeprecationWarning",
# See test_filter_warnings in test_testing.py
'ignore:(?s).*google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.*scheduler\.shutdown.*IndexError. tuple index out of range:pytest.PytestUnhandledThreadExceptionWarning',
'ignore:(?s).*aiosqlite/core\.py.*get_loop\(future\).call_soon_threadsafe.*RuntimeError. Event loop is closed:pytest.PytestUnhandledThreadExceptionWarning',
# This problem is fixed in https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2013, but not the warning.
"ignore:The '__version__' attribute is deprecated and will be removed in Flask 3.1:DeprecationWarning",
"ignore:The `capture_request_headers` parameter is deprecated. Use `capture_headers` instead.:DeprecationWarning",
"ignore:The `capture_response_headers` parameter is deprecated. Use `capture_headers` instead.:DeprecationWarning",
# kombu using deprecated redis API
"ignore:Call to 'get_connection' function with deprecated usage of input argument/s.*:DeprecationWarning",
# celery's redis backend uses redis's deprecated `setex` (deprecated in redis-py 8.0)
"ignore:Call to deprecated setex.*:DeprecationWarning",
# OpenTelemetry event logger stuff being used by Pydantic AI
"ignore:You should use `\\w*(L|l)ogger\\w*` instead. Deprecated since version 1.39.0 and will be removed in a future release.:DeprecationWarning",
# flask.__version__ is deprecated and used by OTel
"ignore:The '__version__' attribute is deprecated and will be removed in Flask 3.2.*:DeprecationWarning",
# aiohttp web.Application is deprecated and used by OTel
"ignore:Inheritance class _InstrumentedApplication from web.Application is discouraged:DeprecationWarning",
# anthropic SDK warns when using older models that are still recorded in test cassettes
"ignore:The model 'claude-.*' is deprecated.*:DeprecationWarning",
]
DJANGO_SETTINGS_MODULE = "tests.otel_integrations.django_test_project.django_test_site.settings"
# https://coverage.readthedocs.io/en/latest/config.html#run
[tool.coverage.run]
branch = true
source = ["logfire", "logfire-api"]
omit = [
"*/tmp/*",
"*/temp/*",
"*/.pytest_cache/*",
"*/pytest-of-*/*",
]
#
# Subprocess coverage patching is enabled to measure coverage in child processes.
# This is particularly useful for tests that spawn subprocesses (e.g., Pytester tests).
#
# Note: This previously exposed a race condition in test_sqlalchemy_async_instrumentation
# which has been fixed by using unique temporary files per parametrized test instead of
# hardcoded filenames.
#
patch = ["subprocess"]
# Use this to get the tests that are covering the code. This is disabled by default because it can be slow.
# dynamic_context = "test_function"
# https://coverage.readthedocs.io/en/latest/config.html#report
[tool.coverage.report]
skip_covered = true
show_missing = true
ignore_errors = true
precision = 2
exclude_lines = [
'def __repr__',
'pragma: no cover',
'raise NotImplementedError',
'if TYPE_CHECKING:',
'if typing.TYPE_CHECKING:',
'@overload',
'@abstractmethod',
'@abc.abstractmethod',
'@typing.overload',
'\(Protocol\):$',
'typing.assert_never',
'assert_never',
'if __name__ == .__main__.:',
]