-
Notifications
You must be signed in to change notification settings - Fork 8
Generate a separate async-only stub #485
Copy link
Copy link
Labels
part:cookiecutterAffects the generation of projects using cookiecutterAffects the generation of projects using cookiecutterpart:only-apiAffects the configuration of a api repoAffects the configuration of a api repopart:templateAffects the cookiecutter template filesAffects the cookiecutter template filespart:toolingAffects the development tooling (CI, deployment, dependency management, etc.)Affects the development tooling (CI, deployment, dependency management, etc.)type:enhancementNew feature or enhancement visitble to usersNew feature or enhancement visitble to users
Milestone
Metadata
Metadata
Assignees
Labels
part:cookiecutterAffects the generation of projects using cookiecutterAffects the generation of projects using cookiecutterpart:only-apiAffects the configuration of a api repoAffects the configuration of a api repopart:templateAffects the cookiecutter template filesAffects the cookiecutter template filespart:toolingAffects the development tooling (CI, deployment, dependency management, etc.)Affects the development tooling (CI, deployment, dependency management, etc.)type:enhancementNew feature or enhancement visitble to usersNew feature or enhancement visitble to users
What's needed?
Async stubs generated by
mypyonly exist in thepyifiles, which leads to the interpreter to not know about their existence, ending with some hacks to be able to type-hint with them, but not being able to use them in any place the interpreter needs to understand them.mypy-protobufrecently got a PR merged allowing to generate sync-only and async-only stubs:When this is released, we should use to to remove the need for hacks to use async stubs.
Proposed solution
To keep backwards-compatibility, we probably want to generate a new async-only stub in a different file, for example we could have:
frequenz.api.xxx.aio.yyyto mirror what we currently have infrequenz.api.xxx.yyy. Then we can declare asyncio support in the old location as deprecated, and finally generate sync-only stubs in the old location.Use cases
No response
Alternatives and workarounds
No response
Additional context
No response