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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_debouncer-0.1.5.tar.gz.
File metadata
- Download URL: python_debouncer-0.1.5.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad4bc0229334f12cf0268a55c76ea98cb89a28f933c12fb556f92623e0c72b04
|
|
| MD5 |
f7e7df946eebf030d366fe0bb5f74bcc
|
|
| BLAKE2b-256 |
98513c746a5a0925dce853f19a19705753d188ff3abe055ce9655dce1762dd92
|
File details
Details for the file python_debouncer-0.1.5-py3-none-any.whl.
File metadata
- Download URL: python_debouncer-0.1.5-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d92bef943f169f93b5be79bc5c71e315f155ec7090e95c02a14c420ebdd4765d
|
|
| MD5 |
fe9e2299bd84bd0d2a1ae89cc4e1bb13
|
|
| BLAKE2b-256 |
79066044f6ccc2b07755e8d3da794c79ac90daeaab1008470cc2484050c0366d
|