Giter VIP home page Giter VIP logo

mbalatsko / mypy_boto3_builder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from youtype/mypy_boto3_builder

0.0 0.0 0.0 6.7 MB

Type annotations builder for boto3 compatible with VSCode, PyCharm, Emacs, Sublime Text, pyright and mypy.

Home Page: https://youtype.github.io/mypy_boto3_builder/

License: MIT License

Shell 0.54% JavaScript 0.06% Python 77.13% HTML 0.04% Dockerfile 0.10% Jinja 22.13%

mypy_boto3_builder's Introduction

Boto3 type annotations generator

PyPI - mypy-boto3-builder PyPI - Python Version Docs

PyPI - boto3-stubs PyPI - boto3 Docs PyPI - Downloads

PyPI - types-aiobotocore PyPI - aiobotocore Docs PyPI - Downloads

PyPI - types-aioboto3 PyPI - aioboto3 Docs PyPI - Downloads

boto3.typed

Type annotations builder for boto3-stubs, types-aiobotocore, and types-aioboto3 projects. 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 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

Contributors

mypy_boto3_builder's People

Contributors

vemel avatar ombratteng avatar dependabot[bot] avatar ahonnecke avatar chrishollinworth avatar uberchris avatar jvansan avatar kleschenko avatar mike-carey avatar benesch avatar greut avatar github-actions[bot] avatar jbpratt avatar pyto86pri avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.