-
Notifications
You must be signed in to change notification settings - Fork 827
Introspection: Adds basic input type annotations #5089
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?
Conversation
9367241
to
e3546aa
Compare
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.
Sorry for the slow-ish review by me. I guess we will miss the 0.25 release for this (my bad).
Overall looks great, with just a few suggestions. 👍
Thank you for the review.
There is still a bunch of follow ups to get something working properly so it's definitely not a big deal. |
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.
Thanks, given all the comments I think this is good to merge (and I guess I can rebase the 0.25 branch to include this after all 😂)
Amazing!
I would feel better to have it in 0.26 to get time to do more testing, add more types across the codebase, deprecate the |
Implementation notes:
const
code (hence without macros), making advanced structs not possible. Moreover, because it is not possible to use generic types inconst
code, we won't be able to generatelist[int]
types at the moment but onlylist
. This limitation will be lifted ifmin_generic_const_args
unstable feature lands at some point. However it should be possible to write a macro that validates the types and wrap them in someTypeAnnotation(&'static str)
struct. Note that because our macros are aware of theOption<T>
parameters annotations likeT | None
are properly generated. We might expand that to other common containers likeVec
orHashMap
.#[pyclass]
. We will get that for free after merging Implements basic method introspection #5087typing.Any
. It might be cleaner to makeINPUT_TYPE
anOption<&'static str>
and useNone
as the default value to not set an annotation instead.