-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Autogenerate Async stubs for auth0-python #13826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Autogenerate Async stubs for auth0-python #13826
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand it correctly, at runtime, you can call e.g. asyncify(Flubber)
on a class Flubber
and this will create a (private) subclass, let's call it _AsyncFlubber(Flubber)
that adds an ..._async
method for each public method in class Flubber
?
In this case, this approach makes sense to me, but we would need documentation describing both what I described above, but also how to correctly use the stubs.
@@ -11,5 +11,6 @@ per-file-ignores = | |||
# Y026: Have implicit type aliases | |||
# Y053: have literals >50 characters long | |||
stubs/*_pb2.pyi: Y021, Y023, Y026, Y053 | |||
stubs/auth0-python/auth0/_asyncified/**/*.pyi: Y053 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: The comment above should be changed from "Generated protobuf files" to just "Generated files".
This started as an experiment/demonstration for auth0/auth0-python#615 & auth0/auth0-python#678 (comment) . But I think it's actually good enough to be considered seriously.
With these changes, the stubs are a lot closer to the actual runtime implementations.
This can surely be improved further by using actual codemods and ast-based replacements. I was just more familiar with regex to get it working this way first.
Some manual changes here (related to removing entries from
stubs/auth0-python/@tests/stubtest_allowlist.txt
) can be done separately (I'll open a separate PR for them)