Skip to main content

croniter-mojo

A drop-in faster replacement for the croniter package's get_next / get_prev on 5-field cron expressions, powered by a clean-room Mojo kernel — with a pure-Python engine for platforms without a native build (including Windows — tested there in CI: windows-fallback). Zero runtime dependencies.

from datetime import datetime
from zoneinfo import ZoneInfo
from croniter_mojo import get_next, get_prev  # same results as croniter

get_next("0 9 * * mon-fri", datetime(2026, 9, 19, 14, 30))
# datetime(2026, 9, 21, 9, 0)

get_prev("30 2 * * *", datetime(2026, 3, 10, 12, 0, tzinfo=ZoneInfo("America/New_York")))
# datetime(2026, 3, 10, 2, 30, tzinfo=ZoneInfo("America/New_York"))  (DST-aware)
  • Same results: returned datetimes are identical to the published croniter package (6.2.4) for the supported scope — the differential suite compares thousands of cases element-for-element on both the native and fallback backends, including expand_from_start_time (a no-op in croniter 6.2.4) and zoneinfo DST boundaries (spring-forward gaps, fall-back folds, sub-hour Lord Howe shifts).
  • Supported scope: *, */n, a-b (wrapping allowed), lists, steps a/n and a-b/n, names (jan/mon, case-insensitive), ? in the day-of-month/day-of-week fields, l (last day of month) in dom lists, nth-weekday hash specs (5#3), dom/dow OR-vs-AND (day_or=True/False), start_date truncation semantics, and naive or zoneinfo-aware datetimes. Not supported: 6/7-field expressions (seconds/year fields) and ret_type=float — this package always returns datetimes.
  • Much faster iteration: native bitmask seek instead of Python-level datetime arithmetic for every candidate minute — see the benchmark below.
  • No toolchain needed: per-platform wheels ship the compiled kernel. Everywhere else the package transparently uses its pure-Python engine, which returns identical results.
  • Force the fallback with CRONITER_MOJO_DISABLE_NATIVE=1; inspect the active backend with croniter_mojo.backend_info().

Benchmark

Measured on this machine (Apple M4 Max, macOS arm64, Python 3.12, Mojo 1.1.0, croniter 6.2.4), median of 5 runs. "Cold" = first call for an expression (parse + seek, no cache); "warm" = steady-state per-call cost with the parsed schedule cached. Chains = 1000 successive get_next calls (scheduler roll-out workload). Correctness is asserted before any timing.

workload oracle croniter (us/call) croniter_mojo native (us/call) speedup
cold get_next: every-5-min 66.5 3.0 21.87x
cold get_next: daily-weekday 61.5 3.3 18.69x
cold get_next: mixed-wrap 116.8 2.5 45.96x
cold get_next: nth-weekday 63.8 3.7 17.39x
cold get_next: sparse-feb29 59.5 3.9 15.34x
warm get_next: every-5-min 64.08 2.67 24.03x
warm get_next: daily-weekday 56.50 2.63 21.52x
warm get_next: mixed-wrap 118.83 2.58 46.01x
warm get_next: nth-weekday 60.46 3.50 17.27x
warm get_next: sparse-feb29 55.46 3.62 15.30x
chain next:every-5-min 79.46 2.33 34.06x
chain next:daily-weekday 61.91 2.35 26.37x
chain next:mixed-wrap 157.68 3.82 41.23x
chain next:nth-weekday 104.42 3.44 30.34x
chain next:sparse-feb29 110.49 4.30 25.72x
chain prev:*/15 52.76 2.63 20.03x
chain next:*/15 tz-aware 75.17 11.78 6.38x
chain next:daily-0130 tz-DST 70.59 15.72 4.49x

The pure-Python fallback returns identical results; the native kernel is the speedup above. Full method: benchmarks/bench_croniter.py in the repository.

Source, benchmarks, and development: https://github.com/thyn-ai/mojo-kernels

License: Apache-2.0, © 2026 Algenta

Metadata

Release files for croniter-mojo 0.2.5

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

Built distributions (wheels)

Table of built distributions (wheels) for croniter-mojo 0.2.5
File Interpreter ABI Platform Actions
croniter_mojo-0.2.5-py3-none-manylinux_2_35_x86_64.whl Python 3 none Linux glibc 2.35+ x86-64 Details for croniter_mojo-0.2.5-py3-none-manylinux_2_35_x86_64.whl
croniter_mojo-0.2.5-py3-none-macosx_14_0_arm64.whl Python 3 none macOS 14.0+ ARM64 Details for croniter_mojo-0.2.5-py3-none-macosx_14_0_arm64.whl
croniter_mojo-0.2.5-py3-none-any.whl Python 3 none any Details for croniter_mojo-0.2.5-py3-none-any.whl

Total release size: 2.0 MB

Release files / croniter_mojo-0.2.5-py3-none-manylinux_2_35_x86_64.whl

Download URL croniter_mojo-0.2.5-py3-none-manylinux_2_35_x86_64.whl
Size 844.4 kB
Tags Linux glibc 2.35+ x86-64 Python 3
SHA-256 checksum
How to use checksums
704e8b7c997cdae977f5c232ed7da79884dca036348b948ca8eefadfc72cca86
BLAKE2b-256 checksum
How to use checksums
04e32c07e916f7b18cc611a52d59209d8bfaf91958067481816b6d1f8ba6e56f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / croniter_mojo-0.2.5-py3-none-macosx_14_0_arm64.whl

Download URL croniter_mojo-0.2.5-py3-none-macosx_14_0_arm64.whl
Size 1.1 MB
Tags Python 3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
72962aae13d60613ae72df9fee1604ee51773c95b02c2ceceab23a6ba19ca1a7
BLAKE2b-256 checksum
How to use checksums
085d78bc00fbe3270ce44700f7643cd520371a7784137612e393ca5d5642be5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / croniter_mojo-0.2.5-py3-none-any.whl

Download URL croniter_mojo-0.2.5-py3-none-any.whl
Size 19.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03de63b565af0a6be875ad04141661853ea045a0a20fbf27e3ce2371c157c8f3
BLAKE2b-256 checksum
How to use checksums
8449c6bf25be90875cf8c5a6f4cbbe1cdc6ebe53355cbce1097fd5415180f9bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for croniter-mojo 0.2.5

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.

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