Skip to content

[Request] asyncio support #43

Open

Description

@hyunilmmt

Would love to see:

  • asyncio version of localstack_client
  • monkeypatch aioboto3 client and resource

Thanks :)

Activity

  1. whummer commented on Jan 24, 2023

    @whummer
    Member

    Hi @hyunilmmt , thanks for reporting! Can you please share some details about your use case - can you share a small snippet or test case of an asyncio function that would make use of the client? I think we have a rough understanding - but it would be helpful for us to understand the requirements a bit better.. Thanks!

  2. alexrashed commented on Sep 28, 2023

    @alexrashed
    Member

    Hi @hyunilmmt!
    Is there a chance you could give us some more details on this one?

  3. mjpieters commented on May 23, 2024

    @mjpieters

    aioboto3 is the asyncio version of boto3. It'll need patching the same way boto3 is being patched. The use case is that any project using aioboto3 in async code can be tested the same way you test boto3 code.

    e.g. using the sample function from the aioboto3 project:

    async def main():
        session = aioboto3.Session()
        async with session.resource("s3") as s3:
            bucket = await s3.Bucket('mybucket')
            async for s3_object in bucket.objects.all():
                print(s3_object)
    

    The Session() object there won't be patched even if you used localstack_client.patch.enable_local_endpoints ().

  4. mjpieters commented on May 23, 2024

    @mjpieters

    After a brief look at how enable_local_endpoints works, and at how aioboto3 defines the Session class you probably can apply the same patch to aioboto3 and have it work transparently.

    Note that the Session.client object is now a client defined by aiobotocore, but it uses botocore.client.BaseClient as the base exactly the same way boto3 / botocore use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions