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.4.tar.gz (7.4 kB view hashes)

Uploaded Source

Built Distribution

python_debouncer-0.1.4-py3-none-any.whl (8.2 kB view hashes)

Uploaded Python 3

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