Let me try to answer some of your comments.
I'm open to changes even rewrites if I'm convinced there is a better way.
---
For Kailash's suggestions:
1. "Granularity per channel, per server"
Yes, what you interpret is correct, we don't want to promote mixing async and sync RPC method handlers.
The pre-packaged services should be updated to have two implementation. Thank you for reminding me of them...
For simple service, it is easy to add "async def" prefix for those handlers. For complex service, it is error-prone to simply wrap normal functions into async functions.
The changes in threading model may cause a lot of issues that only observable in runtime. This is my concern.
Since you all want to ease the transition, I will make it a warning instead of hard failure.
2. "Executors"
I'm aware of this API, and considered to use it by default to seamlessly mock current API.
But 1) if the application fully adopted `asyncio`, there shouldn't be any need for the executors.
2) there are issues with both executors. The performance of ThreadPoolExecutor is terrible; the fork operation in ProcessExecutor is unsupported by gRPC Python (yet).
Even if we want to support them in future, I hope they are disabled by default. This should be considered a separated feature.
3. Future vs. Task
Access the result of an RPC in client-side (grpc.aio.Call), I assume users do care about the result, hence they will "await" on them.
On the other hand, "send_initial_metadata" is an operation which users may fire-and-forget, so the Task class is more suitable.
4. "grpc.aio.channel_ready_future" naming
Agree. Updating in later version.
5. Exceptions in asyncio vs. grpcio
Sadly, the grpc.RpcError is a class of it own which covered all kinds of errors in gRPC space.
In the gRFC, my point is to get rid of existing `grpc.FutureTimeoutError` and `grpc.FutureCancelledError`.
6. Write the difference in the view of `asyncio` user
This is a really good idea. For now, this gRFC should be a guide for existing users to adopt `asyncio` practice.
Probably we should write a migration tutorial after it is done.
7. Full API Definition
My original thought is that the full API definition is more than one thousand lines of code, and might change during implementation.
I can do an actual PR for the new interfaces, and link in the gRFC.
---
For Mehrdad's suggestions:
The overall effort of refactoring is called "
grpc-easy" that should solve usability issues and integrate Python 3 features.
I have been naive to defer the usability improvement to later part, but you are right, probably this gRFC is the place to perform the improvements.
1. Remove "grpc.aio" namespace
The answer from Kailash is better than what I have.
Mine is to minimize the impact we might have to existing users.
Also, the adoption of `asyncio` is not a mindless change, I don't want to tangle up coroutines and normal functions.
Many improvements (including ones you suggested) can't be done without regression if we stick to existing interfaces.
2. Async & Sync Method Handlers
Will change to warning instead of hard failure. Thanks for pointing out.
3. Generator is hard to use
I want to change it as well. But it will be a breaking change.
Several questions need to be answered:
  1) How to mix generator based handlers and direct invocation handlers?
  2) How do we deal with existing iterator semantic? E.g. the request_iterator allows program to iterator through with a single for loop. But for "recv" API, Python needs to use "while" loop.
  3) How do we define the end of an RPC?
I will try to propose a way of doing it in later commits. Suggestions are welcomed.
4. Simultaneous read and write is prohibited in C-Core
I'm not aware of that C-Core rule before. I have to investigate to talk more.
5. Concrete classes instead of Java-in-Python-abstract-class
I would love to change it if possible.
6. Server-side interceptor API hurts performance
I would say the impact to performance depends on how the interceptor is implemented.
Do you have more concrete example about this impact?
7. Subscribe API Redesign
Can you please give me the use case of "subscribe only once"?
Thanks to `asyncio`, the `grpc.aio` version doesn't need the polling thread.
8. Separate gRFC for each API
This gRFC won't be merged until all APIs are implemented.
There are plenty of time for us to discuss the details.
I'll ping the thread once I have resolved all your comments.