{"id":17464329,"url":"https://github.com/sylvainmouquet/concurrency-limiter","last_synced_at":"2026-01-21T07:26:00.798Z","repository":{"id":257807124,"uuid":"866424457","full_name":"sylvainmouquet/concurrency-limiter","owner":"sylvainmouquet","description":"Concurrency-Limiter is a Python library that provides a decorator to limit the number of concurrent executions with asyncio.gather","archived":false,"fork":false,"pushed_at":"2024-10-09T19:38:13.000Z","size":103,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-06T10:27:04.097Z","etag":null,"topics":["asyncio","concurrency","decorator","gather","library","limiter","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/concurrency-limiter","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sylvainmouquet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-02T08:30:20.000Z","updated_at":"2025-04-25T18:06:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"7a8e8597-b104-4adf-9e4a-36597cc46e41","html_url":"https://github.com/sylvainmouquet/concurrency-limiter","commit_stats":null,"previous_names":["sylvainmouquet/concurrency-limiter"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sylvainmouquet/concurrency-limiter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sylvainmouquet%2Fconcurrency-limiter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sylvainmouquet%2Fconcurrency-limiter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sylvainmouquet%2Fconcurrency-limiter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sylvainmouquet%2Fconcurrency-limiter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sylvainmouquet","download_url":"https://codeload.github.com/sylvainmouquet/concurrency-limiter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sylvainmouquet%2Fconcurrency-limiter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28629915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","concurrency","decorator","gather","library","limiter","python"],"created_at":"2024-10-18T10:45:24.131Z","updated_at":"2026-01-21T07:26:00.771Z","avatar_url":"https://github.com/sylvainmouquet.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Concurrency-Limiter\n\nConcurrency-Limiter is a python decorator to limit the number of concurrent executor in asyncio.gather\n\n### Demonstration:\n\n```python\n@pytest.mark.asyncio\nasync def test_concurrency_limiter():\n    @concurrency_limiter(max_concurrent=5)\n    async def fetch_data(id):\n        logger.info(f\"Fetch data: {id}\")\n        await asyncio.sleep(1)\n\n    await asyncio.gather(*(fetch_data(i) for i in range(10)))\n\nDEBUG    concurrency-limiter:__init__.py:61 [RUNNING] func: fetch_data - \u003casyncio.locks.BoundedSemaphore object at 0x102778cd0 [unlocked, value:4]\u003e\nDEBUG    concurrency-limiter:__init__.py:61 [RUNNING] func: fetch_data - \u003casyncio.locks.BoundedSemaphore object at 0x102778cd0 [unlocked, value:3]\u003e\nDEBUG    concurrency-limiter:__init__.py:61 [RUNNING] func: fetch_data - \u003casyncio.locks.BoundedSemaphore object at 0x102778cd0 [unlocked, value:2]\u003e\nDEBUG    concurrency-limiter:__init__.py:61 [RUNNING] func: fetch_data - \u003casyncio.locks.BoundedSemaphore object at 0x102778cd0 [unlocked, value:1]\u003e\nDEBUG    concurrency-limiter:__init__.py:61 [RUNNING] func: fetch_data - \u003casyncio.locks.BoundedSemaphore object at 0x102778cd0 [locked]\u003e\nINFO     concurrency-limiter:__init__.py:59 [WAITING] func: fetch_data - \u003casyncio.locks.BoundedSemaphore object at 0x102778cd0 [locked]\u003e\nINFO     concurrency-limiter:__init__.py:59 [WAITING] func: fetch_data - \u003casyncio.locks.BoundedSemaphore object at 0x102778cd0 [locked, waiters:1]\u003e\nINFO     concurrency-limiter:__init__.py:59 [WAITING] func: fetch_data - \u003casyncio.locks.BoundedSemaphore object at 0x102778cd0 [locked, waiters:2]\u003e\nINFO     concurrency-limiter:__init__.py:59 [WAITING] func: fetch_data - \u003casyncio.locks.BoundedSemaphore object at 0x102778cd0 [locked, waiters:3]\u003e\nINFO     concurrency-limiter:__init__.py:59 [WAITING] func: fetch_data - \u003casyncio.locks.BoundedSemaphore object at 0x102778cd0 [locked, waiters:4]\u003e\nDEBUG    concurrency-limiter:__init__.py:61 [RUNNING] func: fetch_data - \u003casyncio.locks.BoundedSemaphore object at 0x102778cd0 [locked, waiters:4]\u003e\nDEBUG    concurrency-limiter:__init__.py:61 [RUNNING] func: fetch_data - \u003casyncio.locks.BoundedSemaphore object at 0x102778cd0 [locked, waiters:3]\u003e\nDEBUG    concurrency-limiter:__init__.py:61 [RUNNING] func: fetch_data - \u003casyncio.locks.BoundedSemaphore object at 0x102778cd0 [locked, waiters:2]\u003e\nDEBUG    concurrency-limiter:__init__.py:61 [RUNNING] func: fetch_data - \u003casyncio.locks.BoundedSemaphore object at 0x102778cd0 [locked, waiters:1]\u003e\nDEBUG    concurrency-limiter:__init__.py:61 [RUNNING] func: fetch_data - \u003casyncio.locks.BoundedSemaphore object at 0x102778cd0 [locked]\u003e\n\n```\n\n## Table of Contents\n\n- [concurrency_limiter](#concurrency_limiter)\n  - [Table of Contents](#table-of-contents)\n  - [Description](#description)\n  - [Installation](#installation)\n  - [Usage](#usage)\n  - [License](#license)\n  - [Contact](#contact)\n\n## Description\n\nConcurrency-Limiter is a Python library that provides a decorator to limit the number of concurrent executions in asyncio.gather. This ensures that your asynchronous tasks do not overwhelm system resources, allowing for better control over concurrency and improved performance in applications that rely on asynchronous operations.\n\n## Installation\n\n```bash\n# Install the dependency\npip install concurrency-limiter\nuv add concurrency-limiter\npoetry add concurrency-limiter\n```\n\n## Usage\n\n```python\nfrom concurrency_limiter import concurrency_limiter\nimport asyncio\nimport random\n\n# List of flowers for our examples\nflowers = [\"Rose\", \"Tulip\", \"Sunflower\", \"Daisy\", \"Lily\"]\n\n# Asynchronous function example to plant a flower\n@concurrency_limiter(max_concurrent=3)\nasync def plant_flower():\n    flower = random.choice(flowers)\n    print(f\"Attempting to plant a {flower}\")\n    await asyncio.sleep(0.1)  # Simulating planting time\n    if random.random() \u003c 0.8:  # 80% chance of failure\n        raise Exception(f\"The {flower} didn't take root\")\n    return f\"{flower} planted successfully\"\n\n# Start of Selection\nif __name__ == \"__main__\":\n    asyncio.run(asyncio.gather(*(plant_flower() for i in range(5))))\n# End of Selection\n```\n\n\n## License\n\nConcurrency-Limiter is released under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n## Contact\n\nFor questions, suggestions, or issues related to Concurrency-Limiter, please open an issue on the GitHub repository.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsylvainmouquet%2Fconcurrency-limiter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsylvainmouquet%2Fconcurrency-limiter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsylvainmouquet%2Fconcurrency-limiter/lists"}