{"id":14512,"library":"cron-schedule-triggers","title":"Cron Schedule Triggers","description":"Cron Schedule Triggers (CSTriggers) is a Python library (version 0.0.11) for determining future execution dates based on Quartz Job Scheduler cron syntax. It is not a scheduler itself, but a utility to calculate trigger dates for integration into other scheduling systems. The last release was in November 2019, suggesting a maintenance-level activity rather than active development.","status":"maintenance","version":"0.0.11","language":"en","source_language":"en","source_url":"N/A (No official GitHub repository linked from PyPI page or easily discoverable online)","tags":["cron","scheduling","quartz","date-time","utility"],"install":[{"cmd":"pip install cron-schedule-triggers","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"QuartzCron","correct":"from cstriggers.core.trigger import QuartzCron"}],"quickstart":{"code":"from datetime import datetime\nfrom cstriggers.core.trigger import QuartzCron\n\n# Example: Every day, every hour, on the 0th minute and 0th second\n# using Quartz Cron Syntax (seconds, minutes, hours, day-of-month, month, day-of-week, year)\n# '?' means no specific value for that field to avoid conflicts (e.g., between day-of-month and day-of-week)\nschedule_string = \"0 0 * * * ? *\"\n\n# Define start and (optional) end dates as datetime objects\nstart_date = datetime(2023, 1, 1, 0, 0, 0)\nend_date = datetime(2024, 1, 1, 0, 0, 0) # Inclusive end\n\n# Initialize the cron object\ncron_obj = QuartzCron(schedule_string=schedule_string, start_date=start_date, end_date=end_date)\n\n# Get the next trigger date\nnext_trigger_date = cron_obj.next_trigger()\nprint(f\"Next trigger: {next_trigger_date.isoformat()}\")\n\n# Get multiple trigger dates\nprint(\"\\nUpcoming 3 triggers:\")\nfor _ in range(3):\n    next_trigger = cron_obj.next_trigger()\n    if next_trigger:\n        print(next_trigger.isoformat())\n    else:\n        print(\"No more triggers within the specified range.\")\n        break","lang":"python","description":"Initializes a `QuartzCron` object with a cron string and start/end dates, then retrieves the next scheduled trigger date. Note the use of `datetime` objects for date parameters and the 7-field Quartz cron syntax."},"warnings":[{"fix":"Refer to Quartz Cron documentation for correct syntax. Always include the seconds field (position 1) and use `?` for 'no specific value' to resolve conflicts between day-of-month and day-of-week fields.","message":"This library explicitly uses *Quartz Cron syntax*, which is a 7-field cron expression (seconds, minutes, hours, day-of-month, month, day-of-week, year) and supports unique special characters (like `L`, `W`, `#`). This differs significantly from the more common 5-field UNIX cron syntax. Misinterpreting the syntax is a frequent source of errors.","severity":"gotcha","affected_versions":"0.0.11 and earlier"},{"fix":"Understand that `cron-schedule-triggers` is a date calculation utility. Pair it with a separate execution mechanism if you need to run scheduled tasks.","message":"This library is solely for *calculating* future trigger dates based on a cron expression. It does not provide any functionality for executing tasks or jobs. Users must integrate it with a separate task runner, job scheduler (e.g., `APScheduler`), or system `cron` daemon to actually perform scheduled operations.","severity":"gotcha","affected_versions":"0.0.11 and earlier"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Convert the 5-field UNIX cron string to a 7-field Quartz cron string. Prepend a '0' for the seconds field and add a '?' for the day-of-week (or year if not used) to align with Quartz syntax. Example: `0 * * * * ? *` for 'every minute'.","cause":"Attempting to use a 5-field UNIX cron expression with the `QuartzCron` class, which expects a 7-field Quartz cron string.","error":"ValueError: Invalid cron string provided: '*,*,*,*,*', expecting 7 fields for Quartz Cron, received 5."},{"fix":"In Quartz cron, you must use `?` in *one* of the 'day-of-month' or 'day-of-week' fields if the other has a specific value. For example, to run on the 15th of every month, use `0 0 0 15 * ? *`. To run every Monday, use `0 0 0 ? * MON *`. If both are `*`, it acts as an OR, which might not be the desired behavior or can lead to unexpected results.","cause":"This often happens due to conflicting values in the 'day-of-month' and 'day-of-week' fields, or incorrect use of the `?` (no specific value) character. If both fields are specified (e.g., `*` for both), or both have specific numbers, the cron expression might not resolve to any valid dates.","error":"The `next_trigger()` method returns `None` or an empty list, even when the schedule seems valid."}],"ecosystem":"pypi"}