Skip to content

feat req: mypy type stubs #1390

@crdrost

Description

@crdrost

I would like to be able to typecheck usage of aws_encryption_sdk using the new MPL lib.

I was able to generate some local stubs with

$ poetry run stubgen -o types -p 'aws_encryption_sdk'                                                                    2 ↵
Processed 42 modules
Generated files under types/aws_encryption_sdk/

but stubgen on the smithygenerated stuff causes some pickling error,

$ poetry run stubgen -p aws_cryptographic_material_providers
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/[email protected]/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/queues.py", line 244, in _feed
    obj = _ForkingPickler.dumps(obj)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/reduction.py", line 51, in dumps
    cls(buf, protocol).dump(obj)
TypeError: cannot pickle 'module' object

[ ... some time later ... ]

Traceback (most recent call last):
  File "/Users/cdrost/Library/Caches/pypoetry/virtualenvs/project-sGieSmVg-py3.11/bin/stubgen", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "mypy/stubgen.py", line 1989, in main
  File "mypy/stubgen.py", line 1776, in generate_stubs
  File "mypy/stubgen.py", line 1530, in collect_build_targets
  File "mypy/stubgen.py", line 1557, in find_module_paths_using_imports
  File "mypy/stubutil.py", line 81, in walk_packages
  File "mypy/moduleinspect.py", line 146, in get_package_properties
  File "mypy/moduleinspect.py", line 172, in _get_from_queue
RuntimeError: Timeout waiting for subprocess

Since apparently it's all autogenerated from dafny anyways it seems like it might be tractable for AWS to just publish proper type stubs for aws_cryptographic_material_providers?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions