Skip to main content

aiolimiter

GitHub Actions status for default branch codecov.io status for default branch Latest PyPI package version Latest Read The Docs

Introduction

An efficient implementation of a rate limiter for asyncio.

This project implements the Leaky bucket algorithm, giving you precise control over the rate a code section can be entered:

from aiolimiter import AsyncLimiter

# allow for 100 concurrent entries within a 30 second window
rate_limit = AsyncLimiter(100, 30)


async def some_coroutine():
    async with rate_limit:
        # this section is *at most* going to entered 100 times
        # in a 30 second period.
        await do_something()

It was first developed as an answer on Stack Overflow.

Documentation

https://aiolimiter.readthedocs.io

Installation

$ pip install aiolimiter

The library requires Python 3.10 or newer.

Requirements

  • Python >= 3.10

License

aiolimiter is offered under the MIT license.

Source code

The project is hosted on GitHub.

Please file an issue in the bug tracker if you have found a bug or have some suggestions to improve the library.

Developer setup

This project uses uv to manage dependencies, testing and releases. Make sure you have installed that tool, then run the following command to get set up:

uv sync

Tests are run with pytest and tox. Releases are made managed by a GitHub Actions workflow. Code quality is maintained with ruff and pyright, and prek runs quick checks to maintain the standards set.

A Taskfile is provided that defines specific tasks such as linting, formatting or previewing the documentation:

$ task --list
task: Available tasks for this project:
* default:                               Default task, runs linters and tests
* dev:format:                            Runs formatters                           (aliases: format)
* dev:install-prek:                      Install prek into local git checkout      (aliases: dev:install-precommit)
* dev:lint:                              Runs linters                              (aliases: lint)
* dev:lint:code:                         Lint the source code
* dev:lint:renovate:                     Lint the Renovate configuration file
* dev:test:                              Run tests                               (aliases: test)
* dev:tox:                               Run tests with tox                      (aliases: tox)
* dev:uv-lock:                           Updates the uv lock file                (aliases: lock)
* dist:build:                            Build the distribution packages         (aliases: dist)
* dist:clean:                            Remove built distribution packages      (aliases: clean)
* dist:publish:                          Publish package to PyPI                 (aliases: publish)
* docs:build:                            Build project documentation             (aliases: docs)
* docs:checks:                           Run all documentation checks
* docs:checks:spelling:                  Check documentation spelling.
* docs:checks:towncrier:                 Check changelog towncrier output()
* docs:checks:towncrier_fragments:       Check changelog towncrier fragments
* docs:clean:                            Clean the documentation build directory
* docs:serve:                            Live preview server for project documentation      (aliases: preview)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiolimiter-1.3.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

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

aiolimiter-1.3.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file aiolimiter-1.3.0.tar.gz.

File metadata

  • Download URL: aiolimiter-1.3.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for aiolimiter-1.3.0.tar.gz
Algorithm Hash digest
SHA256 7343008c2228e89def7d4ce29ab98ee98822bf5db69018c09c90088929f7c104
MD5 4951ea2e79c9913e710b92bc3ad8c20e
BLAKE2b-256 26600d16f90083a2f0ae9421d11ad98287f7942414f091ae9ad318389a764f85

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolimiter-1.3.0.tar.gz:

Publisher: ci-cd.yml on mjpieters/aiolimiter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aiolimiter-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: aiolimiter-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for aiolimiter-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0c16c377049fb2e40cc3373770e29c063de32aa25d84e5db168c854da6462b7
MD5 f421ea0033de953a2b31f955babcd620
BLAKE2b-256 56d89237b1d29e561bd37ffe9487ea1a4551d2df2902d9b79a6ea6b18e4fcc73

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolimiter-1.3.0-py3-none-any.whl:

Publisher: ci-cd.yml on mjpieters/aiolimiter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 files

1.2.1

2 files

1.2.0

2 files

1.1.1

2 files

1.1.0

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page