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.3.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.3.0-py3-none-any.whl (33.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: crontable-0.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 7f8d2dc28528f09b66c854dda514de31863d1f1a7438cf8f7ee3165553fdd621
MD5 86ddde59cb0be219fa69848b4a6725db
BLAKE2b-256 b3dfd73ad1117f2a04d8e640ee75acfa40a2a61cf8a71314441e3a497be04d5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for crontable-0.3.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: crontable-0.3.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a31f071b80e7099154c143f8e9823aafc40cbedb527eb5127bb2e33703b9e6ef
MD5 8a271d09a572495b45d2fb19bac927c7
BLAKE2b-256 0522809f66f36828cf4488d662f51aff2beb91899eb35a4ae7054a7e7eb9233a

See more details on using hashes here.

Provenance

The following attestation bundles were made for crontable-0.3.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