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

Latest version incompatible with latest Sanic version #726

Closed JWZepf closed 2 years ago

JWZepf commented 2 years ago

In Python, when trying to install the most recent version of slack_bolt (1.14.3) alongside the latest version of Sanic (22.6.2) with the async extras enabled, there is a dependency conflict with websockets. Currently, slack_bolt specifies "websockets>=8,<10" but Sanic requires "websockets>=10". To support the newest version of Sanic, support for websockets and sanic should be upgraded.

The last upgrade to the Sanic adapter was in https://github.com/slackapi/bolt-python/pull/432/files, and so these versions probably just need updating.

Reproducible in:

pip freeze | grep slack
python --version
sw_vers && uname -v # or `ver`

The slack_bolt version

$ poetry run pip freeze | grep slack
slack-bolt==1.14.3
slack-sdk==3.18.3

Python runtime version

$ poetry run python --version
Python 3.10.6

OS info

sw_vers && uname -v
ProductName:    macOS
ProductVersion: 12.6
BuildVersion:   21G115
Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64

Steps to reproduce:

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

  1. Set the following package versions in a package manager (I'm using poetry)
    slack-bolt = { version = "^1.14.3", extras = ["async"] }
    sanic = "^22.6.2"
  2. Try to install both packages (poetry install)
  3. Get error

Expected result:

Successful install

Actual result:

> poetry install
Updating dependencies
Resolving dependencies... (1.2s)

Because no versions of sanic match >22.6.2,<23.0.0
 and sanic (22.6.2) depends on websockets (>=10.0), sanic (>=22.6.2,<23.0.0) requires websockets (>=10.0).
And because slack-bolt (1.14.3) depends on websockets (>=8,<10)
 and no versions of slack-bolt match >1.14.3,<2.0.0, sanic (>=22.6.2,<23.0.0) is incompatible with slack-bolt (>=1.14.3,<2.0.0).
So, because <redacted> depends on both slack-bolt (^1.14.3) and sanic (^22.6.2), version solving failed.

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 2 years ago

Hi @JWZepf, thanks or sharing this! We will improve this in future versions.

zimeg commented 2 years ago

Hey @JWZepf! If you want to run the cutting edge version of bolt-python (the main branch, with the above PR) while using poetry, you could try the following:

  1. Clone this very bolt-python repo in the parent directory of your current project
  2. Build the package locally (step 1 in this section of the maintainer's guide)
  3. Update your Bolt import in your pyproject.toml file to use the local package:
slack-bolt = {path = "../bolt-python/dist/slack_bolt-1.14.3-py2.py3-none-any.whl", extras = ["async"] }
  1. Update your Poetry package imports for your app
$ poetry lock
$ poetry install
  1. Start your app as you normally do! Not sure how you do this, but I use ngrok and..
$ uvicorn async_app:api --reload --port 3000 --log-level debug

Poetry is a really beautiful package manager. Thanks for sharing this!

seratch commented 2 years ago

@e-zim Thanks for fixing this! @JWZepf We will release a new version including the fix within a few business days. Thanks again for taking the time to report this!

JWZepf commented 2 years ago

Checked the fix locally and everything looks good on my end. Thanks for the prompt response and fix!