TGScheduler is a pure Python scheduler library, currently at version 1.7.0. It enables applications to run one-time or recurring tasks, supporting execution in-process (using threads), as forked processes, or synchronously within the main code. The library is based on the scheduler originally built into TurboGears 1, offering a straightforward approach to task automation. Its release cadence is infrequent, with the last update in 2015.
pip install tgschedulerVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the TGScheduler, add both one-time and recurring tasks, and run the scheduler in a simple blocking loop. Tasks are defined as callable functions, and arguments can be passed via the `args` parameter. The `delay` argument schedules a task for a single future execution, while `interval` schedules it for recurring executions. Logging is included to show task execution.
Run `s.tick()` in a separate thread or use an asynchronous loop that yields control, calling `s.tick()` at appropriate intervals.
For new projects or those requiring active development/support, evaluate modern alternatives like APScheduler or schedule. If using TGScheduler, thoroughly test on your target Python version.
Always provide `args` as a tuple, e.g., `s.add_task(my_func, args=('arg1', 'arg2',))` or `s.add_task(my_func, args=('single_arg',))`.No dependency data recorded yet.