Skip to main content

handcron build master branch handcron test code coverage Static Badge PyPI - Version PyPI - Status PyPI - Python Version PyPI - License

🕐 handcron 💁

Python task queue with manual ticks

Unlike a traditional task queue, handcron is designed to process due tasks and then stop - by default, there is no long-running process in the background. Instead, you periodically run handcron tick yourself (from a cron, etc.).

It is similar to django-cron and anacron(8), but comes as a simple Python library with Huey-inspired API.

Installation

Simply uv add handcron or pip install handcron.

If you'd like to use PostgreSQL as your storage backend, install the postgres extra: uv add handcron[postgres] or pip install handcron[postgres].

Example

# my_tasks.py
from handcron import SqliteHandcron

cron = SqliteHandcron("handcron.sqlite")

@cron.periodic_task("@daily")
def my_task():
    print("Hello from my task")
$ handcron tick my_tasks.cron             # drain the queue once and exit
$ handcron serve my_tasks.cron            # drain the queue periodically
$ handcron oneshot my_tasks.cron my_task  # run a task without scheduling
$ handcron describe my_tasks.cron         # print task schedule and last run status

INFO     handcron.cli: Summary of instance 'handcron':
┌──────────┬─────────┬──────────────────────────────┬──────────────┬────────────┐
│ task     │ cron    │ last run                     │ start_date   │ end_date   │
├──────────┼─────────┼──────────────────────────────┼──────────────┼────────────┤
│ my_task  │ @daily  │ SUCCESS  2026-09-25 18:55:21 │              │            │
└──────────┴─────────┴──────────────────────────────┴──────────────┴────────────┘

handcron vs. alternatives

Celery, Huey, Apache Airflow

  • handcron is much less resource intensive, since it works more like a serverless function than a background service. It won't prevent your CPU from entering a low-power state; the machine could even be turned off most of the time.
  • handcron has no heavy dependencies and is easily run natively on Windows or Linux. With uv, your scheduled command can be as simple as: uv run --with handcron handcron tick my_tasks.cron

Plain cron(8), Systemd timer + service

  • handcron can catch up with missed task runs, unlike cron(8).
  • handcron keeps a database of past runs and their status, it has better visibility than flat logs.
  • handcron allows you to define tasks on different schedules in one place.

License

MIT – see LICENSE.txt.

Release files for handcron 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for handcron 0.1.0
File Size Uploaded
handcron-0.1.0.tar.gz 15.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for handcron 0.1.0
File Interpreter ABI Platform
handcron-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.2 kB

Release files / handcron-0.1.0.tar.gz

Download URL handcron-0.1.0.tar.gz
Size 15.7 kB
Tags Source
SHA-256 checksum
How to use checksums
005b7653771ad3acdd3a8148c19892bb52f3579be63bef190d1eab403e31b252
BLAKE2b-256 checksum
How to use checksums
70d16aa570cd3d60d31e92834c2ae60712426c09d31cc14eb1760fd16312b80c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / handcron-0.1.0-py3-none-any.whl

Download URL handcron-0.1.0-py3-none-any.whl
Size 19.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2b45743cc9a74a6d36ac982911ea59e7da4fb6664533500106a8acb79f608e6
BLAKE2b-256 checksum
How to use checksums
e613c04b7d76673b2ec51ee08201c33772e1a10f6b69f988395433e8f639a440
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page