# EAScheduler
[](https://github.com/spacemanspiff2007/eascheduler/actions)
[](https://eascheduler.readthedocs.io/en/latest/?badge=latest)
[](https://pyup.io/repos/github/spacemanspiff2007/eascheduler/)

[]((https://pypi.org/project/EAScheduler/))
[](https://pepy.tech/project/eascheduler)
_Easy async task scheduling_
Easy Async Scheduler (or EAScheduler) is a lightweight asyncio scheduler with a nice and easy to use interface.
The home automation software [HABApp](https://pypi.org/project/HABApp/) make use of EAScheduler.
## Documentation
[The documentation can be found here](https://eascheduler.readthedocs.io)
## Example
````python
import eascheduler
async def my_coro() -> None:
print('Hello')
# If you want something easy that you can use out of the box just use the default scheduler
scheduler = eascheduler.get_default_scheduler()
# -------------------------------------------------------------------------------------------------------
# Different job types
# -------------------------------------------------------------------------------------------------------
# Run once in 30s
job_once = scheduler.once(30, my_coro)
# Countdown
countdown = scheduler.countdown(30, my_coro)
countdown.reset() # make countdown start (again)
countdown.stop() # stop countdown
countdown.set_countdown(15) # set different countdown time which will be used for the next reset call
# Trigger job which runs continuously, e.g.
# every day at 8
job_every = scheduler.at(scheduler.triggers.time('08:00:00'), my_coro)
# for the first time in 10 mins, then every hour
job_every = scheduler.at(scheduler.triggers.interval(600, 3600), my_coro)
# -------------------------------------------------------------------------------------------------------
# Restricting the trigger with a filter.
# Only when the filter condition passes the time will be taken as the next time
# every Fr-So at 8
scheduler.at(
scheduler.triggers.time('08:00:00').only_at(scheduler.filters.weekdays('Fr-So')),
my_coro
)
# Triggers can be grouped
# Mo-Fr at 7, Sa at 8
scheduler.at(
scheduler.triggers.group(
scheduler.triggers.time('07:00:00').only_at(scheduler.filters.weekdays('Mo-Fr')),
scheduler.triggers.time('08:00:00').only_at(scheduler.filters.weekdays('Fr-So')),
),
my_coro
)
# Filters can be grouped with any or all
# On the first sunday of the month at 8
scheduler.at(
scheduler.triggers.time('08:00:00').only_at(
scheduler.filters.all(
scheduler.filters.days('1-7'),
scheduler.filters.weekdays('So'),
),
),
my_coro
)
# -------------------------------------------------------------------------------------------------------
# The trigger time can also be modified
# On sunrise, but not earlier than 8
scheduler.at(
scheduler.triggers.sunset().earliest('08:00:00'),
my_coro
)
# One hour before sunset
scheduler.at(
scheduler.triggers.sunset().offset(timedelta(hours=-1)),
my_coro
)
````
## Changelog
#### 0.2.2 (2025-01-07)
- Ensured that all trigger builders are imputable and can be composed without side effects
- Updated dependencies
#### 0.2.1 (2024-11-20)
- Updated dependencies and some type hints
#### 0.2.0 (2024-11-13)
- Complete rewrite
#### 0.1.11 (2023-09-11)
- Fixed an issue with a possible infinite loop
#### 0.1.10 (2023-08-24)
- Added option to add a callback to the job when the execution time changes
#### 0.1.9 (2023-07-19)
- Fix for days when the sun doesn't rise or set.
In that case the next date with a sunrise/sunset will be returned.
#### 0.1.8 (2022-12-14)
- Fix for OneTimeJob incorrectly showing a remaining time after the execution
- Dependency update
#### 0.1.7 (2022-07-27)
- Added py.typed
#### 0.1.6 (2022-07-27)
- Removed Python 3.7 support
- Fixed setup issues
#### 0.1.5 (2022-02-14)
- Jobs have a remaining function
- CountdownJob has a stop function
#### 0.1.4 (2021-06-01)
- Added option to pause and resume the scheduler
- Jobs don't have to be in the future any more
- Sorted imports with isort
#### 0.1.3 (2021-05-06)
- Fixed a bug where a negative offset/jitter could result in multiple executions
#### 0.1.2 (2021-05-06)
- Fixed a bug where ``.every(None, ...)`` would result in an error
#### 0.1.1 (2021-05-02)
- Implemented a much nicer API and fixed some bugs
#### 0.1.0 (2021-04-21)
- Fixed a race condition
- Added tests
#### 0.0.9 (2021-04-19)
- Fixes for wrong timezone
- Added tests
#### 0.0.8 (2021-04-17)
- Fixes for SunJob, ReoccurringJob
- Added tests
#### 0.0.7 (2021-04-15)
- Fixes for Sunrise/Sunset
Raw data
{
"_id": null,
"home_page": "https://github.com/spacemanspiff2007/eascheduler",
"name": "EAScheduler",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "scheduler, asyncio",
"author": "spaceman_spiff",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/ac/7d/ae4a35d1643364fd4f1b0ba0234db3205a130de995d45908a2fdc8964379/eascheduler-0.2.2.tar.gz",
"platform": null,
"description": "# EAScheduler\n[](https://github.com/spacemanspiff2007/eascheduler/actions)\n[](https://eascheduler.readthedocs.io/en/latest/?badge=latest)\n[](https://pyup.io/repos/github/spacemanspiff2007/eascheduler/)\n\n\n[]((https://pypi.org/project/EAScheduler/))\n[](https://pepy.tech/project/eascheduler)\n\n\n\n_Easy async task scheduling_\n\n\nEasy Async Scheduler (or EAScheduler) is a lightweight asyncio scheduler with a nice and easy to use interface.\n\nThe home automation software [HABApp](https://pypi.org/project/HABApp/) make use of EAScheduler.\n\n\n## Documentation\n[The documentation can be found here](https://eascheduler.readthedocs.io)\n\n## Example\n\n````python\nimport eascheduler\n\nasync def my_coro() -> None:\n print('Hello')\n\n# If you want something easy that you can use out of the box just use the default scheduler\nscheduler = eascheduler.get_default_scheduler()\n\n# -------------------------------------------------------------------------------------------------------\n# Different job types\n# -------------------------------------------------------------------------------------------------------\n\n# Run once in 30s\njob_once = scheduler.once(30, my_coro)\n\n# Countdown\ncountdown = scheduler.countdown(30, my_coro)\ncountdown.reset() # make countdown start (again)\ncountdown.stop() # stop countdown\ncountdown.set_countdown(15) # set different countdown time which will be used for the next reset call\n\n# Trigger job which runs continuously, e.g.\n\n# every day at 8\njob_every = scheduler.at(scheduler.triggers.time('08:00:00'), my_coro)\n# for the first time in 10 mins, then every hour\njob_every = scheduler.at(scheduler.triggers.interval(600, 3600), my_coro)\n\n# -------------------------------------------------------------------------------------------------------\n# Restricting the trigger with a filter.\n# Only when the filter condition passes the time will be taken as the next time\n\n# every Fr-So at 8\nscheduler.at(\n scheduler.triggers.time('08:00:00').only_at(scheduler.filters.weekdays('Fr-So')),\n my_coro\n)\n\n# Triggers can be grouped\n# Mo-Fr at 7, Sa at 8\nscheduler.at(\n scheduler.triggers.group(\n scheduler.triggers.time('07:00:00').only_at(scheduler.filters.weekdays('Mo-Fr')),\n scheduler.triggers.time('08:00:00').only_at(scheduler.filters.weekdays('Fr-So')),\n ),\n my_coro\n)\n\n# Filters can be grouped with any or all\n# On the first sunday of the month at 8\nscheduler.at(\n scheduler.triggers.time('08:00:00').only_at(\n scheduler.filters.all(\n scheduler.filters.days('1-7'),\n scheduler.filters.weekdays('So'),\n ),\n ),\n my_coro\n)\n\n# -------------------------------------------------------------------------------------------------------\n# The trigger time can also be modified\n\n# On sunrise, but not earlier than 8\nscheduler.at(\n scheduler.triggers.sunset().earliest('08:00:00'),\n my_coro\n)\n\n# One hour before sunset\nscheduler.at(\n scheduler.triggers.sunset().offset(timedelta(hours=-1)),\n my_coro\n)\n````\n\n## Changelog\n#### 0.2.2 (2025-01-07)\n- Ensured that all trigger builders are imputable and can be composed without side effects\n- Updated dependencies\n\n#### 0.2.1 (2024-11-20)\n- Updated dependencies and some type hints\n\n#### 0.2.0 (2024-11-13)\n- Complete rewrite\n\n#### 0.1.11 (2023-09-11)\n- Fixed an issue with a possible infinite loop\n\n#### 0.1.10 (2023-08-24)\n- Added option to add a callback to the job when the execution time changes\n\n#### 0.1.9 (2023-07-19)\n- Fix for days when the sun doesn't rise or set.\n In that case the next date with a sunrise/sunset will be returned.\n\n#### 0.1.8 (2022-12-14)\n- Fix for OneTimeJob incorrectly showing a remaining time after the execution\n- Dependency update\n\n#### 0.1.7 (2022-07-27)\n- Added py.typed\n\n#### 0.1.6 (2022-07-27)\n- Removed Python 3.7 support\n- Fixed setup issues\n\n#### 0.1.5 (2022-02-14)\n- Jobs have a remaining function\n- CountdownJob has a stop function\n\n#### 0.1.4 (2021-06-01)\n- Added option to pause and resume the scheduler\n- Jobs don't have to be in the future any more\n- Sorted imports with isort\n\n#### 0.1.3 (2021-05-06)\n- Fixed a bug where a negative offset/jitter could result in multiple executions\n\n#### 0.1.2 (2021-05-06)\n- Fixed a bug where ``.every(None, ...)`` would result in an error\n\n#### 0.1.1 (2021-05-02)\n- Implemented a much nicer API and fixed some bugs\n\n#### 0.1.0 (2021-04-21)\n- Fixed a race condition\n- Added tests\n\n#### 0.0.9 (2021-04-19)\n- Fixes for wrong timezone\n- Added tests\n\n#### 0.0.8 (2021-04-17)\n- Fixes for SunJob, ReoccurringJob\n- Added tests\n\n#### 0.0.7 (2021-04-15)\n- Fixes for Sunrise/Sunset\n",
"bugtrack_url": null,
"license": null,
"summary": "Easy async scheduling with a nice interface",
"version": "0.2.2",
"project_urls": {
"Documentation": "https://eascheduler.readthedocs.io/",
"GitHub": "https://github.com/spacemanspiff2007/eascheduler",
"Homepage": "https://github.com/spacemanspiff2007/eascheduler"
},
"split_keywords": [
"scheduler",
" asyncio"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b232640e4dfe6c0bd9be214211bd9f9bd14d31d0af211bf43cac025ad39e2b4a",
"md5": "c23e5c30ec4d12188f58b3c8d19cd222",
"sha256": "481052799fb15640680f77dc99a84bb076191909982c2bf1aa31bb4ddafb36d5"
},
"downloads": -1,
"filename": "EAScheduler-0.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c23e5c30ec4d12188f58b3c8d19cd222",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 46848,
"upload_time": "2025-01-10T04:43:11",
"upload_time_iso_8601": "2025-01-10T04:43:11.295251Z",
"url": "https://files.pythonhosted.org/packages/b2/32/640e4dfe6c0bd9be214211bd9f9bd14d31d0af211bf43cac025ad39e2b4a/EAScheduler-0.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ac7dae4a35d1643364fd4f1b0ba0234db3205a130de995d45908a2fdc8964379",
"md5": "f1d83594120d2aab966f09ba6209f0f6",
"sha256": "985dc71e4e1eff605dd4e0a1e7b9df13170ee4bb79254d4e8ff7be5a8c3e19f9"
},
"downloads": -1,
"filename": "eascheduler-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "f1d83594120d2aab966f09ba6209f0f6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 32674,
"upload_time": "2025-01-10T04:43:13",
"upload_time_iso_8601": "2025-01-10T04:43:13.516242Z",
"url": "https://files.pythonhosted.org/packages/ac/7d/ae4a35d1643364fd4f1b0ba0234db3205a130de995d45908a2fdc8964379/eascheduler-0.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-10 04:43:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "spacemanspiff2007",
"github_project": "eascheduler",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "eascheduler"
}