The ChannelTTypeVar was causing a lot of issues because the types in it would change dynamically depending on which grpc library is installed. This transpired to user code wanting to subclass BaseApiClient which is less than ideal (hacks should be kept internal).
This PR improves this by adding a function to create a channel, which also avoids the need to create a lot of stub grpcio functions, and making ChannelT bound to an AsyncContextManager[Any] instead of the two specific channel classes we use. This interface is enough for the functionality we need from channels.
This way the hacks don't leak to the type system, which was the main issue.
The
ChannelT
TypeVar
was causing a lot of issues because the types in it would change dynamically depending on which grpc library is installed. This transpired to user code wanting to subclassBaseApiClient
which is less than ideal (hacks should be kept internal).This PR improves this by adding a function to create a channel, which also avoids the need to create a lot of stub
grpcio
functions, and makingChannelT
bound to anAsyncContextManager[Any]
instead of the two specific channel classes we use. This interface is enough for the functionality we need from channels.This way the hacks don't leak to the type system, which was the main issue.