Skip to content

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
s3rius committed Jun 11, 2023
2 parents b6a691b + 7563395 commit 2238311
Show file tree
Hide file tree
Showing 8 changed files with 318 additions and 479 deletions.
18 changes: 9 additions & 9 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,6 @@ ignore =
; Do not perform function calls in argument defaults.
B008,

; all init files
__init__.py:
; ignore not used imports
F401,
; ignore import with wildcard
F403,
; Found wrong metadata variable
WPS410,

per-file-ignores =
; all tests
test_*.py,tests.py,tests_*.py,*/tests/*:
Expand All @@ -116,6 +107,15 @@ per-file-ignores =
; Found outer scope names shadowing
tests/conftest.py: WPS442

; all init files
__init__.py:
; ignore not used imports
F401,
; ignore import with wildcard
F403,
; Found wrong metadata variable
WPS410,

exclude =
./.git,
./venv,
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
pytest:
services:
zookeeper:
image: bitnami/zookeeper
image: bitnami/zookeeper:3.8.1
ports:
- 2181:2181
env:
Expand All @@ -40,7 +40,7 @@ jobs:
--health-timeout 5s
--health-retries 5
kafka:
image: bitnami/kafka
image: bitnami/kafka:3.4.1
ports:
- 9092:9092
options: >-
Expand All @@ -53,13 +53,14 @@ jobs:
ALLOW_PLAINTEXT_LISTENER: yes
KAFKA_CFG_LISTENERS: PLAINTEXT://:9092
KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://127.0.0.1:9092
KAFKA_ENABLE_KRAFT: "no"
permissions:
checks: write
pull-requests: write
contents: write
strategy:
matrix:
py_version: ["3.7", "3.8", "3.9", "3.10"]
py_version: ["3.8", "3.9", "3.10", "3.11"]
os: [ubuntu-latest]
runs-on: "${{ matrix.os }}"
steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async def test() -> None:

## Non-obvious things

You can configure kafka producer and consumer with special methods `configure_producer` and `configure_consumer`.
You can configure kafka producer and consumer with special methods `configure_producer` and `configure_consumer`.
Example:
```python
from taskiq_aio_kafka import AioKafkaBroker
Expand Down
741 changes: 290 additions & 451 deletions poetry.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ name = "taskiq-aio-kafka"
description = "Kafka broker for taskiq"
authors = ["Taskiq team <[email protected]>"]
maintainers = ["Taskiq team <[email protected]>"]
version = "0.1.2"
version = "0.2.0"
readme = "README.md"
license = "LICENSE"
classifiers = [
"Typing :: Typed",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"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",
"Operating System :: OS Independent",
"Intended Audience :: Developers",
"Topic :: System :: Networking",
Expand All @@ -24,20 +24,20 @@ keywords = ["taskiq", "tasks", "distributed", "async", "kafka", "aiokafka"]
packages = [{ include = "taskiq_aio_kafka" }]

[tool.poetry.dependencies]
python = "^3.7"
python = "^3.8.1"
taskiq = "^0"
aiokafka = "^0.8.0"
pydantic = "^1.10.7"

[tool.poetry.group.dev.dependencies]
pytest = "^7.1.2"
flake8 = "^4.0.1"
flake8 = "^6"
isort = "^5.10.1"
mypy = "^1.2.0"
pre-commit = "^2.20.0"
yesqa = "^1.3.0"
autoflake = "^1.4"
wemake-python-styleguide = "^0.16.1"
wemake-python-styleguide = "^0.18.0"
coverage = "^6.4.2"
pytest-cov = "^3.0.0"
mock = "^4.0.3"
Expand Down
1 change: 0 additions & 1 deletion taskiq_aio_kafka/broker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import asyncio
import pickle # noqa: S403
from logging import getLogger
from typing import Any, AsyncGenerator, Callable, List, Optional, Set, TypeVar, Union

Expand Down
6 changes: 3 additions & 3 deletions taskiq_aio_kafka/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ class KafkaProducerParameters(BaseModel):
class KafkaConsumerParameters(BaseModel):
"""Parameters to kafka consumer."""

client_id: str = "aiokafka-" + __version__ # noqa: WPS336
client_id: str = f"aiokafka-{__version__}"
group_id: Optional[str] = None
key_deserializer: Optional[Callable[..., Any]] = None
value_deserializer: Optional[Callable[..., Any]] = None
fetch_max_wait_ms: int = 500
fetch_max_bytes: int = 52428800
fetch_min_bytes: int = 1
max_partition_fetch_bytes: int = 1 * 1024 * 1024 # noqa: WPS345
request_timeout_ms: int = 40 * 1000 # noqa: WPS432
max_partition_fetch_bytes: int = 1024 * 1024
request_timeout_ms: int = 40000
retry_backoff_ms: int = 100
auto_offset_reset: str = "latest"
enable_auto_commit: bool = True
Expand Down
12 changes: 6 additions & 6 deletions tests/test_broker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import asyncio
import pickle # noqa: S403
import pickle
from typing import Dict, List
from uuid import uuid4

Expand All @@ -17,7 +17,7 @@ async def get_first_task(broker: AioKafkaBroker) -> bytes: # type: ignore
:returns: first message from listen method
"""
async for message in broker.listen(): # noqa: WPS328
async for message in broker.listen():
return message


Expand Down Expand Up @@ -65,13 +65,13 @@ async def test_startup(
:param broker_without_arguments: broker.
:param base_topic_name: base topic name.
"""
assert broker_without_arguments._aiokafka_consumer # noqa: WPS437
assert broker_without_arguments._aiokafka_producer # noqa: WPS437
assert broker_without_arguments._kafka_admin_client # noqa: WPS437
assert broker_without_arguments._aiokafka_consumer
assert broker_without_arguments._aiokafka_producer
assert broker_without_arguments._kafka_admin_client

all_kafka_topics: List[
str
] = broker_without_arguments._kafka_admin_client.list_topics() # noqa: WPS437
] = broker_without_arguments._kafka_admin_client.list_topics()

assert broker_without_arguments._kafka_topic.name in all_kafka_topics

Expand Down

0 comments on commit 2238311

Please sign in to comment.