Python: Type-stub generation for SSDKs (#2149)
* Initial Python stub generation * Handle default values correctly * Only generate `__init__` for classes that have constructor signatures * Preserve doc comments * Make context class generic * Put type hint into a string to fix runtime error * Run `mypy` on CI * Use `make` to build Python SSDKs while generating diffs * Escape Python types in Rust comments * Only mark class methods with * Sort imports to minimize diffs * Add type annotations for `PySocket` * Dont extend classes from `object` as every class already implicitly extended from `object` * Use `vars` instead of `inspect.getmembers` to skip inherited members of a class * Fix linting issues * Add some tests for stubgen and refactor it * Add type annotations to `PyMiddlewareException` * Fix tests on Python 3.7 Python 3.7 doesn't support reading signatures from `__text_signature__` for non-builtin functions (i.e. C/Rust functions). For testing we're using regular Python syntax for defining signature. * Provide default values for `typing.Optional[T]` types in type-stubs * Update `is_fn_like` to cover more cases * Remove `tools/smithy-rs-tool-common/` * Make `DECORATORS` an array instead of a list * Ignore missing type stub errors for `aiohttp`
Loading
Please register or sign in to comment