This release is a pre-release and may not be stable for production use.
seCronTab Expression Parser
This package is a simple cron expression parser that converts a cron expression into a human-readable format.
It takes a standard cron string with five time fields (minute, hour, day of month, month, and day of week) and a command,
and it formats the cron expression as properties to be passed to something like apscheduler.triggers.cron.
Installation
To install seCronTab, use pip:
pip install seCronTab
Usage
Example:
import json
import time
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.triggers.cron import CronTrigger
from seCronTab.crontab import CronTab
def runCRON():
print(f'runCRON: {time.ctime()}, next: {CRON0_JOB.next_run_time}')
if __name__ == '__main__':
# Parse the cron schedule
oCron = CronTab("*/1 * * * * runCRON").parse()
scheduler = BackgroundScheduler()
print(f'\n{json.dumps(oCron.format_as_json(), indent=4)}')
try:
trigger = CronTrigger(minute=oCron.cron_minute, hour=oCron.cron_hour, day=oCron.cron_day_of_month, month=oCron.cron_month, day_of_week=oCron.cron_day_of_week)
CRON0_JOB = scheduler.add_job(eval(oCron.cron_command), trigger)
scheduler.start()
print(f"Job added: {CRON0_JOB}")
except Exception as e:
print(f"Error: {e}")
while True:
try:
# Simulate main work
time.sleep(1)
except KeyboardInterrupt: # Handle keyboard interruption
print("Program interrupted by user. Exiting gracefully...")
break
except Exception as e:
print(f"Error: {e}")
Output:
{
"expression": "*/1 * * * * runCRON",
"minute": "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59",
"hour": "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23",
"day of month": "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31",
"month": "1 2 3 4 5 6 7 8 9 10 11 12",
"day of week": "0 1 2 3 4 5 6",
"command": "runCRON"
}
Job added: runCRON (trigger: cron[month='*', day='*', day_of_week='*', hour='*', minute='*/1'], next run at: 2025-01-18 20:00:00 CST)
runCRON: Sat Jan 18 20:00:00 2025, next: 2025-01-18 20:01:00-06:00
Metadata
Release files for secrontab 2025.1.0rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| secrontab-2025.1.0rc1.tar.gz | 5.5 kB | Without provenance | Details for secrontab-2025.1.0rc1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| secrontab-2025.1.0rc1-py3-none-any.whl | Python 3 | none | any | Details for secrontab-2025.1.0rc1-py3-none-any.whl |
Total release size: 11.2 kB
Release files / secrontab-2025.1.0rc1.tar.gz
| Download URL | secrontab-2025.1.0rc1.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0af10fd9db25899bfd182ee7673a8a7a94c35bd4601a3a705c8f734558fdac1b
|
|
BLAKE2b-256 checksum How to use checksums |
09efe5fb935d4a87025cfa87d2eeb09d40c8f490a7109bfb2fc23c629b8fa04e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.1
|
Release files / secrontab-2025.1.0rc1-py3-none-any.whl
| Download URL | secrontab-2025.1.0rc1-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
daae1c9374bdc6afe5d004b758b0c83d77e66b393d8a84a4cead9f37b991e853
|
|
BLAKE2b-256 checksum How to use checksums |
cce76fef67b5a5d54d024568e8b56e85dfca7711cfc1b5b33b54eb743276e030
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.1
|
Security for secrontab 2025.1.0rc1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.