Type annotations for boto3.S3 1.14.0 service, generated by mypy-boto3-buider 2.0.4
Project description
mypy-boto3-s3
Type annotations for boto3.S3 1.14.0 service compatible with mypy, VSCode, PyCharm and other tools.
Generated by mypy-boto3-buider 2.0.4.
More information can be found on boto3-stubs page.
How to use
Make sure you have mypy installed and activated in your IDE.
Install boto3-stubs
for S3
service.
python -m pip install boto3-stubs[s3]
Use boto3
with mypy_boto3_s3
in your project and enjoy type checking and auto-complete.
import boto3
from mypy_boto3_s3 import S3Client
# Now mypy can check if your code is valid.
client: S3Client = boto3.client("s3")
# works for session as well
session = boto3.session.Session(region="us-west-1")
session_client: S3Client = session.client("s3")
# Do you prefer resource approach? We've got you covered!
from mypy_boto3_s3 import S3ServiceResource
resource: s3.S3ServiceResource = boto3.resource("s3")
# Waiters are also supported
import mypy_boto3_s3.waiter as s3_waiters
bucket_exists_waiter: s3_waiters.BucketExistsWaiter = client.get_waiter("bucket_exists")
bucket_not_exists_waiter: s3_waiters.BucketNotExistsWaiter = client.get_waiter("bucket_not_exists")
object_exists_waiter: s3_waiters.ObjectExistsWaiter = client.get_waiter("object_exists")
object_not_exists_waiter: s3_waiters.ObjectNotExistsWaiter = client.get_waiter("object_not_exists")
# Annotated paginators are included as well
import mypy_boto3_s3.paginator as s3_paginators
list_multipart_uploads_paginator: s3_paginators.ListMultipartUploadsPaginator = client.get_paginator("list_multipart_uploads")
list_object_versions_paginator: s3_paginators.ListObjectVersionsPaginator = client.get_paginator("list_object_versions")
list_objects_paginator: s3_paginators.ListObjectsPaginator = client.get_paginator("list_objects")
list_objects_v2_paginator: s3_paginators.ListObjectsV2Paginator = client.get_paginator("list_objects_v2")
list_parts_paginator: s3_paginators.ListPartsPaginator = client.get_paginator("list_parts")
Dynamic type annotations
mypy_boto3
command generates boto3.client/resource
type annotations for
mypy_boto3_s3
and other installed services.
# Run this command after you add or remove service packages
python -m mypy_boto3
Generated type annotations provide overloads for boto3.client
and boto3.resource
,
boto3.Session.client
and boto3.Session.resource
functions,
so explicit type annotations are not needed.
mypy
supports function overloads as expectedPyCharm
also supports function overloads, but consumes a lot of RAM, use carefully if you have many services installedVSCode
does not currently support function overloads, use explicit type annotations
import boto3
# Type is discovered correctly by mypy and PyCharm
# VSCode still needs explicit type annotations
client = boto3.client("s3")
resource = boto3.resource("s3")
session_client = boto3.Session().client("s3")
session_resource = boto3.Session().resource("s3")
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_s3-1.14.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d694820e5d291b21d7d7b01357f19ab413651511ca3f2ed47ae9c08eab84b3a6 |
|
MD5 | e85c276c1a2ed2168892812a84d62b20 |
|
BLAKE2b-256 | 209526ba7f36cc9256377b1b5f678c8540449be4eba9b73859a15f18b4a417b1 |