Skip to main content

Easy async scheduling with a nice interface

Project description

EAScheduler

Tests Status Documentation Status Updates PyPI - Python Version

PyPI Downloads

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 make use of EAScheduler.

Documentation

The documentation can be found here

Example

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.7 (2025-08-19)

  • Updated dependencies

0.2.6 (2025-06-12)

  • Small fixes
  • Updated dependencies

0.2.5 (2025-05-06)

  • Updated to whenever 0.8 which introduces breaking changes
  • Updated dependencies

0.2.4 (2025-05-06)

  • Updated to whenever 0.8 which introduces breaking changes
  • Updated dependencies

0.2.3 (2025-03-26)

  • Updated dependencies

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eascheduler-0.2.7.tar.gz (32.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eascheduler-0.2.7-py3-none-any.whl (47.1 kB view details)

Uploaded Python 3

File details

Details for the file eascheduler-0.2.7.tar.gz.

File metadata

  • Download URL: eascheduler-0.2.7.tar.gz
  • Upload date:
  • Size: 32.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for eascheduler-0.2.7.tar.gz
Algorithm Hash digest
SHA256 2d40301508e8be92fb2e24a3efb54804e8b043978a997e116a7f6f1d9385fe8e
MD5 211ec2d6ed68eb4da03f547d2c87dee5
BLAKE2b-256 bdd98dffb786a6fb3f2b5fbebeb17573a84b37eb7ef057b66ed3878cb1bf71f1

See more details on using hashes here.

File details

Details for the file eascheduler-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: eascheduler-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 47.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for eascheduler-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 fa0183ac827fadcc9f244e09b64a94af6375cceb9e417d6be6b97d9741bbe3e5
MD5 3a08532931c09bda68c3a08b5ad6baf8
BLAKE2b-256 3f4a6062cbd4b50036a8bd2ea9eec33058d01ae103bb1cd945badd2ff72fd360

See more details on using hashes here.

Supported by

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