| 1 |
`schedule <https://schedule.readthedocs.io/>`__ |
| 2 |
=============================================== |
| 3 |
|
| 4 |
|
| 5 |
.. image:: https://github.com/dbader/schedule/workflows/Tests/badge.svg |
| 6 |
:target: https://github.com/dbader/schedule/actions?query=workflow%3ATests+branch%3Amaster |
| 7 |
|
| 8 |
.. image:: https://coveralls.io/repos/dbader/schedule/badge.svg?branch=master |
| 9 |
:target: https://coveralls.io/r/dbader/schedule |
| 10 |
|
| 11 |
.. image:: https://img.shields.io/pypi/v/schedule.svg |
| 12 |
:target: https://pypi.python.org/pypi/schedule |
| 13 |
|
| 14 |
Python job scheduling for humans. Run Python functions (or any other callable) periodically using a friendly syntax. |
| 15 |
|
| 16 |
- A simple to use API for scheduling jobs, made for humans. |
| 17 |
- In-process scheduler for periodic jobs. No extra processes needed! |
| 18 |
- Very lightweight and no external dependencies. |
| 19 |
- Excellent test coverage. |
| 20 |
- Tested on Python and 3.7, 3.8, 3.9, 3.10, 3.11, 3.12 |
| 21 |
|
| 22 |
Usage |
| 23 |
----- |
| 24 |
|
| 25 |
.. code-block:: bash |
| 26 |
|
| 27 |
$ pip install schedule |
| 28 |
|
| 29 |
.. code-block:: python |
| 30 |
|
| 31 |
import schedule |
| 32 |
import time |
| 33 |
|
| 34 |
def job(): |
| 35 |
print("I'm working...") |
| 36 |
|
| 37 |
schedule.every(10).seconds.do(job) |
| 38 |
schedule.every(10).minutes.do(job) |
| 39 |
schedule.every().hour.do(job) |
| 40 |
schedule.every().day.at("10:30").do(job) |
| 41 |
schedule.every(5).to(10).minutes.do(job) |
| 42 |
schedule.every().monday.do(job) |
| 43 |
schedule.every().wednesday.at("13:15").do(job) |
| 44 |
schedule.every().day.at("12:42", "Europe/Amsterdam").do(job) |
| 45 |
schedule.every().minute.at(":17").do(job) |
| 46 |
|
| 47 |
def job_with_argument(name): |
| 48 |
print(f"I am {name}") |
| 49 |
|
| 50 |
schedule.every(10).seconds.do(job_with_argument, name="Peter") |
| 51 |
|
| 52 |
while True: |
| 53 |
schedule.run_pending() |
| 54 |
time.sleep(1) |
| 55 |
|
| 56 |
Documentation |
| 57 |
------------- |
| 58 |
|
| 59 |
Schedule's documentation lives at `schedule.readthedocs.io <https://schedule.readthedocs.io/>`_. |
| 60 |
|
| 61 |
|
| 62 |
Meta |
| 63 |
---- |
| 64 |
|
| 65 |
Daniel Bader - `@dbader_org <https://twitter.com/dbader_org>`_ - [email protected] |
| 66 |
|
| 67 |
Inspired by `Adam Wiggins' <https://github.com/adamwiggins>`_ article `"Rethinking Cron" <https://adam.herokuapp.com/past/2010/4/13/rethinking_cron/>`_ and the `clockwork <https://github.com/Rykian/clockwork>`_ Ruby module. |
| 68 |
|
| 69 |
Distributed under the MIT license. See `LICENSE.txt <https://github.com/dbader/schedule/blob/master/LICENSE.txt>`_ for more information. |
| 70 |
|
| 71 |
https://github.com/dbader/schedule |