Skip to content

Commit

Permalink
Configuring with pyproject.toml (#996)
Browse files Browse the repository at this point in the history
* move configuration to pyproject.toml

Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
  • Loading branch information
WilliamBergamin and seratch authored Nov 29, 2023
1 parent 9209e7b commit 90467fb
Show file tree
Hide file tree
Showing 19 changed files with 139 additions and 169 deletions.
4 changes: 2 additions & 2 deletions .github/maintainers_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ If you make changes to `slack_bolt/adapter/*`, please verify if it surely works

```bash
# Install all optional dependencies
$ pip install -e ".[adapter]"
$ pip install -e ".[adapter_testing]"
$ pip install -r requirements/adapter.txt
$ pip install -r requirements/adapter_testing.txt

# Set required env variables
$ export SLACK_SIGNING_SECRET=***
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python setup.py install
pip install -U pip
pip install -e ".[async]"
pip install -e ".[adapter]"
pip install -e ".[testing]"
pip install -e ".[adapter_testing]"
pip install .
pip install -r requirements/async.txt
pip install -r requirements/adapter.txt
pip install -r requirements/testing.txt
pip install -r requirements/adapter_testing.txt
- name: Run all tests for codecov
run: |
pytest --cov=./slack_bolt/ --cov-report=xml
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python setup.py install
pip install -U pip
pip install -e ".[testing_without_asyncio]"
pip install -r requirements.txt
pip install -r requirements/testing_without_asyncio.txt
- name: Run tests without aiohttp
run: |
pytest tests/slack_bolt/
pytest tests/scenario_tests/
- name: Run tests for Socket Mode adapters
run: |
pip install -e ".[adapter]"
pip install -e ".[adapter_testing]"
pip install -r requirements/adapter.txt
pip install -r requirements/adapter_testing.txt
pytest tests/adapter_tests/socket_mode/
- name: Run tests for HTTP Mode adapters (AWS)
run: |
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
pytest tests/adapter_tests/tornado/
- name: Run tests for HTTP Mode adapters (asyncio-based libraries)
run: |
pip install -e ".[async]"
pip install -r requirements/async.txt
# Falcon supports Python 3.11 since its v3.1.1
pip install "falcon>=3.1.1,<4"
pytest tests/adapter_tests_async/
Expand Down
55 changes: 52 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,53 @@
# black project prefers pyproject.toml
# that's why we have this file in addition to other setting files
[build-system]
requires = ["setuptools", "pytest-runner==5.2", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "slack_bolt"
dynamic = ["version", "readme", "dependencies"]
description = "The Bolt Framework for Python"
license = { text = "MIT" }
authors = [{ name = "Slack Technologies, LLC", email = "opensource@slack.com" }]
classifiers = [
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
requires-python = ">=3.6"


[project.urls]
homepage = "https://github.com/slackapi/bolt-python"

[tool.setuptools.packages.find]
include = ["slack_bolt*"]

[tool.setuptools.dynamic]
version = { attr = "slack_bolt.version.__version__" }
readme = { file = ["README.md"], content-type = "text/markdown" }
dependencies = { file = ["requirements.txt"] }

[tool.distutils.bdist_wheel]
universal = true

[tool.black]
line-length = 125
line-length = 125

[tool.pytest.ini_options]
testpaths = ["tests"]
log_file = "logs/pytest.log"
log_file_level = "DEBUG"
log_format = "%(asctime)s %(levelname)s %(message)s"
log_date_format = "%Y-%m-%d %H:%M:%S"
filterwarnings = [
"ignore:\"@coroutine\" decorator is deprecated since Python 3.8, use \"async def\" instead:DeprecationWarning",
"ignore:The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.:DeprecationWarning",
]
asyncio_mode = "auto"
9 changes: 0 additions & 9 deletions pytest.ini

This file was deleted.

1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
slack_sdk>=3.25.0,<4
22 changes: 22 additions & 0 deletions requirements/adapter.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# pip install -r requirements/adapter.txt
# NOTE: any of async ones requires pip install -r requirements/async.txt too
# used only under slack_bolt/adapter
boto3<=2
bottle>=0.12,<1
chalice<=1.27.3; python_version=="3.6"
chalice>=1.28,<2; python_version>"3.6"
CherryPy>=18,<19
Django>=3,<5
falcon>=2,<4; python_version<"3.11"
falcon>=3.1.1,<4; python_version>="3.11"
fastapi>=0.70.0,<1
Flask>=1,<3
Werkzeug>=2,<3
pyramid>=1,<3
sanic>=20,<21; python_version=="3.6"
sanic>=22,<23; python_version>"3.6"
starlette>=0.14,<1
tornado>=6,<7
uvicorn<1 # The oldest version can vary among Python runtime versions
gunicorn>=20,<21
websocket_client>=1.2.3,<2 # Socket Mode 3rd party implementation
8 changes: 8 additions & 0 deletions requirements/adapter_testing.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# pip install -r requirements/adapter_testing.txt
moto>=3,<4 # For AWS tests
docker>=5,<6 # Used by moto
boddle>=0.2,<0.3 # For Bottle app tests
Flask>=1,<2 # TODO: Flask-Sockets is not yet compatible with Flask 2.x
Werkzeug>=1,<2 # TODO: Flask-Sockets is not yet compatible with Flask 2.x
sanic-testing>=0.7; python_version>"3.6"
requests>=2,<3 # For Starlette's TestClient
4 changes: 4 additions & 0 deletions requirements/async.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# pip install -r requirements/async.txt
aiohttp>=3,<4
websockets>=8,<10; python_version=="3.6"
websockets>=10,<11; python_version>"3.6"
6 changes: 6 additions & 0 deletions requirements/testing.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# pip install -r requirements/testing.txt
-r testing_without_asyncio.txt

pytest-asyncio>=0.16.0; python_version=="3.6"
pytest-asyncio>=0.18.2,<1; python_version>"3.6"
aiohttp>=3,<4
9 changes: 9 additions & 0 deletions requirements/testing_without_asyncio.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# pip install -r requirements/testing_without_asyncio.txt
pytest>=6.2.5,<7
pytest-cov>=3,<4
Flask-Sockets>=0.2,<1 # TODO: This module is not yet Flask 2.x compatible
Werkzeug>=1,<2 # TODO: Flask-Sockets is not yet compatible with Flask 2.x
itsdangerous==2.0.1 # TODO: Flask-Sockets is not yet compatible with Flask 2.x
Jinja2==3.0.3 # https://github.com/pallets/flask/issues/4494
black==22.8.0 # Until we drop Python 3.6 support, we have to stay with this version
click<=8.0.4 # black is affected by https://github.com/pallets/click/issues/2225
6 changes: 3 additions & 3 deletions scripts/build_pypi_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cd ${script_dir}/..
rm -rf ./slack_bolt.egg-info

pip install -U pip && \
pip install twine wheel && \
pip install twine build && \
rm -rf dist/ build/ slack_bolt.egg-info/ && \
python setup.py sdist bdist_wheel && \
twine check dist/*
python -m build --sdist --wheel && \
twine check dist/*
4 changes: 2 additions & 2 deletions scripts/deploy_to_pypi_org.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ cd ${script_dir}/..
rm -rf ./slack_bolt.egg-info

pip install -U pip && \
pip install twine wheel && \
pip install twine build && \
rm -rf dist/ build/ slack_bolt.egg-info/ && \
python setup.py sdist bdist_wheel && \
python -m build --sdist --wheel && \
twine check dist/* && \
twine upload dist/*
4 changes: 2 additions & 2 deletions scripts/deploy_to_test_pypi_org.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ cd ${script_dir}/..
rm -rf ./slack_bolt.egg-info

pip install -U pip && \
pip install twine wheel && \
pip install twine build && \
rm -rf dist/ build/ slack_bolt.egg-info/ && \
python setup.py sdist bdist_wheel && \
python -m build --sdist --wheel && \
twine check dist/* && \
twine upload --repository testpypi dist/*
24 changes: 13 additions & 11 deletions scripts/install_all_and_run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,28 @@ rm -rf ./slack_bolt.egg-info
pip uninstall python-lambda

test_target="$1"
python_version=`python --version | awk '{print $2}'`

pip install -e .
if [ ${python_version:0:3} == "3.6" ]
then
pip install -r requirements.txt
else
pip install -e .
fi

if [[ $test_target != "" ]]
then
# To fix: Using legacy 'setup.py install' for greenlet, since package 'wheel' is not installed.
pip install -U wheel && \
pip install -e ".[testing]" && \
pip install -e ".[adapter]" && \
pip install -e ".[adapter_testing]" && \
pip install -r requirements/testing.txt && \
pip install -r requirements/adapter.txt && \
pip install -r requirements/adapter_testing.txt && \
# To avoid errors due to the old versions of click forced by Chalice
pip install -U pip click && \
black slack_bolt/ tests/ && \
pytest $1
else
# To fix: Using legacy 'setup.py install' for greenlet, since package 'wheel' is not installed.
pip install -U wheel && \
pip install -e ".[testing]" && \
pip install -e ".[adapter]" && \
pip install -e ".[adapter_testing]" && \
pip install -r requirements/testing.txt && \
pip install -r requirements/adapter.txt && \
pip install -r requirements/adapter_testing.txt && \
# To avoid errors due to the old versions of click forced by Chalice
pip install -U pip click && \
black slack_bolt/ tests/ && \
Expand Down
5 changes: 3 additions & 2 deletions scripts/run_pytype.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

script_dir=$(dirname $0)
cd ${script_dir}/.. && \
pip install -e ".[async]" && \
pip install -e ".[adapter]" && \
pip install .
pip install -r requirements/async.txt && \
pip install -r requirements/adapter.txt && \
pip install "pytype==2022.12.15" && \
pytype slack_bolt/
4 changes: 2 additions & 2 deletions scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ else
# pytype's behavior can be different in older Python versions
black slack_bolt/ tests/ \
&& pytest -vv \
&& pip install -e ".[adapter]" \
&& pip install -e ".[adapter_testing]" \
&& pip install -r requirements/adapter.txt \
&& pip install -r requirements/adapter_testing.txt \
&& pip install -U pip setuptools wheel \
&& pip install -U pytype \
&& pytype slack_bolt/
Expand Down
5 changes: 0 additions & 5 deletions setup.cfg

This file was deleted.

Loading

0 comments on commit 90467fb

Please sign in to comment.