You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2021/03/03 09:37:31 UTC

[airflow] 05/28: Upgrade slack_sdk to v3 (#13745)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v2-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 3c5173aa65778e495716a73f29f4b10632617f14
Author: Jyoti Dhiman <36...@users.noreply.github.com>
AuthorDate: Tue Jan 26 02:43:48 2021 +0530

    Upgrade slack_sdk to v3 (#13745)
    
    Co-authored-by: Kamil Breguła <ka...@polidea.com>
    Co-authored-by: Kamil Breguła <mi...@users.noreply.github.com>
    (cherry picked from commit 283945001363d8f492fbd25f2765d39fa06d757a)
---
 airflow/providers/slack/ADDITIONAL_INFO.md         | 25 ++++++++++++++++++++++
 .../providers/slack/BACKPORT_PROVIDER_README.md    |  2 +-
 airflow/providers/slack/README.md                  |  2 +-
 airflow/providers/slack/hooks/slack.py             |  4 ++--
 docs/conf.py                                       |  2 +-
 docs/spelling_wordlist.txt                         |  1 +
 scripts/ci/libraries/_verify_image.sh              |  2 +-
 setup.py                                           |  2 +-
 tests/providers/slack/hooks/test_slack.py          |  2 +-
 9 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/airflow/providers/slack/ADDITIONAL_INFO.md b/airflow/providers/slack/ADDITIONAL_INFO.md
new file mode 100644
index 0000000..9b05d8a
--- /dev/null
+++ b/airflow/providers/slack/ADDITIONAL_INFO.md
@@ -0,0 +1,25 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+# Migration Guide
+
+## 2.0.0
+
+We updated the support for `slack_sdk` from ``>=2.0.0,<3.0.0`` to ``>=3.0.0,<4.0.0``. In most cases, this doesn't mean any breaking changes to the DAG files, but if you used this library directly then you have to make the changes.
+For details, see [the Migration Guide](https://slack.dev/python-slack-sdk/v3-migration/index.html#from-slackclient-2-x) for Python Slack SDK.
diff --git a/airflow/providers/slack/BACKPORT_PROVIDER_README.md b/airflow/providers/slack/BACKPORT_PROVIDER_README.md
index 7863eb4..0e20d06 100644
--- a/airflow/providers/slack/BACKPORT_PROVIDER_README.md
+++ b/airflow/providers/slack/BACKPORT_PROVIDER_README.md
@@ -60,7 +60,7 @@ You can install this package on top of an existing airflow 1.10.* installation v
 
 | PIP package   | Version required   |
 |:--------------|:-------------------|
-| slackclient   | &gt;=2.0.0,&lt;3.0.0     |
+| slack_sdk   | &gt;=3.0.0,&lt;4.0.0     |
 
 ## Cross provider package dependencies
 
diff --git a/airflow/providers/slack/README.md b/airflow/providers/slack/README.md
index 7a630c6..ea4968a 100644
--- a/airflow/providers/slack/README.md
+++ b/airflow/providers/slack/README.md
@@ -61,7 +61,7 @@ You can install this package on top of an existing airflow 2.* installation via
 
 | PIP package   | Version required   |
 |:--------------|:-------------------|
-| slackclient   | &gt;=2.0.0,&lt;3.0.0     |
+| slack_sdk   | &gt;=3.0.0,&lt;4.0.0     |
 
 ## Cross provider package dependencies
 
diff --git a/airflow/providers/slack/hooks/slack.py b/airflow/providers/slack/hooks/slack.py
index 6f27091..da449a7 100644
--- a/airflow/providers/slack/hooks/slack.py
+++ b/airflow/providers/slack/hooks/slack.py
@@ -18,7 +18,7 @@
 """Hook for Slack"""
 from typing import Any, Optional
 
-from slack import WebClient
+from slack_sdk import WebClient
 
 from airflow.exceptions import AirflowException
 from airflow.hooks.base import BaseHook
@@ -41,7 +41,7 @@ class SlackHook(BaseHook):  # noqa
         slack_hook.call("chat.postMessage", json={"channel": "#random", "text": "Hello world!"})
 
         # Call method from Slack SDK (you have to handle errors yourself)
-        #  For more details check https://slack.dev/python-slackclient/basic_usage.html#sending-a-message
+        #  For more details check https://slack.dev/python-slack-sdk/web/index.html#messaging
         slack_hook.client.chat_postMessage(channel="#random", text="Hello world!")
 
     :param token: Slack API token
diff --git a/docs/conf.py b/docs/conf.py
index a60bbe3..411796c 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -391,7 +391,7 @@ autodoc_mock_imports = [
     'qds_sdk',
     'redis',
     'simple_salesforce',
-    'slackclient',
+    'slack_sdk',
     'smbclient',
     'snowflake',
     'sshtunnel',
diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt
index f8f8f83..71f9e34 100644
--- a/docs/spelling_wordlist.txt
+++ b/docs/spelling_wordlist.txt
@@ -1204,6 +1204,7 @@ skipable
 sku
 sla
 slackclient
+slack_sdk
 slas
 smtp
 sortable
diff --git a/scripts/ci/libraries/_verify_image.sh b/scripts/ci/libraries/_verify_image.sh
index 2092bd2..05e91c6 100644
--- a/scripts/ci/libraries/_verify_image.sh
+++ b/scripts/ci/libraries/_verify_image.sh
@@ -190,7 +190,7 @@ function verify_image::verify_production_image_python_modules() {
     verify_image::check_command "Import: redis" "python -c 'import redis'"
     verify_image::check_command "Import: sendgrid" "python -c 'import sendgrid'"
     verify_image::check_command "Import: sftp/ssh" "python -c 'import paramiko, pysftp, sshtunnel'"
-    verify_image::check_command "Import: slack" "python -c 'import slack'"
+    verify_image::check_command "Import: slack" "python -c 'import slack_sdk'"
     verify_image::check_command "Import: statsd" "python -c 'import statsd'"
     verify_image::check_command "Import: virtualenv" "python -c 'import virtualenv'"
 
diff --git a/setup.py b/setup.py
index 50f6a2f..0689bd5 100644
--- a/setup.py
+++ b/setup.py
@@ -417,7 +417,7 @@ sentry = [
 ]
 singularity = ['spython>=0.0.56']
 slack = [
-    'slackclient>=2.0.0,<3.0.0',
+    'slack_sdk>=3.0.0,<4.0.0',
 ]
 snowflake = [
     # The `azure` provider uses legacy `azure-storage` library, where `snowflake` uses the
diff --git a/tests/providers/slack/hooks/test_slack.py b/tests/providers/slack/hooks/test_slack.py
index cbe3d26..5fef409 100644
--- a/tests/providers/slack/hooks/test_slack.py
+++ b/tests/providers/slack/hooks/test_slack.py
@@ -20,7 +20,7 @@ import unittest
 from unittest import mock
 
 import pytest
-from slack.errors import SlackApiError
+from slack_sdk.errors import SlackApiError
 
 from airflow.exceptions import AirflowException
 from airflow.providers.slack.hooks.slack import SlackHook