Skip to main content

Debouncer and friends for Python

Project description

Asyncio Debouncer

Description

This Python package provides a debounce decorator. It's designed for rate-limiting function calls in asynchronous Python applications.

📋 Requirements

📦 Installation

The package handle in PyPI is python-debouncer

Pip

pip install python-debouncer

Poetry

poetry add python-debouncer

🛠 Usage

Import the decorator and apply it to your async functions:

from debouncer import DebounceOptions, debounce

@debounce(wait=.5, options=DebounceOptions(trailing=True, leading=False, time_window=3))
async def your_function():
    # Function body

Lodash documentation

⚠️ Important Note

maxWait in Lodash implementation is renamed to time_window here, I think semantically it makes more sense.

🎉 Demo

See demo.py for a usage example.

🤝 Contributing

Contributions are welcome. Please fork the repository and open a pull request.

🔒 License

This project is released under the Apache-2.0 License. See the LICENSE file for more details.

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

python_debouncer-0.1.3.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

python_debouncer-0.1.3-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file python_debouncer-0.1.3.tar.gz.

File metadata

  • Download URL: python_debouncer-0.1.3.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Darwin/23.2.0

File hashes

Hashes for python_debouncer-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b5bb28d28bfa0914cfcc52c6ee54f03543c1e003a23c3433a3d7bd304b4f9bbe
MD5 44fd4844f1a50145ae665f7b4bfa266f
BLAKE2b-256 ab2479af1ba42f05bb79920079d931ce3bbc1eb23aacedf43102a73331db4516

See more details on using hashes here.

File details

Details for the file python_debouncer-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for python_debouncer-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 25908a6ff1e28485c5ac346002d79597261357fbb7ee0fdf372365cac6fe796e
MD5 8bd749141cda04ad877ddd52f5faab4b
BLAKE2b-256 bb40f1006ad40c32c930a9f627a486cbe1de3105891973427e2f946a82ebb61d

See more details on using hashes here.

Supported by

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