Overview

docs Documentation Status
tests
Github Actions Build Status

package
PyPI Package latest release PyPI Wheel Supported versions Supported implementations
Commits since latest release

A reliable distributed scheduler with pluggable storage backends

  • Free software: MIT license

Installation

Minimal installation (just SQLite persistence):

pip install pyncette

Full installation (Redis and PostgreSQL persistence and Prometheus metrics exporter):

pip install pyncette[redis,postgres,prometheus]

You can also install the in-development version with:

pip install https://github.com/tibordp/pyncette/archive/master.zip

Usage example

Simple in-memory scheduler (does not persist state)

from pyncette import Pyncette, Context

app = Pyncette()

@app.task(schedule='* * * * *')
async def foo(context: Context):
    print('This will run every minute')

if __name__ == '__main__':
    app.main()

Persistent distributed cron using Redis (coordinates execution with parallel instances and survives restarts)

from pyncette import Pyncette, Context
from pyncette.redis import redis_repository

app = Pyncette(repository_factory=redis_repository, redis_url='redis://localhost')

@app.task(schedule='* * * * * */10')
async def foo(context: Context):
    print('This will run every 10 seconds')

if __name__ == '__main__':
    app.main()

See the examples directory for more examples of usage.

Development

To run integration tests you will need Redis and PostgreSQL Server running locally.

To run the all tests run:

tox

To run just the unit tests (excluding integration tests):

tox -e py37  # or py38

Note, to combine the coverage data from all the tox environments run:

Windows
set PYTEST_ADDOPTS=--cov-append
tox
Other
PYTEST_ADDOPTS=--cov-append tox