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
Adds a basic stub file generator #369
Conversation
…ide private methods, etc.
stubgen.py
Outdated
children = [ | ||
children = [] | ||
if "__new__" in cls.__dict__: | ||
new = _stub_new(ctx.new_scope("__new__"), cls) |
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.
I'm still not seeing the correct signature for any of the rust-based classes after this change. Adding the stub for __init__
with the same signature as the newly-added __new__
stub fixed it for me.
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.
Looks like there's something up with pylsp
or Jedi for which only overriding __new__
does not cause the signature for the class to show correctly. I changed the stubgen to "rewrite" the signature for __new__
to __init__
which does display correctly in pylsp
.
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.
I think the better way to think about this is: every class defined in Python's signature is derived from it's __init__
. Native classes have a way of defining it separately. But since we're translating from native to Python (the stub), we need to move that information from the class itself to the __init__
.
_bytewax
bytewax._bytewax
stub file; will need to be re-generated on re-build