autocron
autocron is a Python background task library with no dependencies beside the standard library. It works out of the box with webframeworks like django, pyramid, flask, bottle, tornado or starlette.
autocron makes it easy to delegate long running and recurring tasks to external processes. No hassle with configuration-files.
autocron is designed for the vast majority of webapplications that don't need massive scaling. And don't want to add unnecessary dependencies.
Installation
For installation use pip:
$ pip install autocron
or conda:
$ conda install autocron
Quickstart
autocron provides two decorators: cron that takes a string in cron-format as argument, but accepts also keyword-arguments like minutes and hours. And delay to delegate a long running task to a background process.
Here is a simple example how to use autocron with the flask web-framework that can be run with $ flask --app application run:
# application.py
import autocron
from flask import Flask
app = Flask(__name__)
autocron.start("the_flask_app.db")
@autocron.cron("* * * * *")
def cronjob():
# do something from time to time ...
@autocron.delay
def do_this_later():
# time consuming task here ...
@app.route("/later")
def later():
do_this_later()
return "delayed action triggered"
After creating the flask app instance calling autocron.start(<databasename>) starts the background workers. The cron decorated cronjob() function will get executed every minute and the delay decorated do_this_later() function gets delegated to the background worker every time the application processes the /later url. Terminating the application will shut down the worker processes.
More information and examples how to use autocron with other frameworks are at the documentation.
Documentation
The full documentation and release notes are at https://autocron.readthedocs.org
Metadata
Release files for autocron 1.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| autocron-1.2.2.tar.gz | 33.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| autocron-1.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 70.4 kB
Release files / autocron-1.2.2.tar.gz
| Download URL | autocron-1.2.2.tar.gz |
|---|---|
| Size | 33.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fea938a38798df625577b1c3232fd7e99b10fc1e913d47872d77d0b5d3ddf00c
|
|
BLAKE2b-256 checksum How to use checksums |
46330fb9e5d30a8029fd95d859b756a5bb62a7e449227a584b4434b8c440d3a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.10
|
Release files / autocron-1.2.2-py3-none-any.whl
| Download URL | autocron-1.2.2-py3-none-any.whl |
|---|---|
| Size | 37.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa36f8ea2d7c9bebe618a773f2ee16bd8ad99f0230883faef693a336f241dbb8
|
|
BLAKE2b-256 checksum How to use checksums |
00f43f64bc85f3c6dd3708cde19684d5863c99931aa1ce08638ff62b573dc38d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.10
|
Security for autocron 1.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.