forked from pybind/python_example
-
Notifications
You must be signed in to change notification settings - Fork 0
On the way to [pybind11-mypy-demo] #1
Copy link
Copy link
Open
Description
Pybind demo module
Basics
- Functions
- ✔️ w/o args
- ✔️ anonymous args
- ✔️ named args
- ✔️ defaulted args
- *args / **kwargs
- Classes
- ✔️ overloaded init
- ✔️ instance property ro/rw
- ✔️ class property ro/rw
- ✔️ instance attribute
- ✔️ class attribute
Stubgen features
Render values:
- defaulted function argument values
- "builtin-valued" attributes as is
- custom type valued attributes as comments
- pybind11-enum-valued attributes/arg default values
- module-valued class attributes
Render class/static members
- class function
- static function
- ✔️ class property -> ClassVar
Correct order of module elements
- Sort classes in topo-alpha order (
ZBaseclass would go beforeADerivedbutCatgoes beforeDog)
Render docstrings
- Add CLI option
- ❓ Add docstring preprocessing hooks
- Strip overloads annotations
Proper imports
- Import modules as underscored aliases
Corner cases
- Skip
__hash__ = Nonefor non-hashable types - don't render
__init__for non-constructable classes - [conditionally] strip
numpy.ndarrayshape info - [conditionally] strip
std::arrayshape info
Robustness to bad docstrings
- [conditionally] Render C++ types in signatures as strings (arguments or/and return type)
- [conditionally] Render Invalid python expression as argument default value as strings
- [conditionally] Produce error/warnings on above
Misc things to test (unordered)
- exclude umbrella
(*args, **kwargs)overload header from overload list - static/class functions and ro/rw properties
- regular ro/rw properties
- kw-only function arguments
- positional-only function arguments
- non-constructable types (with missing
__init__) - numpy arrays (how to handle shape?)
- don't produce import statement for nested classes
- (?) exclude
__hash__ = Noneline for non-hashable types that have__eq__ - (?) test nested class argument defined in submodule
- import names that not defined in module as underscored aliases
- test copy/opaque pybind types (including
pybind11/stl.handpybind11/stl_bind.h) - test registered exception render
- render classes in alpha-topological order (so
ZBaseclass would go beforeADerivedbutCatgoes beforeDog) - render functions after classes
- render module attributes that depend on the following classes with string types annotation (e.g.
x: 'Foo' = ...) - fix pybind versions (e.g. replace
iteratorwithIterator) - skip pybind11-internal attributes
- render pybind-overloaded "magic" python methods (e.g.
__add__) - [optional] render docstrings
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels