{"id":617,"library":"botocore-stubs","title":"Botocore Stubs","description":"Botocore Stubs provides comprehensive type annotations and code completion for the `botocore` library, the low-level interface to Amazon Web Services. This package, part of the `mypy_boto3_builder` project, is designed to enhance static type analysis with tools like MyPy and Pyright, and improve IDE auto-completion for `botocore`'s dynamically generated classes. It is actively maintained with versions aligned to corresponding `botocore` releases, with the current version being 1.42.41.","status":"active","version":"1.42.41","language":"python","source_language":"en","source_url":"https://github.com/youtype/botocore-stubs","tags":["type-hinting","stubs","botocore","aws","mypy","pyright","typing"],"install":[{"cmd":"pip install botocore-stubs","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Provides the runtime implementation that botocore-stubs annotates. The stub package is useless without botocore itself.","package":"botocore","optional":false},{"reason":"Required for type annotations related to the AWS Common Runtime (awscrt) components used by botocore.","package":"types-awscrt","optional":true}],"imports":[{"wrong":"from botocore_stubs.client import S3Client","symbol":"S3Client","correct":"from botocore_stubs.client import S3Client"}],"quickstart":{"code":"import os\nfrom botocore.session import Session\nfrom botocore.client import S3Client # For type hinting the client\n\ndef get_s3_client() -> S3Client:\n    \"\"\"\n    Returns a typed S3 client from botocore. \n    botocore-stubs provides the type hints for S3Client.\n    \"\"\"\n    # Ensure AWS credentials are set up, e.g., via environment variables\n    # AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION\n    session = Session()\n    # The return type of session.create_client('s3') is dynamically generated.\n    # The type checker uses botocore-stubs to infer it as S3Client.\n    return session.create_client('s3', region_name=os.environ.get('AWS_REGION', 'us-east-1'))\n\nif __name__ == \"__main__\":\n    s3_client = get_s3_client()\n    try:\n        # This call will have type hints thanks to botocore-stubs\n        response = s3_client.list_buckets()\n        print(\"Successfully listed S3 buckets:\")\n        for bucket in response.get('Buckets', []):\n            print(f\"- {bucket['Name']}\")\n    except Exception as e:\n        print(f\"Error listing S3 buckets: {e}\")\n        print(\"Ensure you have AWS credentials configured (e.g., AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION environment variables).\")\n","lang":"python","description":"This quickstart demonstrates how to initialize a botocore session and create an S3 client. With `botocore-stubs` installed, type checkers like MyPy or Pyright will provide full code completion and static analysis for the `s3_client` object and its methods, such as `list_buckets()`."},"warnings":[{"fix":"If using `boto3`, install `boto3-stubs` (e.g., `pip install boto3-stubs[essential]`) in addition to or instead of `botocore-stubs`.","message":"botocore-stubs only provides type hints for the low-level `botocore` library, not for the higher-level `boto3` library. Boto3 includes additional abstractions (e.g., `resource` objects, specific helper methods like `upload_file`) that `botocore-stubs` will not type. For `boto3` specific typing, consider `boto3-stubs` (part of the same `mypy_boto3_builder` project).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Integrate a type checker like MyPy (`pip install mypy`) or Pyright (`npm install -g pyright`) into your development workflow. Configure your IDE (e.g., VSCode with Pylance, PyCharm) to use these tools.","message":"Type stubs are only effective when used with a compatible static type checker (e.g., MyPy, Pyright) or an IDE with strong type-hinting support. Installing `botocore-stubs` alone will not provide runtime changes or visual hints without these tools.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `botocore-stubs` is updated alongside `botocore`. Use `pip install --upgrade botocore-stubs botocore` to keep them synchronized, or specify exact versions in your `requirements.txt`.","message":"The version of `botocore-stubs` should ideally align with the version of your installed `botocore` library. Mismatched versions may lead to incomplete or incorrect type hints, especially for new features or deprecated APIs in `botocore`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update your code to use the non-deprecated `botocore` APIs. Consult the `botocore` documentation and `botocore-stubs` changelog for details on specific removed stubs.","message":"Version 1.29.0 removed deprecated stubs for client and endpoint_provider modules. If you were relying on type hints for previously deprecated interfaces within these modules, your type checking might now fail or report missing attributes.","severity":"breaking","affected_versions":"1.29.0 and later"},{"fix":"Review any direct type references to `botocore.endpoint_provider.RuleSetStandardLibrary` or related components and adjust to the corrected naming, if applicable. Direct interaction with these internal components is generally discouraged.","message":"Version 1.29.26 included a fix for `RuleSetStandardLibrary` naming within the `endpoint_provider` module. If your code directly referenced this internal naming for type hints before this fix, it might now cause type checker errors due to the correction.","severity":"breaking","affected_versions":"1.29.26 and later"},{"fix":"Install `botocore` using pip (e.g., `pip install botocore`). Ensure it's listed in your project's dependencies (e.g., `requirements.txt`).","message":"The `botocore` library itself is not installed. This module is a core dependency and must be present for any `botocore` (or `boto3`) related code to run.","severity":"breaking","affected_versions":"All versions"},{"fix":"Ensure `botocore` is installed in your environment (e.g., `pip install botocore`). If you are using `boto3`, `botocore` is typically installed as a dependency, but direct usage requires explicit installation.","message":"The `botocore` library must be installed for your application to run. `botocore-stubs` provides only type hints, not the runtime library itself.","severity":"breaking","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'1.42.41':75 'activ':61 'align':65 'amazon':22 'analysi':40 'annot':8 'auto':51 'auto-complet':50 'aw':81 'boto3':31 'botocor':1,3,14,54,68,80 'builder':32 'class':58 'code':10 'complet':11,52 'comprehens':6 'correspond':67 'current':72 'design':35 'dynam':56 'enhanc':37 'generat':57 'hint':78 'ide':49 'improv':48 'interfac':20 'level':19 'librari':15 'like':43 'low':18 'low-level':17 'maintain':62 'mypi':30,44,82 'packag':26 'part':27 'project':33 'provid':5 'pyright':46,83 'releas':69 'servic':24 'static':38 'stub':2,4,79 'tool':42 'type':7,39,77,84 'type-hint':76 'version':64,73 'web':23","created_at":"2026-03-28T17:07:26.054327+00:00","updated_at":"2026-04-16T00:44:18.464158+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nModuleNotFoundError: No module named 'botocore_stubs'"},"ecosystem":"pypi","meta_description":null,"install_score":0,"quickstart_score":0,"quickstart_tag":"stale","pypi_latest":"1.43.14","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/youtype/botocore-stubs","docs":"https://youtype.github.io/mypy_boto3_builder/","changelog":"https://github.com/youtype/botocore-stubs/releases","pypi":"https://pypi.org/project/botocore-stubs/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["type-stubs","aws"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":"stale"}}