Skip to main content

Builder for boto3-stubs and types-aiobotocore

Project description

mypy_boto3_builder

Open in Visual Studio Code

PyPI - mypy-boto3-builder PyPI - boto3-stubs PyPI - boto3

Docs Docs

PyPI - Python Version PyPI - Downloads

boto3.typed

Type annotations builder for boto3-stubs project. Compatible with VSCode, PyCharm, Emacs, Sublime Text, mypy, pyright and other tools.

See how it helps to find and fix potential bugs:

boto3-stubs demo

Do you want more? Check the documentation and use boto3 like a pro!

Using boto3-stubs

Check boto3-stubs project for installation and usage instructions.

If you use VSCode, add AWS Boto3 extension to your VSCode and run AWS boto3: Quick Start command.

If not, just install boto3-stubs with pip:

python -m pip install 'boto3-stubs[all]'

# Lite version does not provide session.client/resource overloads
# it is more RAM-friendly, but requires explicit type annotations
python -m pip install 'boto3-stubs-lite[all]'

# If you use aiobotocore, use asynchronous version
python -m pip install 'types-aiobotocore[all]'
python -m pip install 'types-aiobotocore-lite[all]'

# do not forget to install mypy or pyright

And you should already have code completion and type checking in your IDE! You can stop reading now.

THe rest of this document is about building boto3-stubs manually. For example, if you want to use the latest features for an older boto3 version.

How to build type annotations

Locally

# Install preferred version of `boto3`
python -m pip install boto3==1.16.25 botocore==1.19.25

# Install `mypy-boto3-builder`
python -m pip install mypy-boto3-builder

# Build all packages in mypy_boto3_output directory
python -m mypy_boto3_builder mypy_boto3_output

# Or specify required services explicitly
python -m mypy_boto3_builder mypy_boto3_output -s ec2 s3

# Install custom `boto3-stubs` packages
cd mypy_boto3_output
python -m pip install -e ./mypy_boto3_ec2_package
python -m pip install -e ./mypy_boto3_s3_package
python -m pip install -e ./boto3_stubs_package

With Docker image

  • Install Docker
  • Pull latest mypy_boto3_builder version and tag it
docker pull docker.pkg.github.com/youtype/mypy_boto3_builder/mypy_boto3_builder_stable:latest
docker tag docker.pkg.github.com/youtype/mypy_boto3_builder/mypy_boto3_builder_stable:latest mypy_boto3_builder
  • Generate stubs in output directory
mkdir output

# generate stubs for all services
docker run -v `pwd`/output:/output -ti mypy_boto3_builder_stable

# generate stubs for s3 service
docker run -v `pwd`/output:/output -ti mypy_boto3_builder_stable -s s3

# generate stubs for a specific boto3 version
docker run -e BOTO3_VERSION=1.16.25 BOTOCORE_VERSION=1.19.25 -v `pwd`/output:/output -ti mypy_boto3_builder_stable
  • Install packages from output directory as described above

Development

  • Install Python 3.10+, ideally with pyenv
  • Install poetry: pip install poetry
  • Install dependencies: poetry install
  • Use scripts for repo to check if everything works: ./scripts/build.sh
  • Run manual pre-commit: ./scripts/before_commit.sh

Versioning

mypy_boto3_builder version is not related to boto3 version and follows PEP 440.

Latest changes

Full changelog can be found in Releases.

Thank you

Toolset

Contributors

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mypy-boto3-builder-7.7.3.tar.gz (133.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mypy_boto3_builder-7.7.3-py3-none-any.whl (241.4 kB view details)

Uploaded Python 3

File details

Details for the file mypy-boto3-builder-7.7.3.tar.gz.

File metadata

  • Download URL: mypy-boto3-builder-7.7.3.tar.gz
  • Upload date:
  • Size: 133.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for mypy-boto3-builder-7.7.3.tar.gz
Algorithm Hash digest
SHA256 b3ff17cc966d9f04b542836091bf7309c2534423f0d6a7202f8b5ac8112c0919
MD5 8c598e3b4615931228ece5e82b667e8c
BLAKE2b-256 f3f2016def244cec785c9acf5ae353481dccc1fe7b585799bbdd81a625590007

See more details on using hashes here.

File details

Details for the file mypy_boto3_builder-7.7.3-py3-none-any.whl.

File metadata

File hashes

Hashes for mypy_boto3_builder-7.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 99e500fd19c470538c01d22aaa6856d970f0e017c52e212b5db210141468bcca
MD5 45fdfce2b5ad76b068cd73254c59743a
BLAKE2b-256 169cb31a46dc5935e996fc251cfda215a6edbee214b5a6b604db0a4d7dfa7314

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page