local-crontab is a Python wheel and command line utility designed to convert a crontab, defined in a local timezone, into a set of UTC crontabs. This conversion often results in multiple UTC crontabs due to the complexities of Daylight Saving Time (DST). The project is based on an earlier `local-crontab` by UnitedIncome, incorporating bug fixes and extending functionality to convert specific hour and day parts. As of version 0.3.0, released in July 2021, the library appears to be in a maintenance status with infrequent updates.
pip install local-crontabVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to instantiate the `Converter` class with a local crontab string and its timezone, then use the `convert()` method to get a list of corresponding UTC crontab strings.
Understand that the output of `converter.convert()` is a list of crontab strings. Implement logic to select the appropriate UTC crontab based on the current date, or consider external 'dst check' mechanisms if only one active UTC schedule is required year-round.
Be aware that the 'single UTC crontab' feature for hour/day parts is a partial solution. If full DST awareness and year-round accuracy are critical, an external mechanism to manage the active UTC schedule is necessary.
If migrating from an older 'UnitedIncome' version, review the GitHub repository's commit history and source code for any unlisted changes. Thorough testing of existing workflows is recommended.
Ensure the package is installed via `pip install local-crontab`. The correct import statement is `from local_crontab import Converter` (note the underscore in `local_crontab`).
The `Converter` class expects exactly two arguments: the crontab string and the local timezone string, e.g., `Converter('0 10 * * *', 'America/New_York')`.Ensure the timezone string passed to `Converter` is a valid `pytz` timezone name (e.g., 'America/New_York', 'Europe/London'). Consult the `pytz` documentation for a list of supported timezones.