-
Notifications
You must be signed in to change notification settings - Fork 276
Open
Description
Reproducible in:
The slack_bolt version
slack-bolt==1.26.0
slack-sdk==3.34.0
Python runtime version
Python 3.12.0
OS info
ubuntu-latest (but reproducible on any OS)
Steps to reproduce:
- Create a file with a lazy listener:
from slack_bolt import App
app = App(token="xoxb-xxx", signing_secret="xxx")
def process_mention(event, say, logger):
say("Hello!")
@app.event("app_mention", lazy=[process_mention])
def handle_mention():
pass- Run mypy:
mypy your_file.py
- Observe error
Expected result:
No mypy error. The lazy parameter is a valid, documented feature and should be included in the type signature.
Actual result:
your_file.py:9: error: Unexpected keyword argument "lazy" for "event" of "App" [call-arg]Root cause: The lazy parameter is handled via **kwargs in the inner call function (app.py line 846), but it's not declared in the event() method signature. Same issue affects message(), action(), command(), etc.
Suggested fix: Add lazy to the method signatures:
def event(
self,
event: ...,
matchers: ... = None,
middleware: ... = None,
lazy: Optional[Sequence[Callable[..., Optional[BoltResponse]]]] = None,
) -> ...:Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
Metadata
Metadata
Assignees
Labels
No labels