Skip to content
/ botostubs Public

Type stubs for botocore and boto3. **Note: This project is a work in-progess**

License

Notifications You must be signed in to change notification settings

boto/botostubs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Boto Stubs

This repo contains a generator that produces type hints for botocore as well as the generated output. These type hints can be used both for the purpose of static type analysis and for dot completion support. The latter is relevant because botocore's classes don't exist until runtime, and therefore IDEs cannot know all the methods that will be available without this.

Note

This project is currently a work in-progress and is not yet intended for production.

Installation / Usage

To make use of the type hints, install the botocore-stubs package. mypy will automatically pick up on the type hints for botocore, even without expclitit annotations in your code. Other tools compatible with PEP561 style packages should also work.

Currently only botocore is supported. If you are using boto3 you will need to annotate your calls to boto3.client like so:

s3 = boto3.client('s3')  # type: botocore.client.S3

There is a known issue where boto3-specific methods, such as upload_file are not present in the stub files.

Development

This project uses black and pre-commit to enforce sytle on python code. On macOS you can do the following to get started:

brew install pre-commit
pre-commit install

That will set up the hooks to run black on every commit.

Structure

This repo contains multiple packages:

  • botocore-stubs is the stubs-only package that provides type hints for botocore. Most of it is generated code.
  • botogen is the code generator for the stubs packages.

When boto3 support is added, it will be under its own package, boto3-stubs.

About

Type stubs for botocore and boto3. **Note: This project is a work in-progess**

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages