question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[consent request] Type annotations for boto3

See original GitHub issue

Hello @swetashre,

I added boto3-stubs that was auto-generated from boto3 source code. Is it okay to keep it public?

It is recognized by mypy as an interface module for boto3.

Regards

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:11
  • Comments:19 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
vemelcommented, Jan 16, 2020

Thank you for your response!

boto3-stubs is maintained by me now.

More or less the idea is the same - I parse botocore shapes to build argument and return type annotations and I also use inspect with docstring parsing to annotate dynamic methods added by boto3 - this part is missing in botogen as I see.

What these projects have in common:

  • Type annotations are extracted from botocore shapes
  • Output is formatted by black for readability
  • Stubs builder for custom builds

Main differences from botogen:

  • TypedDict argument and return types with proper required and optional fields
  • Recursive TypedDict annotations support (required for dynamodb service)
  • Generated type definitions for using in user’s code, e.g., to annotate a function that accepts raw AWS response or a part of it, but still have type checking
  • Literal argument type annotations for IDE auto-complete and type checking
  • Annotations for auto-generated boto.client(...).Exceptions structure for IDE auto-complete and type checking
  • Support for methods injected by boto3
  • Patches for method signatures changed by boto3 (used in s3 and ec2 service and probably some others). botocore shapes are changed by boto3 sometimes, so shapes give you incorrect method signatures.
  • Links to official boto3 documentation from every class and method docstring
  • Modularity, so you can install type annotations for services you use from PyPI instead of creating custom builds
  • Working solituion for boto3.client and boto3.resource function overloads - basically I generate overloads only for services you have installed. Creating overloads for all services easily kills mypy and PyCharm due to high RAM usage.
  • Works on Python 3.6, 3.7 and 3.8, while botogen is missing 3.6 support
  • Automated builds for new boto3 versions and upload to PyPI, so end user can install them with pip or poetry for his boto3 version

I would like to help the project as my implementation works and covers all boto3 services and boto3. botocore stubs are not included, it was not one of my goals.

Let me know if you need any additional info about the project, because I guess it might be useful.

Regards, Vlad.

4reactions
ghostcommented, Nov 13, 2020

Hey @swetashre - any updates on this issue? Radio silence for a period of almost one year is a bit concerning.

Read more comments on GitHub >

github_iconTop Results From Across the Web

class IAM. Client - Boto3 Docs 1.26.33 documentation
The caller of this operation must be granted the PassRole permission on the IAM role ... The permissions boundary usage type that indicates...
Read more >
boto3-type-annotations · PyPI
A programmatically created package that defines boto3 services as stand in classes with type annotations. boto3 is an incredibly useful, ...
Read more >
Request Inferences from a Deployed Service (Boto3)
You can submit inference requests using SageMaker SDK for Python (Boto3) client and invoke_endpoint() API once you have an SageMaker endpoint InService ....
Read more >
Type annotations for boto3 have arrived! : r/Python - Reddit
mypy compatibility as a main goal · Real type annotations. · Subresources are included · modularity, so you can install only services you...
Read more >
Typing/Reformatting/Autocomplete lags when stubs for boto3 ...
It still provides all type annotations for boto3 and can be installed with sub-packages, just like boto3-stubs . But it does not provide...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found