Registry / workflow / tgscheduler

tgscheduler

JSON →
library1.7.0pypypi✓ verified 84d ago

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 tgscheduler
INSTALL
IMPORT
SIG · TGSCHEDULER
T
tgscheduler
workflowpythonv1.7.0
Install
1.7s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.7.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.8MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.7s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

scheduler
from tgscheduler import scheduler
from tgscheduler import Scheduler
add_cron_like_task
from tgscheduler import add_cron_like_task
start_scheduler
from tgscheduler import start_scheduler

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.

from tgscheduler import Scheduler import time import logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') def my_task(message): logging.info(f"Executing task with message: {message}") s = Scheduler() # Schedule a task to run once, 5 seconds from now s.add_task(my_task, args=('One-time task!',), delay=5) # Schedule a recurring task every 10 seconds s.add_task(my_task, args=('Recurring task!',), interval=10, initialdelay=2, name='RecurringExample') logging.info("Scheduler started. Tasks will run.") try: # Run the scheduler in a blocking loop (or integrate into an existing event loop) while True: s.tick() time.sleep(1) # Sleep to prevent busy-waiting except KeyboardInterrupt: logging.info("Scheduler stopped by user.") s.shutdown()
Debug
Known issues
gotchaTGScheduler is a blocking scheduler if `tick()` is called in a tight loop. To integrate it into existing asynchronous applications (e.g., web servers), ensure `tick()` is called periodically without blocking the main event loop, or run the scheduler in a separate thread.
fix
Run `s.tick()` in a separate thread or use an asynchronous loop that yields control, calling `s.tick()` at appropriate intervals.
affects: All versions
deprecatedThe project appears to be in maintenance mode, with the last PyPI release in 2015. While functional, it might not receive updates for new Python versions or critical bug fixes. Consider more actively maintained alternatives for new projects requiring robust scheduling.
fix
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.
affects: All versions
gotchaTGScheduler's `add_task` method requires careful handling of task arguments. If a task function takes arguments, they must be passed as a tuple to the `args` parameter, even for a single argument.
fix
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',))`.
affects: All versions
Upgrade
Version history
1.7.0latest on PyPI · released May 18, 2015
Audit
Dependencies

No dependency data recorded yet.

Agent activity
46 hits · last 30 days
node
40
Amazon
1
OpenAI (training)
1
Resources
tgscheduler — pip install tgscheduler · libregistry