Skip to content

Commit 038ed63

Browse files
committed
Prepare the package for publication
* Add a changelog * Remove the dubious behavior to allow coroutines in gather * Export gather and pause from the queueio module * Add the publish workflow
1 parent 2fd0820 commit 038ed63

9 files changed

Lines changed: 72 additions & 80 deletions

File tree

.github/workflows/publish.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Publish to PyPI
2+
on:
3+
release:
4+
types:
5+
- published
6+
7+
jobs:
8+
publish:
9+
permissions:
10+
id-token: write
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: astral-sh/setup-uv@v5
15+
- run: uv build
16+
- name: Publish package distributions to PyPI
17+
uses: pypa/gh-action-pypi-publish@release/v1

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Changelog
2+
=========
3+
4+
All notable changes to this project will be documented in this file.
5+
6+
The format is loosely based on [Keep a Changelog](https://keepachangelog.com).
7+
8+
[0.2.0] - 2025-11-22
9+
--------------------
10+
11+
### Acknowledgement
12+
13+
Thank you to Nick Anderegg for allowing me to use the queueio name for this project.
14+
15+
### Added
16+
17+
- `routine` decorator to declare sync or async functions as background routines.
18+
- `activate` context manager to activate the queueio system.
19+
- `pause` to coordinate a pause of a routine to queueio.
20+
- `gather` to run multiple routines concurrently and gather the results.
21+
- `Routine.submit()` method to submit a routine invocation to the queue.
22+
- Configuration in the `tool.queueio` section of `pyproject.toml`.
23+
- `pika` configures the pika library to connect to the AMQP broker.
24+
- `register` configures the modules that declare routines.
25+
- `QUEUEIO_PIKA` environment variable
26+
to override the `pika` configuration in `pyproject.toml`.
27+
- `queueio sync` command to synchronize queues to the broker.
28+
- `queueio run` command to run the queueio worker.
29+
- The queuespec syntax to `queue run` to consume multiple queues with shared capacity.
30+
- `queueio monitor` command to monitor activity in the queueio system.
31+
32+
[0.2.0]: https://github.com/ryanhiebert/queueio/releases/tag/0.2

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ Create your routines:
2121
# basic.py
2222
from time import sleep
2323

24+
from queueio import gather
25+
from queueio import pause
2426
from queueio import routine
25-
from queueio.gather import gather
26-
from queueio.pause import pause
2727

2828

2929
@routine(name="blocking", queue="queueio")
@@ -77,7 +77,7 @@ with activate():
7777
Then run the worker to process submitted routines:
7878

7979
```sh
80-
queueio run queueio=3
80+
queueio run queueio=4
8181
```
8282

8383
Monitor the status of active routine invocations:
@@ -89,8 +89,8 @@ queueio monitor
8989
Stability
9090
---------
9191

92-
This is a new project.
93-
The design of the public API is under active development and will change.
94-
Release notes will provide clear upgrade instructions,
92+
The design of the public API is under active development
93+
and is likely to change with any release.
94+
Release notes will provide upgrade instructions,
9595
but backward compatibility and deprecation warnings
9696
will not generally be implemented.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "queueio"
3-
version = "0.2"
3+
version = "0.2.0"
44
description = "Python background queues with an async twist"
55
readme = "README.md"
66
license = "MIT"

queueio/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from contextlib import contextmanager
22

3+
from .gather import gather as gather
4+
from .pause import pause as pause
35
from .queueio import QueueIO as RealQueueIO
46
from .registry import routine as routine
57

queueio/gather.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
1-
from collections.abc import Awaitable
21
from collections.abc import Iterable
32
from concurrent.futures import Future
43
from typing import Any
54
from typing import overload
65

7-
from .suspend import suspend
86
from .suspension import Suspension
97

108

119
class Gather[T](Suspension[T]):
12-
def __init__(self, awaitables: Iterable[Awaitable[Any]]):
10+
def __init__(self, suspensions: Iterable[Suspension[Any]]):
1311
super().__init__()
14-
self.__awaitables = awaitables
12+
self.__suspensions = suspensions
1513

1614
def submit(self) -> Future[T]:
1715
gathered = Future()
18-
futures = [
19-
suspension.submit() for suspension in map(suspend, self.__awaitables)
20-
]
16+
futures = [suspension.submit() for suspension in self.__suspensions]
2117

2218
# concurrent.futures.Future doesn't give us a way to be notified
2319
# when a future is running, so we can't reasonably determine when
@@ -56,26 +52,26 @@ def on_done(future):
5652
return gathered
5753

5854

59-
A = Awaitable
55+
S = Suspension
6056

6157

6258
@overload
63-
def gather[T1](a: A[T1], /) -> Gather[tuple[T1]]: ...
59+
def gather[T1](s: S[T1], /) -> Gather[tuple[T1]]: ...
6460
@overload
65-
def gather[T1, T2](a1: A[T1], a2: A[T2], /) -> Gather[tuple[T1, T2]]: ...
61+
def gather[T1, T2](s1: S[T1], s2: S[T2], /) -> Gather[tuple[T1, T2]]: ...
6662
@overload
6763
def gather[T1, T2, T3](
68-
a1: A[T1], a2: A[T2], a3: A[T3], /
64+
s1: S[T1], s2: S[T2], s3: S[T3], /
6965
) -> Gather[tuple[T1, T2, T3]]: ...
7066
@overload
7167
def gather[T1, T2, T3, T4](
72-
a1: A[T1], a2: A[T2], a3: A[T3], a4: A[T4], /
68+
s1: S[T1], s2: S[T2], s3: S[T3], s4: S[T4], /
7369
) -> Gather[tuple[T1, T2, T3, T4]]: ...
7470
@overload
7571
def gather[T1, T2, T3, T4, T5](
76-
a1: A[T1], a2: A[T2], a3: A[T3], a4: A[T4], a5: A[T5], /
72+
s1: S[T1], s2: S[T2], s3: S[T3], s4: S[T4], s5: S[T5], /
7773
) -> Gather[tuple[T1, T2, T3, T4, T5]]: ...
7874

7975

80-
def gather(*awaitables: Awaitable[Any]) -> Gather[Any]:
81-
return Gather(awaitables)
76+
def gather(*suspensions: Suspension[Any]) -> Gather[Any]:
77+
return Gather(suspensions)

queueio/samples/basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
from time import sleep
44

5+
from queueio import gather
6+
from queueio import pause
57
from queueio import routine
6-
from queueio.gather import gather
7-
from queueio.pause import pause
88

99

1010
@routine(name="blocking", queue="queueio")

queueio/samples/expanded.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ async def irregular():
4141
print("irregular sleep ended. Starting queueio pause.")
4242
await pause(0.4)
4343
print("queueio pause ended")
44-
await gather(regular(7, 2), pause(0.5), abstract(8, 1))
44+
await gather(regular(7, 2), pause(0.5))
4545
return await abstract(2, 5)

queueio/suspend.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)