aiolimiter


Nameaiolimiter JSON
Version 1.2.1 PyPI version JSON
download
home_pagehttps://github.com/mjpieters/aiolimiter
Summaryasyncio rate limiter, a leaky bucket implementation
upload_time2024-12-08 15:31:51
maintainerNone
docs_urlNone
authorMartijn Pieters
requires_python<4.0,>=3.8
licenseMIT
keywords asyncio rate-limiting leaky-bucket
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # aiolimiter

[![Azure Pipelines status for master branch][azure_badge]][azure_status]
[![codecov.io status for master branch][codecov_badge]][codecov_status]
[![Latest PyPI package version][pypi_badge]][aiolimiter_release]
[![Latest Read The Docs][rtd_badge]][aiolimiter_docs]

[azure_badge]: https://dev.azure.com/mjpieters/aiolimiter/_apis/build/status/CI?branchName=master
[azure_status]: https://dev.azure.com/mjpieters/aiolimiter/_build/latest?definitionId=4&branchName=master "Azure Pipelines status for master branch"
[codecov_badge]: https://codecov.io/gh/mjpieters/aiolimiter/branch/master/graph/badge.svg
[codecov_status]: https://codecov.io/gh/mjpieters/aiolimiter "codecov.io status for master branch"
[pypi_badge]: https://badge.fury.io/py/aiolimiter.svg
[aiolimiter_release]: https://pypi.org/project/aiolimiter "Latest PyPI package version"
[rtd_badge]: https://readthedocs.org/projects/aiolimiter/badge/?version=latest
[aiolimiter_docs]: https://aiolimiter.readthedocs.io/en/latest/?badge=latest "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:

```python
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][so45502319].

## Documentation

https://aiolimiter.readthedocs.io

## Installation

```sh
$ pip install aiolimiter
```

The library requires Python 3.8 or newer.

## Requirements

- Python >= 3.8

## License

`aiolimiter` is offered under the [MIT license](./LICENSE.txt).

## 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 [poetry][] to manage dependencies, testing and releases. Make sure you have installed that tool, then run the following command to get set up:

```sh
poetry install --with docs && poetry run doit devsetup
```

Apart from using `poetry run doit devsetup`, you can either use `poetry shell` to enter a shell environment with a virtualenv set up for you, or use `poetry run ...` to run commands within the virtualenv.

Tests are run with `pytest` and `tox`. Releases are made with `poetry build` and `poetry publish`. Code quality is maintained with `flake8`, `black` and `mypy`, and `pre-commit` runs quick checks to maintain the standards set.

A series of `doit` tasks are defined; run `poetry run doit list` (or `doit list` with `poetry shell` activated) to list them. The default action is to run a full linting, testing and building run. It is recommended you run this before creating a pull request.

[leaky bucket algorithm]: https://en.wikipedia.org/wiki/Leaky_bucket
[so45502319]: https://stackoverflow.com/a/45502319/100297
[github]: https://github.com/mjpieters/aiolimiter
[bug tracker]: https://github.com/mjpieters/aiolimiter/issues
[poetry]: https://poetry.eustace.io/


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mjpieters/aiolimiter",
    "name": "aiolimiter",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "asyncio, rate-limiting, leaky-bucket",
    "author": "Martijn Pieters",
    "author_email": "mj@zopatista.com",
    "download_url": "https://files.pythonhosted.org/packages/f1/23/b52debf471f7a1e42e362d959a3982bdcb4fe13a5d46e63d28868807a79c/aiolimiter-1.2.1.tar.gz",
    "platform": null,
    "description": "# aiolimiter\n\n[![Azure Pipelines status for master branch][azure_badge]][azure_status]\n[![codecov.io status for master branch][codecov_badge]][codecov_status]\n[![Latest PyPI package version][pypi_badge]][aiolimiter_release]\n[![Latest Read The Docs][rtd_badge]][aiolimiter_docs]\n\n[azure_badge]: https://dev.azure.com/mjpieters/aiolimiter/_apis/build/status/CI?branchName=master\n[azure_status]: https://dev.azure.com/mjpieters/aiolimiter/_build/latest?definitionId=4&branchName=master \"Azure Pipelines status for master branch\"\n[codecov_badge]: https://codecov.io/gh/mjpieters/aiolimiter/branch/master/graph/badge.svg\n[codecov_status]: https://codecov.io/gh/mjpieters/aiolimiter \"codecov.io status for master branch\"\n[pypi_badge]: https://badge.fury.io/py/aiolimiter.svg\n[aiolimiter_release]: https://pypi.org/project/aiolimiter \"Latest PyPI package version\"\n[rtd_badge]: https://readthedocs.org/projects/aiolimiter/badge/?version=latest\n[aiolimiter_docs]: https://aiolimiter.readthedocs.io/en/latest/?badge=latest \"Latest Read The Docs\"\n\n## Introduction\n\nAn efficient implementation of a rate limiter for asyncio.\n\nThis project implements the [Leaky bucket algorithm][], giving you precise control over the rate a code section can be entered:\n\n```python\nfrom aiolimiter import AsyncLimiter\n\n# allow for 100 concurrent entries within a 30 second window\nrate_limit = AsyncLimiter(100, 30)\n\n\nasync def some_coroutine():\n    async with rate_limit:\n        # this section is *at most* going to entered 100 times\n        # in a 30 second period.\n        await do_something()\n```\n\nIt was first developed [as an answer on Stack Overflow][so45502319].\n\n## Documentation\n\nhttps://aiolimiter.readthedocs.io\n\n## Installation\n\n```sh\n$ pip install aiolimiter\n```\n\nThe library requires Python 3.8 or newer.\n\n## Requirements\n\n- Python >= 3.8\n\n## License\n\n`aiolimiter` is offered under the [MIT license](./LICENSE.txt).\n\n## Source code\n\nThe project is hosted on [GitHub][].\n\nPlease file an issue in the [bug tracker][] if you have found a bug\nor have some suggestions to improve the library.\n\n## Developer setup\n\nThis project uses [poetry][] to manage dependencies, testing and releases. Make sure you have installed that tool, then run the following command to get set up:\n\n```sh\npoetry install --with docs && poetry run doit devsetup\n```\n\nApart from using `poetry run doit devsetup`, you can either use `poetry shell` to enter a shell environment with a virtualenv set up for you, or use `poetry run ...` to run commands within the virtualenv.\n\nTests are run with `pytest` and `tox`. Releases are made with `poetry build` and `poetry publish`. Code quality is maintained with `flake8`, `black` and `mypy`, and `pre-commit` runs quick checks to maintain the standards set.\n\nA series of `doit` tasks are defined; run `poetry run doit list` (or `doit list` with `poetry shell` activated) to list them. The default action is to run a full linting, testing and building run. It is recommended you run this before creating a pull request.\n\n[leaky bucket algorithm]: https://en.wikipedia.org/wiki/Leaky_bucket\n[so45502319]: https://stackoverflow.com/a/45502319/100297\n[github]: https://github.com/mjpieters/aiolimiter\n[bug tracker]: https://github.com/mjpieters/aiolimiter/issues\n[poetry]: https://poetry.eustace.io/\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "asyncio rate limiter, a leaky bucket implementation",
    "version": "1.2.1",
    "project_urls": {
        "CI: Azure Pipelines": "https://dev.azure.com/mjpieters/aiolimiter/_build",
        "Coverage: codecov": "https://codecov.io/github/aiolimiter/aiosignal",
        "Documentation": "http://aiolimiter.readthedocs.org/en/stable/",
        "GitHub: issues": "https://github.com/mjpieters/aiolimiter/issues",
        "Homepage": "https://github.com/mjpieters/aiolimiter",
        "Repository": "https://github.com/mjpieters/aiolimiter"
    },
    "split_keywords": [
        "asyncio",
        " rate-limiting",
        " leaky-bucket"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f3badf6e8e1045aebc4778d19b8a3a9bc1808adb1619ba94ca354d9ba17d86c3",
                "md5": "e4130ada5180306dbd8d4a164d5ddb36",
                "sha256": "d3f249e9059a20badcb56b61601a83556133655c11d1eb3dd3e04ff069e5f3c7"
            },
            "downloads": -1,
            "filename": "aiolimiter-1.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e4130ada5180306dbd8d4a164d5ddb36",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 6711,
            "upload_time": "2024-12-08T15:31:49",
            "upload_time_iso_8601": "2024-12-08T15:31:49.874584Z",
            "url": "https://files.pythonhosted.org/packages/f3/ba/df6e8e1045aebc4778d19b8a3a9bc1808adb1619ba94ca354d9ba17d86c3/aiolimiter-1.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f123b52debf471f7a1e42e362d959a3982bdcb4fe13a5d46e63d28868807a79c",
                "md5": "82306409ed14b7d46929606143a7ee65",
                "sha256": "e02a37ea1a855d9e832252a105420ad4d15011505512a1a1d814647451b5cca9"
            },
            "downloads": -1,
            "filename": "aiolimiter-1.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "82306409ed14b7d46929606143a7ee65",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 7185,
            "upload_time": "2024-12-08T15:31:51",
            "upload_time_iso_8601": "2024-12-08T15:31:51.496627Z",
            "url": "https://files.pythonhosted.org/packages/f1/23/b52debf471f7a1e42e362d959a3982bdcb4fe13a5d46e63d28868807a79c/aiolimiter-1.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-08 15:31:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mjpieters",
    "github_project": "aiolimiter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "aiolimiter"
}
        
Elapsed time: 0.48573s