Skip to main content

Schedule with Docstrings

Project description

DocCron

Schedule with Docstrings

License Version
Travis CI Coverage
AppVeyor Supported versions
Wheel Implementation
Status Show your support

Installation

pip install DocCron

Description

Cron-based scheduler inspired by doctest

Example

Standard/Extended Format

Run hello() at every 2nd minute and 3rd minute:

import time


def hello():
    """
    */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():
    """
    */2 * * * * *
    */3 * * * * *
    """
    print(time.strftime('%Y-%m-%d %H:%M:%S'), "hello world")


if __name__ == '__main__':
    import doccron
    doccron.run_jobs(quartz=True)

Features

Open to ideas!

This is just a rough implementation of the concept! There are things that might need attention in the future:

  • Mixing cron syntax with docstrings equivalent to what doctest is using (>>>))
  • Timezone-awareness

References

Author

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.1.0.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

DocCron-1.1.0-py2.py3-none-any.whl (7.5 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page