Skip to main content

An advanced timer library for managing scheduled tasks in Python.

Project description

EcmaTimer

PyPI version Supported Python versions PyPI downloads GitHub Actions status Codecov Licence Code style: Black

Installation

From PyPI

python3 -m pip install --upgrade EcmaTimer

From source

git clone https://github.com/inject3r/EcmaTimer.git
cd EcmaTimer
python3 -m pip install .

Example

import asyncio
from EcmaTimer import SetTimer, KillTimer, HandleTimerError, TimerError

async def example_timer_function():
    print("Timer triggered!")
    
async def main():
    try:
        # Set a simple timer that runs every 2 seconds
        timer_id = await SetTimer(example_timer_function, 2000, repeating=True)

        # Simulate waiting for some time before killing the timer
        await asyncio.sleep(10)

        # Kill the timer after 10 seconds
        await KillTimer(timer_id)
        print("Timer killed after 10 seconds.")
    except TimerError as e:
        await HandleTimerError(e.timer_id, e.message)

if __name__ == "__main__":
    asyncio.run(main())

Features

  • Asynchronous timers using asyncio.
  • Repeating and one-shot timers.
  • Exception handling for timer errors.
  • Easy integration into async Python applications.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Issues

If you find a bug or want to request a feature, please open an issue on GitHub.

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

ecmatimer-1.0.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

EcmaTimer-1.0.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file ecmatimer-1.0.0.tar.gz.

File metadata

  • Download URL: ecmatimer-1.0.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for ecmatimer-1.0.0.tar.gz
Algorithm Hash digest
SHA256 676864370b9e81f623de610aa1a1c14c663fc328f504c8afabfdfb58079f3225
MD5 5792462453c077d4ccf5a7717e150f1e
BLAKE2b-256 842fa9484fe1d29ffd227194b597a37c518f46f7e1804d332c0c385a7cbec3b3

See more details on using hashes here.

File details

Details for the file EcmaTimer-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: EcmaTimer-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for EcmaTimer-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9cbfe89d2809b18ddf8ff0719f6fa0cfef1a53305af50f964186f514a828af45
MD5 1dd11243415fcc85a65137981b3f018c
BLAKE2b-256 5c279000eb25b295c20a546d0fbc5a2c12c18ed70f7093c3bd9aaf90fc8e1fc6

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