Skip to content

Commit 380ee8e

Browse files
bug: fix deprecation warnings by bumping python minimum version (#10)
* Bump min python version to 3.9 * Update _utils.sh * removed typed dict * Update check_update.py * test for pypy support
1 parent a85d12e commit 380ee8e

File tree

7 files changed

+28
-41
lines changed

7 files changed

+28
-41
lines changed

.github/maintainers_guide.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@ Install necessary Python runtimes for development/testing. You can rely on GitHu
2020
```zsh
2121
pyenv install -l | grep -v "-e[conda|stackless|pypy]"
2222

23-
pyenv install 3.8.5 # select the latest patch version
24-
pyenv local 3.8.5
23+
pyenv install 3.9.18 # select the latest patch version
24+
pyenv local 3.9.18
2525

2626
pyenv versions
2727
system
2828
3.6.10
2929
3.7.7
30-
* 3.8.5 (set by /path-to-python-slack-hooks/.python-version)
30+
* 3.9.18 (set by /path-to-python-slack-hooks/.python-version)
3131

3232
pyenv rehash
3333
```
3434

3535
Then, you can create a new Virtual Environment this way:
3636

3737
```zsh
38-
python -m venv env_3.8.5
39-
source env_3.8.5/bin/activate
38+
python -m venv env_3.9.18
39+
source env_3.9.18/bin/activate
4040
```
4141

4242
## Tasks

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
timeout-minutes: 5
1313
strategy:
1414
matrix:
15-
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
15+
python-version: ["3.9", "3.10", "3.11", "3.12", "pypy3.10"]
1616
steps:
1717
- uses: actions/checkout@v4
1818
- name: Set up Python ${{ matrix.python-version }}

README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
1-
# Python Slack Hooks
1+
<h1 align="center">Python Slack Hooks</h1>
2+
3+
<p align="center">
4+
<a href="https://pypi.org/project/slack-cli-hooks/">
5+
<img alt="PyPI - Version" src="https://img.shields.io/pypi/v/slack-cli-hooks?style=flat-square"></a>
6+
<a href="https://pypi.org/project/slack-cli-hooks/">
7+
<img alt="Python Versions" src="https://img.shields.io/pypi/pyversions/slack-cli-hooks.svg?style=flat-square"></a>
8+
</p>
29

310
This library defines the contract between the
411
[Slack CLI](https://api.slack.com/automation/cli/install) and
512
[Bolt for Python](https://slack.dev/bolt-python/).
613

714
## Overview
8-
This library enables inter-process communication between the [Slack CLI](https://api.slack.com/automation/cli/install) and applications built with Bolt for Python.
915

10-
When used together, the CLI delegates various tasks to the Bolt application by invoking processes ("hooks") and then making use of the responses provided by each hook's `stdout`.
16+
This library enables inter-process communication between the [Slack CLI](https://api.slack.com/automation/cli/install) and applications built with Bolt for Python.
17+
18+
When used together, the CLI delegates various tasks to the Bolt application by invoking processes ("hooks") and then making use of the responses provided by each hook's `stdout`.
1119

1220
For a complete list of available hooks, read the [Supported Hooks](#supported-hooks) section.
1321

1422
## Requirements
23+
1524
The latest minor version of [Bolt v1](https://pypi.org/project/slack-bolt/) is recommended.
1625

1726
## Usage
27+
1828
A Slack CLI-compatible Slack application includes a `./slack.json` file that contains hooks specific to that project. Each hook is associated with commands that are available in the Slack CLI. By default, `get-hooks` retrieves all of the [supported hooks](#supported-hooks) and their corresponding scripts as defined in this library.
1929

2030
The CLI will always use the version of the `python-slack-hooks` that is specified in the project's `requirements.txt`.
@@ -30,15 +40,15 @@ The hooks currently supported for use within the Slack CLI include `check-update
3040
| `get-manifest` | `slack manifest` | [get_manifest.py](./slack_cli_hooks/hooks/get_manifest.py) | Converts a `manifest.json` file into a valid manifest JSON payload. |
3141
| `start` | `slack run` | [start.py](./slack_cli_hooks/hooks/start.py) | While developing locally, the CLI manages a socket connection with Slack's backend and utilizes this hook for events received via this connection. |
3242

33-
3443
### Overriding Hooks
35-
To customize the behavior of a hook, add the hook to your application's `/slack.json` file, and provide a corresponding script to be executed.
44+
45+
To customize the behavior of a hook, add the hook to your application's `/slack.json` file, and provide a corresponding script to be executed.
3646

3747
When commands are run, the Slack CLI will look to the project's hook definitions and use those instead of what's defined in this library, if provided.
3848

3949
Below is an example `/slack.json` file that overrides the default `start`:
4050

41-
```
51+
```json
4252
{
4353
"hooks": {
4454
"get-hooks": "python3 -m slack_cli_hooks.hooks.get_hooks",
@@ -51,4 +61,4 @@ Below is an example `/slack.json` file that overrides the default `start`:
5161

5262
Contributions are always welcome! Please review the
5363
[contributing guidelines](https://github.com/slackapi/python-slack-hooks/blob/main/.github/CONTRIBUTING.md)
54-
for more information.
64+
for more information.

pyproject.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dynamic = ["version", "readme", "dependencies"]
88
description = "The Slack CLI contract implementation for Bolt Python"
99
license = { text = "MIT" }
1010
authors = [{ name = "Slack Technologies, LLC", email = "[email protected]" }]
11-
requires-python = ">=3.6"
11+
requires-python = ">=3.9"
1212
classifiers = [
1313
"Development Status :: 2 - Pre-Alpha",
1414
"Environment :: Console",
@@ -18,9 +18,6 @@ classifiers = [
1818
"License :: OSI Approved :: MIT License",
1919
"Programming Language :: Python",
2020
"Programming Language :: Python :: 3 :: Only",
21-
"Programming Language :: Python :: 3.6",
22-
"Programming Language :: Python :: 3.7",
23-
"Programming Language :: Python :: 3.8",
2421
"Programming Language :: Python :: 3.9",
2522
"Programming Language :: Python :: 3.10",
2623
"Programming Language :: Python :: 3.11",

requirements/format.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
black==22.8.0; python_version=="3.6"
2-
black; python_version>"3.6" # Until we drop Python 3.6 support, we have to stay with this version
1+
black
32
flake8>=5.0.4, <7;
43
pytype; (python_version<"3.11" or python_version>"3.11")
54
pytype==2023.11.29; python_version=="3.11"

scripts/_utils.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,8 @@ clean_project() {
1010
}
1111

1212
install_development_requirements() {
13-
python_version=`python --version | awk '{print $2}'`
14-
15-
if [ ${python_version:0:3} == "3.6" ]
16-
then
17-
pip install -r requirements.txt
18-
else
19-
pip install -e .
20-
fi
21-
2213
pip install -U pip
14+
pip install -e .
2315
pip install -r requirements/testing.txt
2416
pip install -r requirements/format.txt
2517
}

slack_cli_hooks/hooks/check_update.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import slack_bolt
99
import slack_sdk
10-
from pkg_resources import parse_version as Version
10+
from packaging.version import Version
1111

1212
import slack_cli_hooks.version
1313
from slack_cli_hooks.error import PypiError
@@ -18,17 +18,6 @@
1818
DEPENDENCIES: List[ModuleType] = [slack_cli_hooks, slack_bolt, slack_sdk]
1919

2020

21-
def parse_major(v: Version) -> int:
22-
"""The first item of :attr:`release` or ``0`` if unavailable.
23-
24-
>>> parse_major(Version("1.2.3"))
25-
1
26-
"""
27-
# This implementation comes directly from the Version implementation since it is not supported in 3.6
28-
# source: https://github.com/pypa/packaging/blob/main/src/packaging/version.py
29-
return v._version.release[0] if len(v._version) >= 1 else 0 # type: ignore
30-
31-
3221
class Release:
3322
def __init__(
3423
self,
@@ -44,7 +33,7 @@ def __init__(
4433
self.current = current.base_version
4534
self.latest = latest.base_version
4635
self.update = current < latest
47-
self.breaking = (parse_major(current) - parse_major(latest)) != 0
36+
self.breaking = (current.major - latest.major) != 0
4837
if error:
4938
self.error = error
5039
if message:

0 commit comments

Comments
 (0)