Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Enable developers to inject non-bolt arguments to listener function args

Aberta
#709 7 comentários 3 reações 1 responsável Ver no GitHub

@seratch já está trabalhando nisso.

Desde 25/8/2022.

Avaliação

Esta issue ainda não foi avaliada.

Descrição

improvement

I'm using dependency_injector to provide automatic dependency injection for my application, and I'm encountering an issue with Bolt overriding injected parameters with None since it doesn't recognize them.

Reproducible in:
pip freeze | grep slack
python --version
sw_vers && uname -v # or `ver`
The slack_bolt version
slack-bolt==1.14.3
slack-sdk==3.18.1
Python runtime version
Python 3.10.6
OS info
ProductName:    macOS
ProductVersion: 12.5.1
BuildVersion:   21G83
Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000
Steps to reproduce:

(Share the commands to run, source code, and project settings (e.g., setup.py))

  1. Have a kwarg that is populated by some mechanism other than bolt (such as another decorator), e.g.
@app.command('/ping')
@inject
async def handle_ping(ack, respond, version: str = Provide[Container.config.VERSION]):
    await ack()
    await respond({
        "blocks": [
            SectionBlock(text=MarkdownTextObject(text='Pong!')),
            DividerBlock(),
            ContextBlock(elements=[
                MarkdownTextObject(text=f'*Host:* {platform.node()}'),
                MarkdownTextObject(text=f'*Version:* {version}')
            ])
        ]
    })
Expected result:

Bolt doesn't touch the version kwarg, but still injects the ack and respond kwargs.

Actual result:

version ends up being set to None and Bolt logs the following warning: version is not a valid argument.

This is caused by this line.

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.

Linguagem predominante
Python
Estrelas
1.3k
Forks
288
Merge médio
1d 8h
PRs com merge (30d)
10

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de slackapi/bolt-python

Todas as issues de slackapi/bolt-python

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.