streaq


Namestreaq JSON
Version 5.1.0 PyPI version JSON
download
home_pageNone
SummaryFast, async, type-safe job queuing with Redis streams
upload_time2025-08-02 00:22:53
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT License Copyright (c) 2025 tastyware Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Docs](https://readthedocs.org/projects/streaq/badge/?version=latest)](https://streaq.readthedocs.io/en/latest/?badge=latest)
[![PyPI](https://img.shields.io/pypi/v/streaq)](https://pypi.org/project/streaq)
[![Downloads](https://static.pepy.tech/badge/streaq)](https://pepy.tech/project/streaq)
[![Release)](https://img.shields.io/github/v/release/tastyware/streaq?label=release%20notes)](https://github.com/tastyware/streaq/releases)

# streaQ

Fast, async, type-safe distributed task queue via Redis streams

## Features

- Up to [5x faster](https://github.com/tastyware/streaq/tree/master/benchmarks) than `arq`
- Strongly typed
- 95%+ unit test coverage
- Comprehensive documentation
- Support for delayed/scheduled tasks
- Cron jobs
- Task middleware
- Task dependency graph
- Pipelining
- Priority queues
- Support for synchronous tasks (run in separate threads)
- Redis Sentinel support for production
- Built-in web UI for monitoring tasks
- Built with structured concurrency on `anyio`

## Installation

```console
$ pip install streaq
```

## Getting started

To start, you'll need to create a `Worker` object:

```python
from streaq import Worker

worker = Worker(redis_url="redis://localhost:6379")
```

You can then register async tasks with the worker like this:

```python
import asyncio

@worker.task()
async def sleeper(time: int) -> int:
    await asyncio.sleep(time)
    return time

@worker.cron("* * * * mon-fri")  # every minute on weekdays
async def cronjob() -> None:
    print("Nobody respects the spammish repetition!")
```

Finally, let's queue up some tasks:

```python
await sleeper.enqueue(3)
# enqueue returns a task object that can be used to get results/info
task = await sleeper.enqueue(1).start(delay=3)
print(await task.info())
print(await task.result(timeout=5))
```

Putting this all together gives us [example.py](https://github.com/tastyware/streaq/blob/master/example.py). Let's spin up a worker:
```
$ streaq example.worker
```
and queue up some tasks like so:
```
$ python example.py
```

Let's see what the output looks like:

```
[INFO] 02:14:30: starting worker 3265311d for 2 functions
[INFO] 02:14:35: task cf0c55387a214320bd23e8987283a562 → worker 3265311d
[INFO] 02:14:38: task cf0c55387a214320bd23e8987283a562 ← 3
[INFO] 02:14:40: task 1de3f192ee4a40d4884ebf303874681c → worker 3265311d
[INFO] 02:14:41: task 1de3f192ee4a40d4884ebf303874681c ← 1
[INFO] 02:15:00: task 2a4b864e5ecd4fc99979a92f5db3a6e0 → worker 3265311d
Nobody respects the spammish repetition!
[INFO] 02:15:00: task 2a4b864e5ecd4fc99979a92f5db3a6e0 ← None
```
```
TaskInfo(fn_name='sleeper', enqueue_time=1751508876961, tries=0, scheduled=datetime.datetime(2025, 7, 3, 2, 14, 39, 961000, tzinfo=datetime.timezone.utc), dependencies=set(), dependents=set())
TaskResult(fn_name='sleeper', enqueue_time=1751508876961, success=True, result=1, start_time=1751508880500, finish_time=1751508881503, tries=1, worker_id='ca5bd9eb')
```

For more examples, check out the [documentation](https://streaq.readthedocs.io/en/latest/).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "streaq",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Graeme Holliday <graeme@tastyware.dev>",
    "download_url": "https://files.pythonhosted.org/packages/2d/37/5442f81f0f2a27f98862a0de906d84e9bb41db38abec55642293d00a9f79/streaq-5.1.0.tar.gz",
    "platform": null,
    "description": "[![Docs](https://readthedocs.org/projects/streaq/badge/?version=latest)](https://streaq.readthedocs.io/en/latest/?badge=latest)\n[![PyPI](https://img.shields.io/pypi/v/streaq)](https://pypi.org/project/streaq)\n[![Downloads](https://static.pepy.tech/badge/streaq)](https://pepy.tech/project/streaq)\n[![Release)](https://img.shields.io/github/v/release/tastyware/streaq?label=release%20notes)](https://github.com/tastyware/streaq/releases)\n\n# streaQ\n\nFast, async, type-safe distributed task queue via Redis streams\n\n## Features\n\n- Up to [5x faster](https://github.com/tastyware/streaq/tree/master/benchmarks) than `arq`\n- Strongly typed\n- 95%+ unit test coverage\n- Comprehensive documentation\n- Support for delayed/scheduled tasks\n- Cron jobs\n- Task middleware\n- Task dependency graph\n- Pipelining\n- Priority queues\n- Support for synchronous tasks (run in separate threads)\n- Redis Sentinel support for production\n- Built-in web UI for monitoring tasks\n- Built with structured concurrency on `anyio`\n\n## Installation\n\n```console\n$ pip install streaq\n```\n\n## Getting started\n\nTo start, you'll need to create a `Worker` object:\n\n```python\nfrom streaq import Worker\n\nworker = Worker(redis_url=\"redis://localhost:6379\")\n```\n\nYou can then register async tasks with the worker like this:\n\n```python\nimport asyncio\n\n@worker.task()\nasync def sleeper(time: int) -> int:\n    await asyncio.sleep(time)\n    return time\n\n@worker.cron(\"* * * * mon-fri\")  # every minute on weekdays\nasync def cronjob() -> None:\n    print(\"Nobody respects the spammish repetition!\")\n```\n\nFinally, let's queue up some tasks:\n\n```python\nawait sleeper.enqueue(3)\n# enqueue returns a task object that can be used to get results/info\ntask = await sleeper.enqueue(1).start(delay=3)\nprint(await task.info())\nprint(await task.result(timeout=5))\n```\n\nPutting this all together gives us [example.py](https://github.com/tastyware/streaq/blob/master/example.py). Let's spin up a worker:\n```\n$ streaq example.worker\n```\nand queue up some tasks like so:\n```\n$ python example.py\n```\n\nLet's see what the output looks like:\n\n```\n[INFO] 02:14:30: starting worker 3265311d for 2 functions\n[INFO] 02:14:35: task cf0c55387a214320bd23e8987283a562 \u2192 worker 3265311d\n[INFO] 02:14:38: task cf0c55387a214320bd23e8987283a562 \u2190 3\n[INFO] 02:14:40: task 1de3f192ee4a40d4884ebf303874681c \u2192 worker 3265311d\n[INFO] 02:14:41: task 1de3f192ee4a40d4884ebf303874681c \u2190 1\n[INFO] 02:15:00: task 2a4b864e5ecd4fc99979a92f5db3a6e0 \u2192 worker 3265311d\nNobody respects the spammish repetition!\n[INFO] 02:15:00: task 2a4b864e5ecd4fc99979a92f5db3a6e0 \u2190 None\n```\n```\nTaskInfo(fn_name='sleeper', enqueue_time=1751508876961, tries=0, scheduled=datetime.datetime(2025, 7, 3, 2, 14, 39, 961000, tzinfo=datetime.timezone.utc), dependencies=set(), dependents=set())\nTaskResult(fn_name='sleeper', enqueue_time=1751508876961, success=True, result=1, start_time=1751508880500, finish_time=1751508881503, tries=1, worker_id='ca5bd9eb')\n```\n\nFor more examples, check out the [documentation](https://streaq.readthedocs.io/en/latest/).\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2025 tastyware\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "Fast, async, type-safe job queuing with Redis streams",
    "version": "5.1.0",
    "project_urls": {
        "Changelog": "https://github.com/tastyware/streaq/releases",
        "Documentation": "https://streaq.rtfd.io",
        "Funding": "https://github.com/sponsors/tastyware",
        "Homepage": "https://github.com/tastyware/streaq",
        "Source": "https://github.com/tastyware/streaq"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "bc2dc51b9dfd435d1fae03f4affa8eab9bc589df2b570ba7a2cd4ef7259a5bb3",
                "md5": "a3c6bf98b34abca78b2c308b4e751da1",
                "sha256": "c815ee63ef54c97fbdc06e7bd6778b072538c2e9a64bf097cdba4780bf491aa1"
            },
            "downloads": -1,
            "filename": "streaq-5.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a3c6bf98b34abca78b2c308b4e751da1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 33383,
            "upload_time": "2025-08-02T00:22:51",
            "upload_time_iso_8601": "2025-08-02T00:22:51.470544Z",
            "url": "https://files.pythonhosted.org/packages/bc/2d/c51b9dfd435d1fae03f4affa8eab9bc589df2b570ba7a2cd4ef7259a5bb3/streaq-5.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2d375442f81f0f2a27f98862a0de906d84e9bb41db38abec55642293d00a9f79",
                "md5": "c8ad9ef64ef257ade8fe0dd93bf46961",
                "sha256": "b74664384bb20c0c71aba9cfb18279f8ca14f50cf43fe7afb8ae3b9c25a188b6"
            },
            "downloads": -1,
            "filename": "streaq-5.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c8ad9ef64ef257ade8fe0dd93bf46961",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 138993,
            "upload_time": "2025-08-02T00:22:53",
            "upload_time_iso_8601": "2025-08-02T00:22:53.271813Z",
            "url": "https://files.pythonhosted.org/packages/2d/37/5442f81f0f2a27f98862a0de906d84e9bb41db38abec55642293d00a9f79/streaq-5.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-02 00:22:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tastyware",
    "github_project": "streaq",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "streaq"
}
        
Elapsed time: 0.59477s