Builder for boto3-stubs and types-aiobotocore
Project description
Boto3 type annotations generator
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:
Do you want more? Check the documentation and use boto3
like a pro!
Using built libraries
boto3
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[essential]'
# 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[essential]'
# do not forget to install mypy or pyright
That's it! You should already have code completion and type checking in your IDE.
aiobotocore
Check types-aiobotocore project for installation and usage instructions.
Or just install types-aiobotocore
with pip
:
python -m pip install 'types-aiobotocore[essential]'
# Lite version does not provide session.create_client overloads
# it is more RAM-friendly, but requires explicit type annotations
python -m pip install 'types-aiobotocore-lite[essential]'
# do not forget to install mypy or pyright
Ready to go! Enjoy code completion and type checking in your aiobotocore
project.
aioboto3
Check types-aioboto3 project for installation and usage instructions.
Or just install types-aioboto3
with pip
:
python -m pip install 'types-aioboto3[essential]'
# Lite version does not provide session.client/resource overloads
# it is more RAM-friendly, but requires explicit type annotations
python -m pip install 'types-aioboto3-lite[essential]'
# do not forget to install mypy or pyright
Whoa! All aioboto3
methods and attributes are now type annotated and even code completion works.
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.11+, 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
- black developers for an awesome formatting tool
- Timothy Edmund Crosley for isort and how flexible it is
- mypy developers for doing all dirty work for us
- pyright team for the new era of typed Python
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
Built Distribution
Hashes for mypy_boto3_builder-7.14.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13a41118d688e516772d59a7f9c00efb93420dfdb7fc1442f0d2eaf92d4742f3 |
|
MD5 | ef99acdf3641c1c84afc0cab703c6329 |
|
BLAKE2b-256 | 0836cb10ed080374919c2b8adb743c6a81a6652e6745fc99b86b22f7fac46958 |
Hashes for mypy_boto3_builder-7.14.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e87b03ac212cb16c9ddb7a85f559cc92c536f527c9a5742b70350793c5db668 |
|
MD5 | ffaf77ff048d108f1836959498cc39a8 |
|
BLAKE2b-256 | e2ef5198b46ce099b3dfb4fd6c21f046f46b531aad4e46d10143df24650b1be0 |