Builder for boto3-stubs
Project description
mypy_boto3_builder
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 boto3-stubs
Check boto3-stubs project for installation and usage instructions.
In short, just install boto3-stubs
:
python -m pip install 'boto3-stubs[all]'
# do not forget to install mypy or pyright
And you should already have auto-complete 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/vemel/mypy_boto3_builder/mypy_boto3_builder_stable:latest
docker tag docker.pkg.github.com/vemel/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
# generate stubs for s3 service
docker run -v `pwd`/output:/output -ti mypy_boto3_builder -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
- Install packages from
output
directory as described above
Development
- Use Python 3.9+
- 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
Moving to Python 3.10
This project will be moved to py310
as soon as possible. You might need poetry
pre-release to make it work pip install poetry==1.2.0a2
.
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
- Allie Fitter for boto3-type-annotations, this package is based on top of his work
- 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
- jbpratt, Chris Hollinworth, Yoan Blanc, Kostya Leschenko, pyto86, Ashton Honnecke, and Mike Carey for their contributions
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-5.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 220806180770961f4f1f484d15ee563678f0fbb4e20bf6373739c2ca5e838adc |
|
MD5 | 5181893bf4e568266cec7003b270e785 |
|
BLAKE2b-256 | 94a595c2e7c99f99115f9b1be3b25bd1e30f8f54c4424f558d38fe5387dbe3e2 |