slackapi / bolt-python

A framework to build Slack apps using Python
https://tools.slack.dev/bolt-python/
MIT License
1.06k stars 245 forks source link

Make `aiohttp` an optional dependency #802

Closed steve-marmalade closed 1 year ago

steve-marmalade commented 1 year ago

Currently, AsyncApp requires aiohttp to be installed, since it is imported here.

However, the docs imply that while aiohttp is used as the default server, others can be used via the adapters. Given that I am using this library in a starlette app, am I correct to say that aiohttp is not necessary for my use-case? If so, it would be great to have the option to install (and use) bolt-python without it.

Thanks!

Category (place an x in each of the [ ])

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.

seratch commented 1 year ago

Hi @steve-marmalade, thanks for writing in!

Indeed, you can go with any asyncio compatible web framework to serve the apps' endpoints to receive requests from Slack.

However, your app still needs aiohttp's HTTP client module for Slack API calls. The aiohttp project offers both web server and HTTP client features. bolt-python's AsyncWebClient depends on aiohttp: https://slack.dev/python-slack-sdk/web/index.html#asyncwebclient

You may be curious about the future plans of enhancement. Unfortunately, we are not planning to add a different HTTP client that does not rely on aiohttp at least in the short term.

Does this make sense to you? If everything is clear now, would you mind closing this issue?

seratch commented 1 year ago

I've provided an answer to this question, so let me close this issue now. But please feel free to write in whenever you have further questions on this topic. Thanks again for asking the question!