Metadata-Version: 2.1
Name: fennel
Version: 0.3.0
Summary: A task queue for Python based on Redis Streams.
Home-page: https://fennel.dev
License: MIT
Keywords: task,queue,background,redis,async
Author: Matt Westcott
Author-email: m.westcott@gmail.com
Requires-Python: >=3.7,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Dist: anyio (>=2.0.0-beta.2,<3.0.0)
Requires-Dist: aredis (>=1.1.8,<2.0.0)
Requires-Dist: click (>=7.0,<8.0)
Requires-Dist: colorama (>=0.4.1,<0.5.0)
Requires-Dist: hiredis (>=1.1.0,<2.0.0)
Requires-Dist: pydantic (>=1.5,<2.0)
Requires-Dist: redis (>=3.3,<4.0)
Requires-Dist: structlog (>=20.0,<21.0)
Requires-Dist: uvloop (>=0.14.0,<0.15.0)
Project-URL: Repository, https://github.com/mjwestcott/fennel
Description-Content-Type: text/markdown

## Fennel

A task queue for Python 3.7+ based on Redis Streams with a Celery-like API.

https://fennel.dev/

| Note: This is an *alpha* release. The project is under development, breaking changes are likely. |
| --- |

### Features

* Supports both sync (e.g. Django, Flask) and async (e.g. Starlette, FastAPI) code.
* Sane defaults: at least once processing semantics, tasks acknowledged on completion.
* Automatic retries with exponential backoff for fire-and-forget jobs.
* Clear task statuses available (e.g. sent, executing, success).
* Automatic task discovery (defaults to using ``**/tasks.py``).
* Exceptionally small and understandable codebase.

### Installation

```bash
pip install fennel
```

### Basic Usage

Run [Redis](https://redis.io) and then execute your code in `tasks.py`:
```python
from fennel import App

app = App(name='myapp', redis_url='redis://127.0.0.1')


@app.task
def foo(n):
    return n


# Enqueue a task to be executed in the background by a fennel worker process.
foo.delay(7)
```

Meanwhile, run the worker:
```bash
$ fennel worker --app tasks:app
```

### Asynchronous API

Fennel also supports an async API. If your code is running in an event loop
(e.g. via [Starlette](https://www.starlette.io/) or
[FastAPI](https://fastapi.tiangolo.com/)), you will want to use the async
interface instead:
```python
from fennel import App

app = App(name='myapp', redis_url='redis://127.0.0.1', interface='async')


@app.task
async def bar(x):
    return x


await bar.delay(5)
```

### See also

If you need to ensure that all tasks for a given key are processed in-order,
please see our sister project [Runnel](https://github.com/mjwestcott/runnel).

