{"id":3139,"library":"mypy-boto3-sdb","title":"mypy-boto3-sdb: Type Stubs for boto3 SimpleDB","description":"mypy-boto3-sdb provides type annotations (stubs) for the boto3 SimpleDB service. It helps developers write type-checked Python code when interacting with AWS SimpleDB using boto3, improving code quality and catching errors pre-runtime. The current version is 1.42.3, and it is updated frequently in sync with boto3 releases and the broader mypy-boto3-builder project.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["boto3","mypy","type-stubs","aws","simpledb","typing"],"install":[{"cmd":"pip install mypy-boto3-sdb boto3","lang":"bash","label":"Install package and boto3"}],"dependencies":[{"reason":"Provides the runtime functionality for interacting with AWS services; this package only provides type stubs.","package":"boto3","optional":false},{"reason":"The static type checker that utilizes these stubs.","package":"mypy","optional":false},{"reason":"May be required for full functionality on Python versions older than 3.9.","package":"typing-extensions","optional":true}],"imports":[{"symbol":"SimpleDBClient","correct":"from mypy_boto3_sdb.client import SimpleDBClient"},{"note":"Type definitions for service request/response objects are found in `type_defs`, not `service_resource` or `client`.","wrong":"from mypy_boto3_sdb.service_resource import AttributeTypeDef","symbol":"AttributeTypeDef","correct":"from mypy_boto3_sdb.type_defs import AttributeTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_sdb.client import SimpleDBClient\nfrom mypy_boto3_sdb.type_defs import SelectRequestRequestTypeDef, AttributeTypeDef\n\n\ndef list_sdb_items(domain_name: str, select_expression: str) -> list[dict[str, str]] | None:\n    \"\"\"Fetches items from SimpleDB using type-hinted boto3 client.\"\"\"\n    # A boto3 client is used at runtime, type-hinted by mypy-boto3-sdb\n    sdb_client: SimpleDBClient = boto3.client(\"sdb\")\n\n    try:\n        request: SelectRequestRequestTypeDef = {\n            \"SelectExpression\": select_expression,\n            \"ConsistentRead\": True,\n        }\n        response = sdb_client.select(**request)\n\n        items_data = []\n        if \"Items\" in response and response[\"Items\"]:\n            for item in response[\"Items\"]:\n                item_dict = {\"Name\": item[\"Name\"]}\n                if \"Attributes\" in item and item[\"Attributes\"]:\n                    for attr in item[\"Attributes\"]:\n                        item_dict[attr[\"Name\"]] = attr[\"Value\"]\n                items_data.append(item_dict)\n        return items_data\n    except Exception as e:\n        print(f\"Error fetching items: {e}\")\n        return None\n\n# Example usage (ensure 'boto3' is configured with AWS credentials)\n# results = list_sdb_items(\"my-domain\", \"select * from `my-domain`\")\n# if results:\n#     for item in results:\n#         print(item)\n","lang":"python","description":"This quickstart demonstrates how to use `mypy-boto3-sdb` to add type hints to a `boto3` SimpleDB client. It shows importing `SimpleDBClient` for the client type and `SelectRequestRequestTypeDef` for request parameters, ensuring type safety for `boto3` calls. Remember that `boto3` must be installed and configured separately for runtime execution."},"warnings":[{"fix":"Upgrade to Python 3.9 or newer, or pin `mypy-boto3-sdb` to a version compatible with Python 3.8 (e.g., `<8.12.0`).","message":"Support for Python 3.8 was officially removed in `mypy-boto3-builder` version 8.12.0 (and consequently `mypy-boto3-sdb` versions built with it). Projects requiring Python 3.8 should use older versions of `mypy-boto3-sdb`.","severity":"breaking","affected_versions":">=8.12.0"},{"fix":"Review and update all references to `TypeDef` imports and names in your type hints to conform to the new naming scheme. Most commonly, redundant 'Request' or 'Response' suffixes might have been shortened.","message":"Version 8.9.0 of `mypy-boto3-builder` introduced significant breaking changes to `TypeDef` naming conventions (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`). This can break existing type hints in your codebase.","severity":"breaking","affected_versions":">=8.9.0"},{"fix":"Ensure `boto3` is included in your project's dependencies and installed alongside `mypy-boto3-sdb` (e.g., `pip install boto3 mypy-boto3-sdb`).","message":"This package (`mypy-boto3-sdb`) provides *only* type stubs. It does not include the runtime `boto3` library. `boto3` must be installed separately for your code to function at runtime.","severity":"gotcha","affected_versions":"*"},{"fix":"Ensure `mypy` is up-to-date. If encountering issues, verify `mypy` is correctly configured to find installed stub packages, and consider clearing `mypy` cache or checking `mypy`'s discovery paths.","message":"From `mypy-boto3-builder` version 8.12.0, packages migrated to PEP 561 compliance. While this generally improves type checker discovery, older or custom `mypy` configurations might need adjustment (e.g., `mypy_path`) to correctly locate the stubs.","severity":"gotcha","affected_versions":">=8.12.0"},{"fix":"Always create AWS clients using `boto3.client('service_name')` and then apply the type hint from `mypy-boto3-sdb`, e.g., `client: SimpleDBClient = boto3.client('sdb')`.","message":"Do not attempt to instantiate client classes (e.g., `SimpleDBClient`) directly from `mypy_boto3_sdb`. These are only type definitions. The actual runtime client must be created using `boto3.client('sdb')`.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}