{"id":5532,"library":"types-boto","title":"Type Stubs for Boto (AWS SDK v2)","description":"types-boto provides static type annotations for the `boto` library (version 2.x), enabling type checkers like MyPy to validate `boto` code. It is part of the community-driven `typeshed` project and is updated regularly to match `boto`'s API, though `boto` itself is an older AWS SDK. The current version is 2.49.18.20241019, with its release cadence following `typeshed`'s updates.","status":"active","version":"2.49.18.20241019","language":"python","source_language":"en","source_url":"https://github.com/python/typeshed","tags":["typing","stubs","boto","aws","type-hints"],"install":[{"cmd":"pip install types-boto","lang":"bash","label":"Install types-boto"}],"dependencies":[{"reason":"Runtime library for which types-boto provides stubs. The stubs themselves don't have a hard runtime dependency, but are useless without boto installed.","package":"boto","optional":false}],"imports":[{"wrong":"from boto-stubs.s3.connection import S3Connection","symbol":"S3Connection","correct":"from boto-stubs.s3.connection import S3Connection"}],"quickstart":{"code":"import os\nimport boto.s3.connection\nimport boto.ec2.connection\n\n# types-boto provides type hints for these objects,\n# allowing type checkers like MyPy to validate your code.\n\n# Credentials should ideally come from environment variables or a secure configuration.\n# For a runnable example, we use os.environ.get with placeholders.\naws_access_key = os.environ.get('AWS_ACCESS_KEY_ID', 'YOUR_ACCESS_KEY_GOES_HERE')\naws_secret_key = os.environ.get('AWS_SECRET_ACCESS_KEY', 'YOUR_SECRET_KEY_GOES_HERE')\n\ntry:\n    # Example: S3 connection with type hint from types-boto\n    s3_conn: boto.s3.connection.S3Connection = boto.s3.connection.S3Connection(\n        aws_access_key_id=aws_access_key,\n        aws_secret_access_key=aws_secret_key\n    )\n    print(f\"S3 connection created (type checked by types-boto): {s3_conn}\")\n\n    # Example: EC2 connection with type hint from types-boto\n    ec2_conn: boto.ec2.connection.EC2Connection = boto.ec2.connection.EC2Connection(\n        aws_access_key_id=aws_access_key,\n        aws_secret_access_key=aws_secret_key\n    )\n    print(f\"EC2 connection created (type checked by types-boto): {ec2_conn}\")\n\n    # In a real application, you would perform operations here, e.g.:\n    # buckets = s3_conn.get_all_buckets()\n    # print(f\"Found {len(buckets)} S3 buckets.\")\n\nexcept Exception as e:\n    print(f\"Failed to create boto connections. Ensure 'boto' is installed and credentials are set: {e}\")\n    print(\"Note: types-boto only provides type hints, it does not enable runtime functionality.\")","lang":"python","description":"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."},"warnings":[{"fix":"For `boto3` projects, use `pip install types-boto3`.","message":"`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.","severity":"gotcha","affected_versions":"All versions of `types-boto`"},{"fix":"Integrate a type checker (e.g., `mypy`) into your development workflow and configure it to check your project.","message":"This 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.","severity":"gotcha","affected_versions":"All versions of `types-boto`"},{"fix":"For new development, consider migrating to `boto3` and using `types-boto3`. For existing projects, be aware that `boto` receives minimal updates.","message":"The `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`.","severity":"deprecated","affected_versions":"All versions of `types-boto` (reflects status of underlying `boto` library)"}],"env_vars":null,"search_vec":"'2':20 '2.49.18.20241019':62 'annot':14 'api':49 'aw':5,56,74 'boto':4,10,17,29,47,51,73 'cadenc':66 'checker':24 'code':30 'communiti':37 'community-driven':36 'current':59 'driven':38 'enabl':22 'follow':67 'hint':77 'librari':18 'like':25 'match':46 'mypi':26 'older':55 'part':33 'project':40 'provid':11 'regular':44 'releas':65 'sdk':6,57 'static':12 'stub':2,72 'though':50 'type':1,9,13,23,71,76 'type-hint':75 'types-boto':8 'typesh':39,68 'updat':43,70 'v2':7 'valid':28 'version':19,60 'x':21","created_at":"2026-04-14T01:37:54.163622+00:00","updated_at":"2026-04-16T23:30:40.736533+00:00","problems":{"verify_error":"File \"<string>\", line 1\n    from boto-stubs.s3.connection import S3Connection\n             ^\nSyntaxError: invalid syntax"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.49.18.20241019","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/typeshed-internal/stub_uploader","docs":null,"changelog":"https://github.com/typeshed-internal/stub_uploader/blob/main/data/changelogs/boto.md","pypi":"https://pypi.org/project/types-boto/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["type-stubs","aws"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-08-30","next_check":"2026-07-10","install_tag":null}}