Skip to content

Commit c3dc2bf

Browse files
committed
Replaced flake with ruff + github flow.
1 parent 4d6fa7c commit c3dc2bf

File tree

8 files changed

+63
-72
lines changed

8 files changed

+63
-72
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ jobs:
88
matrix:
99
cmd:
1010
- black
11-
- flake8
12-
- isort
11+
- ruff
1312
- mypy
14-
- autoflake
1513
runs-on: ubuntu-latest
1614
steps:
1715
- uses: actions/checkout@v2
@@ -20,7 +18,7 @@ jobs:
2018
- name: Set up Python
2119
uses: actions/setup-python@v4
2220
with:
23-
python-version: "3.9"
21+
python-version: "3.11"
2422
cache: "poetry"
2523
- name: Install deps
2624
run: poetry install
@@ -43,7 +41,7 @@ jobs:
4341
- 5672:5672
4442
strategy:
4543
matrix:
46-
py_version: ["3.8", "3.9", "3.10", "3.11"]
44+
py_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
4745
runs-on: "ubuntu-latest"
4846
steps:
4947
- uses: actions/checkout@v2

.pre-commit-config.yaml

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,39 @@ repos:
66
hooks:
77
- id: check-ast
88
- id: trailing-whitespace
9-
exclude: 'README.md'
109
- id: check-toml
1110
- id: end-of-file-fixer
1211

1312
- repo: https://github.com/asottile/add-trailing-comma
1413
rev: v2.1.0
1514
hooks:
16-
- id: add-trailing-comma
15+
- id: add-trailing-comma
1716

1817
- repo: local
1918
hooks:
2019
- id: black
2120
name: Format with Black
22-
entry: black
21+
entry: poetry run black
2322
language: system
2423
types: [python]
2524

26-
- id: autoflake
27-
name: autoflake
28-
entry: autoflake
29-
language: system
30-
types: [ python ]
31-
args: [ --in-place, --remove-all-unused-imports, --remove-duplicate-keys ]
32-
33-
- id: isort
34-
name: isort
35-
entry: isort
36-
language: system
37-
types: [ python ]
38-
39-
- id: flake8
40-
name: Check with Flake8
41-
entry: flake8
25+
- id: ruff
26+
name: Run ruff lints
27+
entry: poetry run ruff
4228
language: system
4329
pass_filenames: false
44-
types: [ python ]
45-
args: [--count, taskiq_aio_pika]
30+
types: [python]
31+
args:
32+
- "check"
33+
- "--fix"
34+
- "taskiq_aio_pika"
35+
- "tests"
4636

4737
- id: mypy
4838
name: Validate types with MyPy
49-
entry: mypy
50-
language: system
51-
types: [ python ]
52-
53-
- id: yesqa
54-
name: Remove usless noqa
55-
entry: yesqa
39+
entry: poetry run mypy
5640
language: system
57-
types: [ python ]
41+
types: [python]
42+
args:
43+
- taskiq_aio_pika
44+
- tests

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ You can send delayed messages and set priorities to messages using labels.
2424

2525
To send delayed message, you have to specify
2626
delay label. You can do it with `task` decorator,
27-
or by using kicker.
27+
or by using kicker.
2828
In this type of delay we are using additional queue with `expiration` parameter and after with time message will be deleted from `delay` queue and sent to the main taskiq queue.
2929
For example:
3030

@@ -58,9 +58,9 @@ To send delayed message you can install `rabbitmq-delayed-message-exchange`
5858
plugin https://github.com/rabbitmq/rabbitmq-delayed-message-exchange.
5959

6060
And you need to configure you broker.
61-
There is `delayed_message_exchange_plugin` `AioPikaBroker` parameter and it must be `True` to turn on delayed message functionality.
61+
There is `delayed_message_exchange_plugin` `AioPikaBroker` parameter and it must be `True` to turn on delayed message functionality.
6262

63-
The delay plugin can handle tasks with different delay times well, and the delay based on dead letter queue is suitable for tasks with the same delay time.
63+
The delay plugin can handle tasks with different delay times well, and the delay based on dead letter queue is suitable for tasks with the same delay time.
6464
For example:
6565

6666
```python

poetry.lock

Lines changed: 34 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ aio-pika = "^9.0"
2626
[tool.poetry.dev-dependencies]
2727
pytest = "^7.0"
2828
isort = "^5.10.1"
29-
mypy = "^0.971"
29+
mypy = "^1"
3030
black = "^22.6.0"
3131
pre-commit = "^2.20.0"
3232
pytest-xdist = { version = "^2.5.0", extras = ["psutil"] }
@@ -45,6 +45,7 @@ show_error_codes = true
4545
implicit_reexport = true
4646
allow_untyped_decorators = true
4747
warn_return_any = false
48+
explicit_package_bases = true
4849

4950
[tool.isort]
5051
profile = "black"
@@ -117,7 +118,7 @@ convention = "pep257"
117118
ignore-decorators = ["typing.overload"]
118119

119120
[tool.ruff.lint.pylint]
120-
allow-magic-value-types = ["int", "str", "float"]
121+
allow-magic-value-types = ["int", "str", "float", "bytes"]
121122

122123
[tool.ruff.lint.flake8-bugbear]
123124
extend-immutable-calls = ["taskiq_dependencies.Depends", "taskiq.TaskiqDepends"]

taskiq_aio_pika/broker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from aio_pika.abc import AbstractChannel, AbstractQueue, AbstractRobustConnection
88
from taskiq import AckableMessage, AsyncBroker, AsyncResultBackend, BrokerMessage
99

10-
_T = TypeVar("_T") # noqa: WPS111
10+
_T = TypeVar("_T")
1111

1212
logger = getLogger("taskiq.aio_pika_broker")
1313

@@ -35,7 +35,7 @@ def parse_val(
3535
class AioPikaBroker(AsyncBroker):
3636
"""Broker that works with RabbitMQ."""
3737

38-
def __init__( # noqa: WPS211
38+
def __init__(
3939
self,
4040
url: Optional[str] = None,
4141
result_backend: Optional[AsyncResultBackend[_T]] = None,
@@ -119,7 +119,7 @@ def __init__( # noqa: WPS211
119119
self.write_channel: Optional[AbstractChannel] = None
120120
self.read_channel: Optional[AbstractChannel] = None
121121

122-
async def startup(self) -> None: # noqa: WPS217
122+
async def startup(self) -> None:
123123
"""Create exchange and queue on startup."""
124124
await super().startup()
125125
self.write_conn = await connect_robust(

tests/__init__.py

Whitespace-only changes.

tests/test_broker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ async def get_first_task(broker: AioPikaBroker) -> AckableMessage: # type: igno
1717
:param broker: async message broker.
1818
:return: first message from listen method
1919
"""
20-
async for message in broker.listen():
20+
async for message in broker.listen(): # noqa: RET503
2121
return message
2222

2323

0 commit comments

Comments
 (0)