Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

bearboto3

GitHub Workflow Status GitHub Workflow Status PyPI - Downloads PyPI - Python Version

This project provides support for using the boto3 library (AWS Python SDK) and associated stub libraries such as boto3-stubs together with beartype for runtime type-checking.

Since boto3 uses a data-driven factory model to create class types at runtime, you cannot annotate them without support of stub libraries such as boto3-stubs. However, if you are using a runtime type-checker such as beartype, type validation will fail since the types technically do not match (even though they represent the same object schema).

Behold...

this project makes use of the typing.TYPE_CHECKING constant found in the python typing module to conditionally load either static types from a stub library (in this case boto3-stubs), or custom annotated types that can be checked with beartype.

Installation/Use

See the list of services to see what is currently implemented.

Supported python versions:

  • >= 3.7

Install with pip:

pip3 install bearboto3

or with whatever dependency management tool you use (like poetry):

poetry add bearboto3

Then in your code, import the specific types you need:

from beartype import beartype
from bearboto3.s3 import S3Client, Bucket
import boto3

@beartype
def example(s3: S3Client) -> Bucket:
    return s3.create_bucket(Bucket='mybucket')

s3_client = boto3.client('s3')
bucket = example(s3_client)

You will be able to have your salmon and eat it too!

Installing the type stubs

At present, there does not appear to be a way in pyproject.toml to specify extra/optional packages that should be installed as dev dependencies. The type stubs for each service (which allow for IDE integration courtsey of boto3-stubs) can be installed as extras such as:

poetry install bearboto3[s3]

but NOTE this will install the type stubs as runtime dependencies given the limitations above. The type stub libraries are not needed to run any code you use this package with, so the recommended approach is to install whatever type stubs you need yourself in your project's dev-dependencies section.

Future work includes being able to isolate installing bearboto3 runtime type definitions per service, like you are able to specify with moto and boto3-stubs.

Versioning

For the most part this project will try to adhere to semantic versioning. The first 1.0.0 release will come when type checking for all of the AWS services have been finished. 0.x.0 releases will contain type checking for new services, and 0.x.x releases will contain any fixes on the existing implemented services.

If the community disagrees with this approach and would like to propose an alternative, please feel free to start a discussion or open an issue.

Contributing

See contributing

Acknowledgements

  • @leycec For being an avid supporter and welcoming me to the beartype family

Metadata

Release files for bearboto3 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bearboto3 0.1.3
File Size Uploaded Provenance Actions
bearboto3-0.1.3.tar.gz 13.9 kB Without provenance Details for bearboto3-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bearboto3 0.1.3
File Interpreter ABI Platform Actions
bearboto3-0.1.3-py3-none-any.whl Python 3 none any Details for bearboto3-0.1.3-py3-none-any.whl

Total release size: 27.7 kB

Release files / bearboto3-0.1.3.tar.gz

Download URL bearboto3-0.1.3.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c2c970f455151baf99732b4722e7dc9f046249db670126e60f0c63283b6781a4
BLAKE2b-256 checksum
How to use checksums
99270bb2c659221b50ac5ce7a53093dd1cf38bab802ef9682e7b05dd489da114
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.2 Linux/5.13.0-1023-azure

Release files / bearboto3-0.1.3-py3-none-any.whl

Download URL bearboto3-0.1.3-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7bc218e6d59bc8d5496dba8d0655c407e873ba68e05d025d6039464fedb8ac6
BLAKE2b-256 checksum
How to use checksums
c1699885b854bed1464a01646ba9fb2c723a4d795806849899ca71cfd7e1d7f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.2 Linux/5.13.0-1023-azure

Security for bearboto3 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page