| 1 |
schedule |
| 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 3.7, 3.8, 3.9, 3.10, 3.11 and 3.12 |
| 21 |
|
| 22 |
|
| 23 |
:doc:`Example <examples>` |
| 24 |
------------------------- |
| 25 |
|
| 26 |
.. code-block:: bash |
| 27 |
|
| 28 |
$ pip install schedule |
| 29 |
|
| 30 |
.. code-block:: python |
| 31 |
|
| 32 |
import schedule |
| 33 |
import time |
| 34 |
|
| 35 |
def job(): |
| 36 |
print("I'm working...") |
| 37 |
|
| 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().monday.do(job) |
| 42 |
schedule.every().wednesday.at("13:15").do(job) |
| 43 |
schedule.every().day.at("12:42", "Europe/Amsterdam").do(job) |
| 44 |
schedule.every().minute.at(":17").do(job) |
| 45 |
|
| 46 |
while True: |
| 47 |
schedule.run_pending() |
| 48 |
time.sleep(1) |
| 49 |
|
| 50 |
|
| 51 |
More :doc:`examples` |
| 52 |
|
| 53 |
When **not** to use Schedule |
| 54 |
---------------------------- |
| 55 |
Let's be honest, Schedule is not a 'one size fits all' scheduling library. |
| 56 |
This library is designed to be a simple solution for simple scheduling problems. |
| 57 |
You should probably look somewhere else if you need: |
| 58 |
|
| 59 |
* Job persistence (remember schedule between restarts) |
| 60 |
* Exact timing (sub-second precision execution) |
| 61 |
* Concurrent execution (multiple threads) |
| 62 |
* Localization (workdays or holidays) |
| 63 |
|
| 64 |
|
| 65 |
**Schedule does not account for the time it takes for the job function to execute.** |
| 66 |
To guarantee a stable execution schedule you need to move long-running jobs off the main-thread (where the scheduler runs). |
| 67 |
See :doc:`parallel-execution` for a sample implementation. |
| 68 |
|
| 69 |
|
| 70 |
Read More |
| 71 |
--------- |
| 72 |
.. toctree:: |
| 73 |
:maxdepth: 2 |
| 74 |
|
| 75 |
installation |
| 76 |
examples |
| 77 |
background-execution |
| 78 |
parallel-execution |
| 79 |
timezones |
| 80 |
exception-handling |
| 81 |
logging |
| 82 |
multiple-schedulers |
| 83 |
faq |
| 84 |
reference |
| 85 |
development |
| 86 |
|
| 87 |
.. toctree:: |
| 88 |
:maxdepth: 1 |
| 89 |
|
| 90 |
changelog |
| 91 |
|
| 92 |
|
| 93 |
Issues |
| 94 |
------ |
| 95 |
|
| 96 |
If you encounter any problems, please `file an issue <http://github.com/dbader/schedule/issues>`_ along with a detailed description. |
| 97 |
Please also use the search feature in the issue tracker beforehand to avoid creating duplicates. Thank you 😃 |
| 98 |
|
| 99 |
About Schedule |
| 100 |
-------------- |
| 101 |
|
| 102 |
Created by `Daniel Bader <https://dbader.org/>`__ - `@dbader_org <https://twitter.com/dbader_org>`_ |
| 103 |
|
| 104 |
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. |
| 105 |
|
| 106 |
|
| 107 |
Distributed under the MIT license. See ``LICENSE.txt`` for more information. |
| 108 |
|
| 109 |
.. include:: ../AUTHORS.rst |