async-batcher


Nameasync-batcher JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://github.com/hussein-awala/async-batcher
SummaryA service to batch your http requests.
upload_time2024-09-02 20:57:37
maintainerNone
docs_urlNone
authorHussein Awala
requires_python<4.0,>=3.10
licenseApache-2.0
keywords python asyncio rest grpc fastapi
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Async Batcher

This project provides a Python library to batch the asynchronous requests and handle them in batches.

## How to use

To use the library, you need to install the package in your environment. You can install the package using pip:

```bash
pip install async-batcher
```

Then, you can create a new `AsyncBatcher` class by implementing the `process_batch` method:

```python
from async_batcher.batcher import AsyncBatcher

class MyAsyncBatcher(AsyncBatcher):
    async def process_batch(self, batch):
        # Process the batch
        print(batch)

# Create a new instance of the `MyAsyncBatcher` class
async_batcher = MyAsyncBatcher(max_batch_size=20)
async_batcher.start()
```

## Benchmark

The benchmark is available in the [BENCHMARK.md](https://github.com/hussein-awala/async-batcher/blob/main/BENCHMARK.md)
file.

## Use cases

The `AsyncBatcher` library can be used in any application that needs to handle asynchronous requests in batches,
such as:
- Serving machine learning models that optimize the batch processing (e.g. TensorFlow, PyTorch, Scikit-learn, etc.)
- Storing multiple records in a database in a single query to optimize the I/O operations (or to reduce the cost of the
  database operations, e.g. AWS DynamoDB)
- Sending multiple messages in a single request to optimize the network operations (or to reduce the cost of the network
  operations, e.g. Kafka, RabbitMQ, AWS SQS, AWS SNS, etc.)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hussein-awala/async-batcher",
    "name": "async-batcher",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "python, asyncio, rest, grpc, fastapi",
    "author": "Hussein Awala",
    "author_email": "hussein@awala.fr",
    "download_url": "https://files.pythonhosted.org/packages/af/8b/4ad79681ce3471e14afa16061447b16de84706ecc9d6eb1ea34dd249bd54/async_batcher-0.2.1.tar.gz",
    "platform": null,
    "description": "# Async Batcher\n\nThis project provides a Python library to batch the asynchronous requests and handle them in batches.\n\n## How to use\n\nTo use the library, you need to install the package in your environment. You can install the package using pip:\n\n```bash\npip install async-batcher\n```\n\nThen, you can create a new `AsyncBatcher` class by implementing the `process_batch` method:\n\n```python\nfrom async_batcher.batcher import AsyncBatcher\n\nclass MyAsyncBatcher(AsyncBatcher):\n    async def process_batch(self, batch):\n        # Process the batch\n        print(batch)\n\n# Create a new instance of the `MyAsyncBatcher` class\nasync_batcher = MyAsyncBatcher(max_batch_size=20)\nasync_batcher.start()\n```\n\n## Benchmark\n\nThe benchmark is available in the [BENCHMARK.md](https://github.com/hussein-awala/async-batcher/blob/main/BENCHMARK.md)\nfile.\n\n## Use cases\n\nThe `AsyncBatcher` library can be used in any application that needs to handle asynchronous requests in batches,\nsuch as:\n- Serving machine learning models that optimize the batch processing (e.g. TensorFlow, PyTorch, Scikit-learn, etc.)\n- Storing multiple records in a database in a single query to optimize the I/O operations (or to reduce the cost of the\n  database operations, e.g. AWS DynamoDB)\n- Sending multiple messages in a single request to optimize the network operations (or to reduce the cost of the network\n  operations, e.g. Kafka, RabbitMQ, AWS SQS, AWS SNS, etc.)\n\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A service to batch your http requests.",
    "version": "0.2.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/hussein-awala/async-batcher/issues",
        "Documentation": "https://github.com/hussein-awala/async-batcher/blob/main/README.md",
        "Homepage": "https://github.com/hussein-awala/async-batcher",
        "Repository": "https://github.com/hussein-awala/async-batcher"
    },
    "split_keywords": [
        "python",
        " asyncio",
        " rest",
        " grpc",
        " fastapi"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a21f2bdbeed5610d56ba4f3d771a986b97b138cd368355e4632612b5b98261ce",
                "md5": "98e3675fc2ea046070ba8005ee6303ba",
                "sha256": "c31535cf34c22b315e814b29caaba208e8ad137e8886d7a0effa054210721159"
            },
            "downloads": -1,
            "filename": "async_batcher-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "98e3675fc2ea046070ba8005ee6303ba",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 16788,
            "upload_time": "2024-09-02T20:57:33",
            "upload_time_iso_8601": "2024-09-02T20:57:33.170816Z",
            "url": "https://files.pythonhosted.org/packages/a2/1f/2bdbeed5610d56ba4f3d771a986b97b138cd368355e4632612b5b98261ce/async_batcher-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "af8b4ad79681ce3471e14afa16061447b16de84706ecc9d6eb1ea34dd249bd54",
                "md5": "a0371b0bda81ca9e20c174621af9be1e",
                "sha256": "31bc6d6080557e9319f3e75107965078f0395fb6bf963f75d17adfb4dbde04db"
            },
            "downloads": -1,
            "filename": "async_batcher-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a0371b0bda81ca9e20c174621af9be1e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 12356,
            "upload_time": "2024-09-02T20:57:37",
            "upload_time_iso_8601": "2024-09-02T20:57:37.239332Z",
            "url": "https://files.pythonhosted.org/packages/af/8b/4ad79681ce3471e14afa16061447b16de84706ecc9d6eb1ea34dd249bd54/async_batcher-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-02 20:57:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hussein-awala",
    "github_project": "async-batcher",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "async-batcher"
}
        
Elapsed time: 1.00037s