Skip to content
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

[stubgenc] Render a bit better stubs #9903

Merged
merged 9 commits into from
Feb 11, 2021

Conversation

sizmailov
Copy link
Contributor

@sizmailov sizmailov commented Jan 12, 2021

Description

PR contains a couple of improvements of stubgenc generator:

  • render nested classes
  • shorten full-qualified types in properties
  • show concrete types of attributes
  • swap class/function render order (due to possible dependency on classes in functions arguments/return type)
  • remove redundant (*args, **kwargs) overloads in pybind11 modules (closes Ignore generic type signature in pybind11 functions and methods with overloads #9070)
  • render pybind11 static properties as x: ClassVar[T]
  • render rw-properties as annotated class attributes (e. g. x: T)

Test Plan

Tests against pybind11-mypy-demo project are included

@sizmailov sizmailov changed the title Stubgenc enhance 1 [stubgenc] Render a bit better stubs Jan 12, 2021
@sizmailov sizmailov force-pushed the stubgenc-enhance-1 branch 5 times, most recently from 61fb40c to 1a42e68 Compare January 13, 2021 17:53
Functions may depend on class definitions, therefore should go after
classes to not confuse some static analysis tools.

A better solution (although way complex) would be a topological sort of all
module elements (including variables)
…) signature

Overloaded function header in pybind11 was erroneously recognized as an extra overload.
Pybind includes function name in the property signature in docstrings
@sizmailov

This comment has been minimized.

1 similar comment
@sizmailov
Copy link
Contributor Author

Gentle ping

@sizmailov
Copy link
Contributor Author

sizmailov commented Feb 9, 2021

Is this PR too big? Should it be split into smaller pieces, which can be easily reviewed?

The individual changes are rather small and related, but are decoupled to some degree, so they can be applied one after another if needed. I thought it would be faster to ship them as one, rather than a series of dependent PRs.

Please let me know if I can do anything to push the changes forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ignore generic type signature in pybind11 functions and methods with overloads
3 participants