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
- Python 3.9 or later.
- python-immutable
📦 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
⚠️ 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
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5bb28d28bfa0914cfcc52c6ee54f03543c1e003a23c3433a3d7bd304b4f9bbe |
|
MD5 | 44fd4844f1a50145ae665f7b4bfa266f |
|
BLAKE2b-256 | ab2479af1ba42f05bb79920079d931ce3bbc1eb23aacedf43102a73331db4516 |
File details
Details for the file python_debouncer-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: python_debouncer-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.6 Darwin/23.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25908a6ff1e28485c5ac346002d79597261357fbb7ee0fdf372365cac6fe796e |
|
MD5 | 8bd749141cda04ad877ddd52f5faab4b |
|
BLAKE2b-256 | bb40f1006ad40c32c930a9f627a486cbe1de3105891973427e2f946a82ebb61d |