Skip to main content

A generic mini scheduler supporting CSV date-based and crontab-style tasks

Project description

Logo

Crontable

A lightweight Python scheduler that unifies two task types in a single loop:

  • DateTask — one-shot tasks triggered at a specific datetime, loaded from a semicolon-delimited CSV file
  • CronTask — repeating tasks driven by standard 5-field cron expressions (or friendly @aliases), loaded from a crontab-style text file

Comes with a CLI entry-point and an optional tkinter GUI (crontable-gui).


Installation

pip install crontable

Requires Python ≥ 3.10. The only runtime dependency is croniter.


Quick start

Programmatic usage

from datetime import datetime, timedelta
from crontable import Scheduler, SubprocessExecutor, DateTask, CronTask

executor = SubprocessExecutor()
scheduler = Scheduler(executor=executor, interval=30.0)

scheduler.add_tasks([
    DateTask(
        scheduled_at=datetime.now() + timedelta(minutes=5),
        action="echo 'hello in 5 minutes'",
        name="greeting",
    ),
    CronTask(
        cron_expr="0 9 * * 1-5",
        action="python C:/scripts/daily_report.py",
        name="weekday_report",
    ),
])

try:
    scheduler.run()
except KeyboardInterrupt:
    scheduler.stop()

From a CSV file

DATE;NAME;COMMAND
01/01/2027 09:00;morning_report;echo "Good morning"
15/06/2027 14:30;backup;python C:\scripts\backup.py
from crontable import FileSource, Scheduler, SubprocessExecutor

source = FileSource("tasks.csv")
scheduler = Scheduler(executor=SubprocessExecutor(), interval=60.0)
scheduler.add_tasks(source.load())
scheduler.run()

From a crontab file

# Every weekday at 9 am
0 9 * * 1-5   python C:\scripts\report.py
# French alias — every Monday at midnight
@lundi        echo "Bonne semaine"
from crontable import FileSource, Scheduler, SubprocessExecutor

source = FileSource("jobs.txt")
scheduler = Scheduler(executor=SubprocessExecutor(), interval=60.0)
scheduler.add_tasks(source.load())
scheduler.run()

Hot-reload on file change

Pass the source to the scheduler and set reload_on_change=True. Every tick, the scheduler checks source.has_changed() and atomically swaps in source.load() when the file is touched. A failing parse (half-saved edit, invalid syntax) is logged and the previous task list is kept.

source = FileSource("jobs.txt")
scheduler = Scheduler(
    executor=SubprocessExecutor(),
    interval=5.0,
    source=source,
    reload_on_change=True,
)
scheduler.add_tasks(source.load())
scheduler.run()

See examples/ for more runnable patterns.


CLI

# Programmatic demo
crontable

# Load from file (auto-detects CSV vs crontab by extension)
crontable tasks.csv
crontable crontab.txt

GUI

crontable-gui

Features: file browser, configurable polling interval, live task list with right-click "Run now", color-coded log, hot-reload on file change, persistent config.

Build a standalone Windows .exe:

scripts\build_exe.bat

Supported cron aliases

Alias Expression Alias Expression
@hourly 0 * * * * @daily / @midnight 0 0 * * *
@weekly 0 0 * * 0 @monthly 0 0 1 * *
@annually / @year 0 0 1 1 * @noon 0 12 * * *
@biweekly 0 0 * * 0,2,4 @bimonthly 0 0 1,15 * *
@mon@sun weekday at midnight @lundi@dimanche French weekdays

Path aliases in commands

Alias Expands to
@python Current Python interpreter
@home User home directory
@desktop ~/Desktop

Development

pip install -e ".[dev]"
pytest

Project details


Download files

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

Source Distribution

crontable-0.2.0.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

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

crontable-0.2.0-py3-none-any.whl (33.7 kB view details)

Uploaded Python 3

File details

Details for the file crontable-0.2.0.tar.gz.

File metadata

  • Download URL: crontable-0.2.0.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for crontable-0.2.0.tar.gz
Algorithm Hash digest
SHA256 67199fdebedd5383e1204efe647da2b9607afc5d37465dec6a4d57a80c8f9347
MD5 5cd4ffb4434c76f8dbe5ff069e99bbf1
BLAKE2b-256 dc9edd28d6be27bc5430521e14b16da2aa58de9352db90d1eba1a58319660708

See more details on using hashes here.

Provenance

The following attestation bundles were made for crontable-0.2.0.tar.gz:

Publisher: publish.yml on Erim32/crontable

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file crontable-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: crontable-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 33.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for crontable-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8cae082d575779bcb0c55aa6fbc3597a1447d4c2b796b154b94aeb68155e7bf1
MD5 4817559da0cce75966e3366243ca7443
BLAKE2b-256 969c08b59249e5c8500d6d343d27cebb7258b01ba685f95ae1ecade9aaf3e2ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for crontable-0.2.0-py3-none-any.whl:

Publisher: publish.yml on Erim32/crontable

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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