Skip to content

Commit c2a590d

Browse files
committed
docs: add inline comment explaining deferred agent imports
1 parent 29ffbb8 commit c2a590d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

slack_bolt/context/async_context.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ async def handle_mention(agent):
207207
`AsyncBoltAgent` instance
208208
"""
209209
if "agent" not in self:
210+
# Deferred import: AsyncBoltAgent is only imported at runtime when accessed,
211+
# avoiding unnecessary loading when the agent property is never used.
210212
from slack_bolt.agent.async_agent import AsyncBoltAgent
211213

212214
self["agent"] = AsyncBoltAgent(

slack_bolt/context/context.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ def handle_mention(agent):
208208
`BoltAgent` instance
209209
"""
210210
if "agent" not in self:
211+
# Deferred import: BoltAgent is only imported at runtime when accessed,
212+
# avoiding unnecessary loading when the agent property is never used.
211213
from slack_bolt.agent.agent import BoltAgent
212214

213215
self["agent"] = BoltAgent(

0 commit comments

Comments
 (0)