aiobotocore icon indicating copy to clipboard operation
aiobotocore copied to clipboard

[Tracking] roll into botocore

Open thehesiod opened this issue 8 years ago • 9 comments

just wondering, thanks!

thehesiod avatar Mar 06 '16 01:03 thehesiod

I do not object, just do not see clean way how to accomplish this. Could be tricky because botocore also supports python2.7 and aiobotocore uses yield from heavily.

jettify avatar Mar 06 '16 17:03 jettify

perhaps making the aio portion available for python3.x only? I think they do a similar thing with pyzmq: http://pyzmq.readthedocs.org/en/latest/api/zmq.asyncio.html

thehesiod avatar Mar 07 '16 19:03 thehesiod

I see this is being tracked in https://github.com/boto/botocore/issues/458

thehesiod avatar Apr 11 '16 05:04 thehesiod

the best way to handle this issue if client could be somehow abstracted from query/url/headers builder from IO. Nice approach also used here https://github.com/cablehead/python-consul

jettify avatar Jul 01 '16 21:07 jettify

@jettify an option for abstraction of IO from any code: https://gist.github.com/graingert/ca6cdd5d9ae2e18ca917b4594ac8a633

graingert avatar Mar 22 '17 16:03 graingert

We need to start thinking how to patch botocore so we can plugging our code using public api, for instance first easy change is to update https://github.com/boto/botocore/blob/develop/botocore/session.py#L108-L109 Session object to accept ClientCreator, so in aiobotocore we just pass AioClientCreator without coping screen of code.

jettify avatar May 22 '17 19:05 jettify

perhaps we can have a class by class goal of rolling into botocore to make it bite-sized chunks of work. But I think before that we need a high-level strategy defined of how we want this to integrate into botocore to create a straw-man we can work towards and get botocore dev approval on the design.

thehesiod avatar May 22 '17 20:05 thehesiod

another option is switching to the c++ library: https://github.com/aws/aws-sdk-cpp this would greatly increase performance as well, mainly due to signing.

thehesiod avatar Aug 02 '18 23:08 thehesiod

The general pattern in botocore is to register components or to hook up callbacks to an event-emitter (which itself could be a component). See

  • https://boto3.amazonaws.com/v1/documentation/api/latest/guide/events.html#boto3-specific-events
  • the boto3 example shows how to replace the BaseClient with a substitute parent class, which could be AioBaseClient
  • it also shows how to add custom methods on a client; aiobotocore could add new async methods that could be used side-by-side with existing "synchronous" methods rather than replacing those methods (if the botocore API is preserved and extended with new async methods, it might have a better chance of inclusion in botocore)
  • the boto3 event documentation is better than botocore event documentation, but essentially the same event system is used in botocore and boto3
  • moto uses the event system to apply mocks as before-send callbacks

In that context, aiobotocore might create and register components for:

  • custom event emitter that uses coroutines that can be awaited
  • custom client creator and client that can await event callbacks
  • custom client event handlers/coroutines that can be awaited

It’s not clear whether this would be any different, in the end, than what aiobotocore is already. This might be an alternative pattern to explore in aiobotocore as a POC, but it’s not clear whether it would work and it’s got little chance, if any, of ever getting merged into botocore (lots of useful PRs are stale on botocore).

dazza-codes avatar Feb 15 '20 22:02 dazza-codes