Skip to main content

Durable queues, streams, pub/sub, and cron scheduler on SQLite. One file, zero servers.

Project description

honker (Python)

Python binding for Honker: durable queues, streams, pub/sub, and time-trigger scheduling on SQLite.

Full docs live in the main repo and docs site:

Install

pip install honker

The Python wheel includes Honker's SQLite loadable extension when the package is built through the release/proof workflow. To load Honker into your own sqlite3 or ORM connection:

import honker
import sqlite3

conn = sqlite3.connect("app.db")
honker.load_extension(conn)
conn.execute("SELECT honker_bootstrap()")

If a client needs the raw pieces instead, use extension_info():

path, entrypoint = honker.extension_info()

For local source builds, build and copy the extension before building the wheel:

git clone https://github.com/russellromney/honker
cd honker
cargo build --release -p honker-extension
scripts/copy-python-extension.sh

Quick start

import honker

db = honker.open("app.db")
q = db.queue("emails")

q.enqueue({"to": "alice@example.com"})

async for job in q.claim("worker-1"):
    send_email(job.payload)
    job.ack()

Delayed jobs use run_at:

import time

q.enqueue({"to": "later@example.com"}, run_at=int(time.time()) + 10)

Recurring schedules are registered on a Scheduler. Build the schedule with crontab(expr) or every_s(n), then run the scheduler loop (it enqueues onto the target queue on each boundary; a normal worker claims the jobs):

from honker import Scheduler, crontab, every_s

sched = Scheduler(db)
sched.add(name="fast", queue="emails", schedule=every_s(1), payload={"kind": "tick"})
sched.add(name="nightly", queue="emails", schedule=crontab("0 3 * * *"))

await sched.run()  # acquires the leader lock and fires due tasks

add() is keyword-only and schedule must be a CronSchedule (from crontab or every_s), not a raw string. Supported schedule expressions:

  • 5-field cron: crontab("0 3 * * *")
  • 6-field cron: crontab("*/2 * * * * *")
  • interval: every_s(1) (use every_s, not crontab("@every …"))

Notes

  • claim() wakes on database updates and on due deadlines like run_at.
  • schedule is the canonical recurring-schedule name.
  • cron still works as a compatibility alias in older call sites.
  • Construct db.queue(name) handles outside an open db.transaction(). First open for a name runs schema init in its own write transaction; doing that inside an outer transaction() raises RuntimeError (would otherwise deadlock the single writer). Create the handle first, then pass tx= to enqueue.

For streams, notify/listen, tasks, SQL extension usage, and full scheduler docs, see the main repo and docs site.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

honker-0.2.7-cp311-abi3-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.11+Windows x86-64

honker-0.2.7-cp311-abi3-manylinux_2_38_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.38+ x86-64

honker-0.2.7-cp311-abi3-manylinux_2_38_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.38+ ARM64

honker-0.2.7-cp311-abi3-macosx_11_0_arm64.whl (978.2 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

honker-0.2.7-cp311-abi3-macosx_10_12_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file honker-0.2.7-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: honker-0.2.7-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for honker-0.2.7-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 411778e216a05efd07b8e0ffb01fe11618692281a68a5c2e4ae14b97efb1d6af
MD5 c2ec0edca438ce49e69124ab1a7d071c
BLAKE2b-256 dfc755b764da2320283935644f11bbceca05ad3b49b7e3ac3a8766dca28e6283

See more details on using hashes here.

File details

Details for the file honker-0.2.7-cp311-abi3-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for honker-0.2.7-cp311-abi3-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 00d0c7c9be38cea3ad9aa72945820d334fc96fa0f9b514ec1d9001415c6fce3e
MD5 55a10d183af0748c39975a862795f8f3
BLAKE2b-256 cc91526be0e823933e0e86a3c35b5e3647d2b4807bcb9c20f6c7f36263bd09af

See more details on using hashes here.

File details

Details for the file honker-0.2.7-cp311-abi3-manylinux_2_38_aarch64.whl.

File metadata

File hashes

Hashes for honker-0.2.7-cp311-abi3-manylinux_2_38_aarch64.whl
Algorithm Hash digest
SHA256 c8eb9f8a3df5d4b2c498d5155e49193bf3ccb214549f5f8d631a7b3dc3f8c4bc
MD5 c36287de3f96584ea511674e067413a6
BLAKE2b-256 b099e291ec86fa39c73516d2fc802ed84d5fdedaa4a304f6490371bb4d3ed521

See more details on using hashes here.

File details

Details for the file honker-0.2.7-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for honker-0.2.7-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 be083e1a766b5f1b377387f18094acdf91d6b4a8ded328f459d829fe1ff420f9
MD5 f9d7f5142412a114f3163ef7535c77f2
BLAKE2b-256 7647495e390bbcd9a6d67d2592ca57472f68fb625b2b9c6023da27a85a38ecc0

See more details on using hashes here.

File details

Details for the file honker-0.2.7-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for honker-0.2.7-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 5c619ac68f612a57b8091544b34078a90e88687c3d89e22cbe672fd299e0fbe2
MD5 511d15e45e1bd12fe1491084d14fe9e3
BLAKE2b-256 2530d57a52d4692a1a17c4ca24de81a5c58655e2caf356e53050ee056dc753d3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page