Skip to content

Commit b01d24b

Browse files
authored
Fix structlog import (#217)
1 parent 00a8ae3 commit b01d24b

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

logfire/integrations/structlog.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
"""Logfire processor for structlog."""
22

3-
from structlog.types import EventDict, WrappedLogger
3+
from __future__ import annotations
4+
5+
from typing import TYPE_CHECKING
46

57
import logfire
68

79
from .._internal.constants import ATTRIBUTES_MESSAGE_KEY
810
from .logging import RESERVED_ATTRS as LOGGING_RESERVED_ATTRS
911

12+
# This file is currently imported eagerly from __init__.py, so it shouldn't import structlog directly
13+
# since that's not a required dependency.
14+
if TYPE_CHECKING:
15+
from structlog.types import EventDict, WrappedLogger
16+
1017
RESERVED_ATTRS = LOGGING_RESERVED_ATTRS | {'level', 'event', 'timestamp'}
1118
"""Attributes to strip from the event before sending to Logfire."""
1219

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "logfire"
7-
version = "0.36.0"
7+
version = "0.36.1"
88
description = "The best Python observability tool! 🪵🔥"
99
authors = [
1010
{ name = "Pydantic Team", email = "[email protected]" },

0 commit comments

Comments
 (0)