Install & Compatibility
Where this runs
tested against v2.49.18.20241019 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
S3Connection
✓ from boto-stubs.s3.connection import S3Connection
✗ from boto-stubs.s3.connection import S3Connection
This quickstart demonstrates importing and instantiating `boto` (v2) connections. `types-boto` provides the type hints for `boto.s3.connection.S3Connection` and `boto.ec2.connection.EC2Connection`, enabling static type checkers to validate your code. Remember to replace placeholder credentials with actual ones or environment variables.
import os
import boto.s3.connection
import boto.ec2.connection
# types-boto provides type hints for these objects,
# allowing type checkers like MyPy to validate your code.
# Credentials should ideally come from environment variables or a secure configuration.
# For a runnable example, we use os.environ.get with placeholders.
aws_access_key = os.environ.get('AWS_ACCESS_KEY_ID', 'YOUR_ACCESS_KEY_GOES_HERE')
aws_secret_key = os.environ.get('AWS_SECRET_ACCESS_KEY', 'YOUR_SECRET_KEY_GOES_HERE')
try:
# Example: S3 connection with type hint from types-boto
s3_conn: boto.s3.connection.S3Connection = boto.s3.connection.S3Connection(
aws_access_key_id=aws_access_key,
aws_secret_access_key=aws_secret_key
)
print(f"S3 connection created (type checked by types-boto): {s3_conn}")
# Example: EC2 connection with type hint from types-boto
ec2_conn: boto.ec2.connection.EC2Connection = boto.ec2.connection.EC2Connection(
aws_access_key_id=aws_access_key,
aws_secret_access_key=aws_secret_key
)
print(f"EC2 connection created (type checked by types-boto): {ec2_conn}")
# In a real application, you would perform operations here, e.g.:
# buckets = s3_conn.get_all_buckets()
# print(f"Found {len(buckets)} S3 buckets.")
except Exception as e:
print(f"Failed to create boto connections. Ensure 'boto' is installed and credentials are set: {e}")
print("Note: types-boto only provides type hints, it does not enable runtime functionality.")
Debug
Known issues
gotcha`types-boto` provides stubs for the older `boto` library (version 2.x). If you are using the modern AWS SDK for Python (`boto3`), you should install `types-boto3` instead.fixFor `boto3` projects, use `pip install types-boto3`.
affects: All versions of `types-boto`
gotchaThis library provides static type hints only. It does not add any runtime functionality or change how `boto` behaves at execution. A type checker like MyPy or pyright is required to utilize these stubs for code validation.fixIntegrate a type checker (e.g., `mypy`) into your development workflow and configure it to check your project.
affects: All versions of `types-boto`
deprecatedThe `boto` library itself (version 2.x), for which `types-boto` provides stubs, is considered legacy. AWS recommends `boto3` for new development. While `types-boto` helps maintain older `boto` code, new projects should generally use `boto3`.fixFor new development, consider migrating to `boto3` and using `types-boto3`. For existing projects, be aware that `boto` receives minimal updates.
affects: All versions of `types-boto` (reflects status of underlying `boto` library)
Upgrade
Version history
2.49.18.20241019latest on PyPI · released Oct 19, 2024
Audit
Dependencies
botorequiredRuntime library for which types-boto provides stubs. The stubs themselves don't have a hard runtime dependency, but are useless without boto installed.