ltq 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ltq/worker.py CHANGED
@@ -5,6 +5,8 @@ from functools import partial
5
5
  from pathlib import Path
6
6
  from typing import TYPE_CHECKING, Any, Awaitable, Callable, ParamSpec
7
7
 
8
+ import redis.asyncio as redis
9
+
8
10
  from .errors import RetryMessage
9
11
  from .task import Task
10
12
  from .message import Message
@@ -24,12 +26,12 @@ P = ParamSpec("P")
24
26
  class Worker:
25
27
  def __init__(
26
28
  self,
27
- client: AsyncRedis,
29
+ url: str = "redis://localhost:6379",
28
30
  middlewares: list[Middleware] | None = None,
29
31
  concurrency: int = 250,
30
32
  poll_sleep: float = 0.1,
31
33
  ) -> None:
32
- self.client: AsyncRedis = client
34
+ self.client: AsyncRedis = redis.from_url(url)
33
35
  self.tasks: list[Task] = []
34
36
  self.middlewares: list[Middleware] = middlewares or []
35
37
  self.concurrency: int = concurrency
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ltq
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Add your description here
5
5
  Author: Tom Clesius
6
6
  Author-email: Tom Clesius <tomclesius@gmail.com>
@@ -11,7 +11,7 @@ Provides-Extra: sentry
11
11
  Description-Content-Type: text/markdown
12
12
 
13
13
  <p align="center">
14
- <img src="assets/logo.png" alt="LTQ" width="400">
14
+ <img src="https://raw.githubusercontent.com/tclesius/ltq/refs/heads/main/assets/logo.png" alt="LTQ" width="400">
15
15
  </p>
16
16
 
17
17
  <p align="center">
@@ -30,11 +30,9 @@ uv add ltq
30
30
 
31
31
  ```python
32
32
  import asyncio
33
- import redis.asyncio as redis
34
33
  import ltq
35
34
 
36
- client = redis.from_url("redis://localhost:6379")
37
- worker = ltq.Worker(client=client)
35
+ worker = ltq.Worker(url="redis://localhost:6379")
38
36
 
39
37
  @worker.task()
40
38
  async def send_email(to: str, subject: str, body: str) -> None:
@@ -83,7 +81,7 @@ Add middleware to handle cross-cutting concerns:
83
81
  from ltq.middleware import Retry, RateLimit, Timeout
84
82
 
85
83
  worker = ltq.Worker(
86
- client=client,
84
+ url="redis://localhost:6379",
87
85
  middlewares=[
88
86
  Retry(max_retries=3, min_delay=1.0),
89
87
  RateLimit(requests_per_second=10),
@@ -6,8 +6,8 @@ ltq/message.py,sha256=C6gJR6KuRrnIb-l9Jna7e-XIu_aFHBhnZICUqE1_2MU,715
6
6
  ltq/middleware.py,sha256=NMRI7UiJiUTqAHOB18Gz686mQGszSu-6hJiyTDPCKdE,3631
7
7
  ltq/q.py,sha256=LddedNdb9uYD9qAjkzN0inBhvQ-mp6uJLgguEhv_TeE,2462
8
8
  ltq/task.py,sha256=anX9jKGGrNr8JDEhJ4L-QALbOUSDWkYHRwjyZDYCCDs,1008
9
- ltq/worker.py,sha256=dMYiX4oz_PCq0yytI0WalPPamBdVNXg1QVH92lRZkX0,2866
10
- ltq-0.1.0.dist-info/WHEEL,sha256=XV0cjMrO7zXhVAIyyc8aFf1VjZ33Fen4IiJk5zFlC3g,80
11
- ltq-0.1.0.dist-info/entry_points.txt,sha256=OogYaOJ_RORrWtrLlEL_gTN9Vx5tkgawl8BO7G9FKcg,38
12
- ltq-0.1.0.dist-info/METADATA,sha256=rfFU1puSrxGuiwDHTVT7ofUfMtwSx7FvawqnXo7YgqQ,2303
13
- ltq-0.1.0.dist-info/RECORD,,
9
+ ltq/worker.py,sha256=wqWHzRcZwDP8TRX1TJ6DA7RlIsiVyF4oeZcQdDywZps,2927
10
+ ltq-0.1.1.dist-info/WHEEL,sha256=XV0cjMrO7zXhVAIyyc8aFf1VjZ33Fen4IiJk5zFlC3g,80
11
+ ltq-0.1.1.dist-info/entry_points.txt,sha256=OogYaOJ_RORrWtrLlEL_gTN9Vx5tkgawl8BO7G9FKcg,38
12
+ ltq-0.1.1.dist-info/METADATA,sha256=fW53GkOFYMynG5IjrdsJFn4kjOMhDesBTdGla5oYj2I,2316
13
+ ltq-0.1.1.dist-info/RECORD,,
File without changes