Schedule with Docstrings
Project description
DocCron
Schedule with Docstrings
License | Version | ||
Travis CI | Coverage | ||
AppVeyor | Supported versions | ||
Wheel | Implementation | ||
Status | Downloads | ||
Show your support |
Installation
pip install DocCron
Description
Cron-based scheduler inspired by doctest
Example
Cron jobs can be embedded into docstrings by using a literal block (::
). Literal blocks should start with /etc/crontab
.
Standard/Extended Format
Run hello()
at every 2nd minute and 3rd minute:
import time
def hello():
"""
Print "hello world" at every 2nd minute and 3rd minute:
/etc/crontab::
*/2 * * * *
*/3 * * * *
"""
print(time.strftime('%Y-%m-%d %H:%M:%S'), "hello world")
if __name__ == '__main__':
import doccron
doccron.run_jobs()
Quartz Format
Run hello()
at every 2nd second and 3rd second:
import time
def hello():
"""
Print "hello world" every 2nd second and 3rd second:
/etc/crontab::
*/2 * * * * *
*/3 * * * * *
"""
print(time.strftime('%Y-%m-%d %H:%M:%S'), "hello world")
if __name__ == '__main__':
import doccron
doccron.run_jobs(quartz=True)
Features
- Standard and extended cron formats (see CRON Expression)
- Nonstandard predefined scheduling definitions
- Non-standard characters
- Quartz format
- Works with documentation tools like Sphinx
TODO
- Human readable date/time strings
- Timezone-awareness
References
Author
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
DocCron-1.2.1.tar.gz
(6.2 kB
view hashes)
Built Distribution
Close
Hashes for DocCron-1.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45e6803d2d239f48b525f417147e7cda220362bd57226dc927e741d9926b6cfd |
|
MD5 | 9194117691f221b0732c389a6be709d9 |
|
BLAKE2b-256 | a3e8315bd14c2cce5d219afa1f4cda68b3f85c42fc8fa4b68bdb33f5c2380f0e |