diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5a7b643..c3ac433 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ exclude: '^docs/.*$' default_language_version: - python: python3.8 + python: python3.10 repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 @@ -24,7 +24,7 @@ repos: rev: v3.9.0 hooks: - id: reorder-python-imports - args: [--py38-plus] + args: ['--py310-plus'] - repo: https://github.com/asottile/add-trailing-comma rev: v2.4.0 hooks: @@ -34,7 +34,7 @@ repos: rev: v3.3.1 hooks: - id: pyupgrade - args: [--py38-plus] + args: ['--py310-plus'] - repo: https://github.com/pre-commit/mirrors-autopep8 rev: v2.0.1 hooks: @@ -43,6 +43,8 @@ repos: rev: 23.1.0 hooks: - id: black + args: + - --target-version=py310 - repo: https://github.com/pycqa/flake8 rev: 5.0.4 hooks: diff --git a/piptools_requirements.txt b/piptools_requirements.txt new file mode 100644 index 0000000..405e60e --- /dev/null +++ b/piptools_requirements.txt @@ -0,0 +1,11 @@ +# +# This file is autogenerated by pip-compile with Python 3.10 +# by the following command: +# +# cd ~/src/omnibot && run-piptools +# + +pip==19.2 + # via -r /code/piptools/bootstrap_ins/requirements.in +setuptools==59.6.0 + # via -r /code/piptools/bootstrap_ins/requirements.in diff --git a/piptools_requirements3.txt b/piptools_requirements3.txt deleted file mode 100644 index d174f97..0000000 --- a/piptools_requirements3.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -# This file is autogenerated by pip-compile -# - -pip==19.2 -setuptools==59.6.0 diff --git a/requirements.in b/requirements.in index 646d245..70bc2e5 100644 --- a/requirements.in +++ b/requirements.in @@ -1,4 +1,4 @@ -# piptools: python3.8 +# piptools: python3.10 # WSGI HTTP Server for UNIX @@ -39,17 +39,17 @@ statsd==3.2.1 # Coroutine-based network library # License: MIT # Upstream url: http://www.gevent.org/ -gevent==21.1.2 +gevent==23.7.0 # Lightweight in-process concurrent programming # License: MIT # Upstream url: https://github.com/python-greenlet/greenlet -greenlet==1.1.0 +greenlet==2.0.2 # YAML parser and emitter for Python # License: MIT # Upstream url: http://pyyaml.org/wiki/PyYAML -PyYAML==5.4 +PyYAML==6.0.1 # The AWS SDK for Python # License: Apache2 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d8130e8 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,118 @@ +# +# This file is autogenerated by pip-compile with Python 3.10 +# by the following command: +# +# cd ~/src/omnibot && run-piptools +# +attrs==23.2.0 + # via pytest +blinker==1.4 + # via -r requirements.in +boto3==1.4.5 + # via -r requirements.in +botocore==1.5.95 + # via + # boto3 + # s3transfer +certifi==2024.2.2 + # via requests +charset-normalizer==3.3.2 + # via requests +click==7.1.2 + # via flask +coverage==7.4.4 + # via pytest-cov +docutils==0.20.1 + # via botocore +flask==1.1.4 + # via + # -r requirements.in + # flask-script +flask-script==2.0.5 + # via -r requirements.in +gevent==23.7.0 + # via -r requirements.in +greenlet==2.0.2 + # via + # -r requirements.in + # gevent +gunicorn==19.10.0 + # via -r requirements.in +idna==3.6 + # via requests +iniconfig==2.0.0 + # via pytest +itsdangerous==1.1.0 + # via flask +jinja2==2.11.3.post1 + # via flask +jmespath==0.10.0 + # via + # boto3 + # botocore +markupsafe==2.0.1 + # via jinja2 +packaging==24.0 + # via pytest +pluggy==0.13.1 + # via pytest +psutil==5.9.8 + # via rainbow-saddle +py==1.11.0 + # via pytest +pytest==6.2.4 + # via + # -r requirements.in + # pytest-cov + # pytest-mock +pytest-cov==2.11.1 + # via -r requirements.in +pytest-mock==3.6.1 + # via -r requirements.in +python-dateutil==2.9.0.post0 + # via botocore +python-json-logger==0.1.11 + # via -r requirements.in +python-redis-lock==3.2.0 + # via -r requirements.in +pyyaml==6.0.1 + # via -r requirements.in +rainbow-saddle==0.4.0 + # via -r requirements.in +redis==2.10.6 + # via + # -r requirements.in + # python-redis-lock +requests==2.31.0 + # via slackclient +s3transfer==0.1.13 + # via boto3 +six==1.16.0 + # via + # python-dateutil + # slackclient + # websocket-client +slackclient==1.3.1 + # via -r requirements.in +statsd==3.2.1 + # via -r requirements.in +toml==0.10.2 + # via pytest +urllib3==2.2.1 + # via requests +websocket-client==0.54.0 + # via slackclient +werkzeug==1.0.1 + # via flask +zope-event==5.0 + # via gevent +zope-interface==6.2 + # via gevent + +pip==19.2 + # via -r piptools_requirements.txt +setuptools==59.6.0 + # via + # -r piptools_requirements.txt + # zope-event + # zope-interface diff --git a/requirements3.txt b/requirements3.txt deleted file mode 100644 index 5cbf794..0000000 --- a/requirements3.txt +++ /dev/null @@ -1,57 +0,0 @@ -# -# This file is autogenerated by pip-compile -# To update, run: -# -# pip-compile --output-file=./requirements3.txt ./requirements.in -# -attrs==21.2.0 # via pytest -blinker==1.4 # via -r requirements.in -boto3==1.4.5 # via -r requirements.in -botocore==1.5.95 # via boto3, s3transfer -certifi==2022.12.7 # via requests -chardet==3.0.4 # via requests -click==7.0 # via flask -coverage==5.5 # via pytest-cov -docutils==0.15.2 # via botocore -flask-script==2.0.5 # via -r requirements.in -flask==1.1.1 # via -r requirements.in, flask-script -gevent==21.1.2 # via -r requirements.in -greenlet==1.1.0 # via -r requirements.in, gevent -gunicorn==19.9.0 # via -r requirements.in -idna==2.8 # via requests -importlib-metadata==4.0.1 # via pluggy, pytest -iniconfig==1.1.1 # via pytest -itsdangerous==1.1.0 # via flask -jinja2==2.11.3 # via flask -jmespath==0.9.4 # via boto3, botocore -markupsafe==1.1.1 # via jinja2 -packaging==20.9 # via pytest -pluggy==0.13.1 # via pytest -psutil==5.6.6 # via rainbow-saddle -py==1.10.0 # via pytest -pyparsing==2.4.7 # via packaging -pytest-cov==2.11.1 # via -r requirements.in -pytest-mock==3.6.1 # via -r requirements.in -pytest==6.2.4 # via -r requirements.in, pytest-cov, pytest-mock -python-dateutil==2.8.0 # via botocore -python-json-logger==0.1.11 # via -r requirements.in -python-redis-lock==3.2.0 # via -r requirements.in -pyyaml==5.4 # via -r requirements.in -rainbow-saddle==0.4.0 # via -r requirements.in -redis==2.10.6 # via -r requirements.in, python-redis-lock -requests==2.22.0 # via slackclient -s3transfer==0.1.13 # via boto3 -six==1.12.0 # via python-dateutil, slackclient, websocket-client -slackclient==1.0.7 # via -r requirements.in -statsd==3.2.1 # via -r requirements.in -toml==0.10.2 # via pytest -typing-extensions==3.10.0.0 # via importlib-metadata -urllib3==1.26.5 # via requests -websocket-client==0.56.0 # via slackclient -werkzeug==0.15.5 # via flask -zipp==3.4.1 # via importlib-metadata -zope.event==4.5.0 # via gevent -zope.interface==5.4.0 # via gevent - -pip==19.2 # via -r piptools_requirements3.txt -setuptools==59.6.0 # via -r piptools_requirements3.txt, gevent, zope.event, zope.interface diff --git a/tests/integration/routes/test_interactive.py b/tests/integration/routes/test_interactive.py index ccdb859..807b8ff 100644 --- a/tests/integration/routes/test_interactive.py +++ b/tests/integration/routes/test_interactive.py @@ -1,6 +1,5 @@ import json from typing import Any -from typing import Dict from unittest.mock import MagicMock from flask import Response # noqa: F401 @@ -18,7 +17,7 @@ def test_dialog_submission_echo_test( slack_api_call: MagicMock, ): with get_mock_data("interactive/dialog_submission_echo_test.json") as json_data: - event: Dict[str, Any] = json.loads(json_data.read()) + event: dict[str, Any] = json.loads(json_data.read()) resp: Response = client.post( _ENDPOINT, data=event, @@ -70,8 +69,8 @@ def test_invalid_component_type( slack_api_call: MagicMock, ): with get_mock_data("interactive/dialog_submission_echo_test.json") as json_data: - payload: Dict[str, Any] = json.loads(json_data.read()) - modified_data: Dict[str, Any] = json.loads(payload["payload"]) + payload: dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(payload["payload"]) modified_data["type"] = "not a valid type" resp: Response = client.post( _ENDPOINT, @@ -90,8 +89,8 @@ def test_invalid_component_type( def test_missing_token(client: Client, queue: MagicMock, slack_api_call: MagicMock): with get_mock_data("interactive/dialog_submission_echo_test.json") as json_data: - payload: Dict[str, Any] = json.loads(json_data.read()) - modified_data: Dict[str, Any] = json.loads(payload["payload"]) + payload: dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(payload["payload"]) modified_data.pop("token", None) resp: Response = client.post( _ENDPOINT, @@ -107,8 +106,8 @@ def test_missing_token(client: Client, queue: MagicMock, slack_api_call: MagicMo def test_missing_team(client: Client, queue: MagicMock, slack_api_call: MagicMock): with get_mock_data("interactive/dialog_submission_echo_test.json") as json_data: - payload: Dict[str, Any] = json.loads(json_data.read()) - modified_data: Dict[str, Any] = json.loads(payload["payload"]) + payload: dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(payload["payload"]) modified_data.pop("team", None) resp: Response = client.post( _ENDPOINT, @@ -124,8 +123,8 @@ def test_missing_team(client: Client, queue: MagicMock, slack_api_call: MagicMoc def test_unsupported_team(client: Client, queue: MagicMock, slack_api_call: MagicMock): with get_mock_data("interactive/dialog_submission_echo_test.json") as json_data: - payload: Dict[str, Any] = json.loads(json_data.read()) - modified_data: Dict[str, Any] = json.loads(payload["payload"]) + payload: dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(payload["payload"]) modified_data["team"]["id"] = "something random" resp: Response = client.post( _ENDPOINT, @@ -141,8 +140,8 @@ def test_unsupported_team(client: Client, queue: MagicMock, slack_api_call: Magi def test_invalid_token(client: Client, queue: MagicMock, slack_api_call: MagicMock): with get_mock_data("interactive/dialog_submission_echo_test.json") as json_data: - payload: Dict[str, Any] = json.loads(json_data.read()) - modified_data: Dict[str, Any] = json.loads(payload["payload"]) + payload: dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(payload["payload"]) modified_data["token"] = "something random" resp: Response = client.post( _ENDPOINT, @@ -165,8 +164,8 @@ def test_invalid_callback_id( slack_api_call: MagicMock, ): with get_mock_data("interactive/dialog_submission_echo_test.json") as json_data: - payload: Dict[str, Any] = json.loads(json_data.read()) - modified_data: Dict[str, Any] = json.loads(payload["payload"]) + payload: dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(payload["payload"]) modified_data["callback_id"] = "something random" resp: Response = client.post( _ENDPOINT, @@ -193,7 +192,7 @@ def test_view_submission_synchronous( with get_mock_data( "interactive/view_submission_synchronous_test.json", ) as json_data: - event: Dict[str, Any] = json.loads(json_data.read()) + event: dict[str, Any] = json.loads(json_data.read()) resp: Response = client.post( _ENDPOINT, data=event, diff --git a/tests/integration/routes/test_slack_event.py b/tests/integration/routes/test_slack_event.py index 8a8dd26..7e62b4b 100644 --- a/tests/integration/routes/test_slack_event.py +++ b/tests/integration/routes/test_slack_event.py @@ -1,6 +1,5 @@ import json from typing import Any -from typing import Dict from unittest.mock import MagicMock from flask import Response # noqa: F401 @@ -34,7 +33,7 @@ def test_event_callback_omnibot_help( queue: MagicMock, ): with get_mock_data("event/event_callback_omnibot_help.json") as json_data: - event: Dict[str, Any] = json.loads(json_data.read()) + event: dict[str, Any] = json.loads(json_data.read()) resp: Response = client.post( _ENDPOINT, data=json.dumps(event), @@ -52,7 +51,7 @@ def test_event_callback_test_message( queue: MagicMock, ): with get_mock_data("event/event_callback_test_message.json") as json_data: - event: Dict[str, Any] = json.loads(json_data.read()) + event: dict[str, Any] = json.loads(json_data.read()) resp: Response = client.post( _ENDPOINT, data=json.dumps(event), @@ -70,7 +69,7 @@ def test_misisng_verification_token( queue: MagicMock, ): with get_mock_data("event/url_verification.json") as json_data: - modified_data: Dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(json_data.read()) modified_data.pop("token", None) resp: Response = client.post( _ENDPOINT, @@ -90,7 +89,7 @@ def test_invalid_verification_token( queue: MagicMock, ): with get_mock_data("event/url_verification.json") as json_data: - modified_data: Dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(json_data.read()) modified_data["token"] = "something random" resp: Response = client.post( _ENDPOINT, @@ -106,7 +105,7 @@ def test_invalid_verification_token( def test_missing_app_id(client: Client, instrument: MagicMock, queue: MagicMock): with get_mock_data("event/event_callback_omnibot_help.json") as json_data: - modified_data: Dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(json_data.read()) modified_data.pop("api_app_id", None) resp: Response = client.post( _ENDPOINT, @@ -122,7 +121,7 @@ def test_missing_app_id(client: Client, instrument: MagicMock, queue: MagicMock) def test_missing_team_id(client: Client, instrument: MagicMock, queue: MagicMock): with get_mock_data("event/event_callback_omnibot_help.json") as json_data: - modified_data: Dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(json_data.read()) modified_data.pop("team_id", None) resp: Response = client.post( _ENDPOINT, @@ -138,7 +137,7 @@ def test_missing_team_id(client: Client, instrument: MagicMock, queue: MagicMock def test_invalid_team(client: Client, instrument: MagicMock, queue: MagicMock): with get_mock_data("event/event_callback_omnibot_help.json") as json_data: - modified_data: Dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(json_data.read()) modified_data["team_id"] = "something random" resp: Response = client.post( _ENDPOINT, @@ -154,7 +153,7 @@ def test_invalid_team(client: Client, instrument: MagicMock, queue: MagicMock): def test_invalid_bot(client: Client, instrument: MagicMock, queue: MagicMock): with get_mock_data("event/event_callback_omnibot_help.json") as json_data: - modified_data: Dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(json_data.read()) modified_data["api_app_id"] = "something random" resp: Response = client.post( _ENDPOINT, @@ -174,7 +173,7 @@ def test_invalid_verification_token_for_valid_bot( queue: MagicMock, ): with get_mock_data("event/event_callback_omnibot_help.json") as json_data: - modified_data: Dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(json_data.read()) modified_data["token"] = "something random" resp: Response = client.post( _ENDPOINT, @@ -194,7 +193,7 @@ def test_event_missing_event_block( queue: MagicMock, ): with get_mock_data("event/event_callback_omnibot_help.json") as json_data: - modified_data: Dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(json_data.read()) modified_data.pop("event", None) resp: Response = client.post( _ENDPOINT, diff --git a/tests/integration/routes/test_slash_command.py b/tests/integration/routes/test_slash_command.py index 2af4e52..d73ec9f 100644 --- a/tests/integration/routes/test_slash_command.py +++ b/tests/integration/routes/test_slash_command.py @@ -1,6 +1,5 @@ import json from typing import Any -from typing import Dict from unittest.mock import MagicMock from flask import Response # noqa: F401 @@ -14,7 +13,7 @@ def test_user_issues_echo_command(client: Client, queue: MagicMock): with get_mock_data("slash_command/user_issues_echo_command.json") as json_data: - event: Dict[str, Any] = json.loads(json_data.read()) + event: dict[str, Any] = json.loads(json_data.read()) resp: Response = client.post( _ENDPOINT, data=event, @@ -29,7 +28,7 @@ def test_user_issues_echo_command(client: Client, queue: MagicMock): def test_missing_token(client: Client, queue: MagicMock): with get_mock_data("slash_command/user_issues_echo_command.json") as json_data: - modified_data: Dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(json_data.read()) modified_data.pop("token", None) resp: Response = client.post( _ENDPOINT, @@ -44,7 +43,7 @@ def test_missing_token(client: Client, queue: MagicMock): def test_missing_team_id(client: Client, queue: MagicMock): with get_mock_data("slash_command/user_issues_echo_command.json") as json_data: - modified_data: Dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(json_data.read()) modified_data.pop("team_id", None) resp: Response = client.post( _ENDPOINT, @@ -59,7 +58,7 @@ def test_missing_team_id(client: Client, queue: MagicMock): def test_invalid_verification_token(client: Client, queue: MagicMock): with get_mock_data("slash_command/user_issues_echo_command.json") as json_data: - modified_data: Dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(json_data.read()) modified_data["token"] = "something random" resp: Response = client.post( _ENDPOINT, @@ -77,7 +76,7 @@ def test_invalid_verification_token(client: Client, queue: MagicMock): def test_unsupported_team(client: Client, queue: MagicMock): with get_mock_data("slash_command/user_issues_echo_command.json") as json_data: - modified_data: Dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(json_data.read()) modified_data["team_id"] = "something random" resp: Response = client.post( _ENDPOINT, @@ -92,7 +91,7 @@ def test_unsupported_team(client: Client, queue: MagicMock): def test_missing_handler(client: Client, queue: MagicMock): with get_mock_data("slash_command/user_issues_echo_command.json") as json_data: - modified_data: Dict[str, Any] = json.loads(json_data.read()) + modified_data: dict[str, Any] = json.loads(json_data.read()) modified_data["command"] = "/somethingrandom" resp: Response = client.post( _ENDPOINT,