{"id":3695,"library":"mypy-boto3-sagemaker-edge","title":"mypy-boto3-sagemaker-edge Type Annotations","description":"mypy-boto3-sagemaker-edge provides type annotations for the boto3 SagemakerEdgeManager client, enhancing type checking capabilities for tools like MyPy, VSCode, and PyCharm. It is automatically generated by the `mypy-boto3-builder` and released frequently, typically in sync with `boto3` versions, to ensure up-to-date and accurate type hints. The current version is 1.42.3.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","type-hints","mypy","sagemaker-edge","stubs","typings"],"install":[{"cmd":"pip install mypy-boto3-sagemaker-edge boto3","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Provides the actual AWS SDK functionality; mypy-boto3-sagemaker-edge offers only type stubs.","package":"boto3","optional":false},{"reason":"Commonly used static type checker for Python; optional for runtime, but essential for type checking.","package":"mypy","optional":true},{"reason":"Alternative static type checker; optional for runtime, but useful for type checking.","package":"pyright","optional":true}],"imports":[{"note":"Without `mypy-boto3-sagemaker-edge` or `TYPE_CHECKING` guards, `boto3.client` will return a `BaseClient` without service-specific type hints. Explicitly importing `SagemakerEdgeManagerClient` under `TYPE_CHECKING` provides full type fidelity without adding runtime dependency.","wrong":"import boto3\nclient = boto3.client(\"sagemaker-edge\")","symbol":"SagemakerEdgeManagerClient","correct":"from typing import TYPE_CHECKING\nimport boto3\n\nif TYPE_CHECKING:\n    from mypy_boto3_sagemaker_edge.client import SagemakerEdgeManagerClient\n    from mypy_boto3_sagemaker_edge.type_defs import SendHeartbeatRequestRequestTypeDef\n\ndef get_client() -> SagemakerEdgeManagerClient:\n    return boto3.client(\"sagemaker-edge\")"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\nimport os\n\nif TYPE_CHECKING:\n    from mypy_boto3_sagemaker_edge.client import SagemakerEdgeManagerClient\n    from mypy_boto3_sagemaker_edge.type_defs import SendHeartbeatRequestRequestTypeDef\n\n# Configure AWS credentials and region (replace with your actual configuration)\n# For quickstart, using environment variables or placeholder for simplicity\nos.environ['AWS_ACCESS_KEY_ID'] = os.environ.get('AWS_ACCESS_KEY_ID', 'YOUR_ACCESS_KEY')\nos.environ['AWS_SECRET_ACCESS_KEY'] = os.environ.get('AWS_SECRET_ACCESS_KEY', 'YOUR_SECRET_KEY')\nos.environ['AWS_REGION_NAME'] = os.environ.get('AWS_REGION_NAME', 'us-east-1')\n\ndef main():\n    # Initialize the Sagemaker Edge Manager client with type hints\n    client: SagemakerEdgeManagerClient = boto3.client(\"sagemaker-edge\")\n\n    # Example: Prepare a request for sending heartbeat with type definition\n    heartbeat_request: SendHeartbeatRequestRequestTypeDef = {\n        \"AgentMetrics\": [],  # List of AgentMetricTypeDef\n        \"Models\": []        # List of ModelTypeDef\n    }\n\n    try:\n        # Call an operation on the client\n        response = client.send_heartbeat(**heartbeat_request)\n        print(\"Heartbeat sent successfully.\")\n        print(f\"Response Metadata: {response['ResponseMetadata']}\")\n    except client.exceptions.InternalServiceException as e:\n        print(f\"Error sending heartbeat: {e}\")\n    except Exception as e:\n        print(f\"An unexpected error occurred: {e}\")\n\nif __name__ == \"__main__\":\n    main()","lang":"python","description":"This quickstart demonstrates how to initialize a `boto3` SagemakerEdgeManager client with type annotations provided by `mypy-boto3-sagemaker-edge` and perform a basic operation like `send_heartbeat`. The `TYPE_CHECKING` block ensures that the stub types are only used during static analysis, preventing them from becoming a runtime dependency. Replace placeholder AWS credentials and region as needed."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Support for Python 3.8 has been removed in `mypy-boto3-builder` (version 8.12.0) and consequently for all generated `mypy-boto3-*` packages. Users must use Python 3.9 or higher.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0"},{"fix":"Update your static type checker (e.g., `pip install --upgrade mypy`) and verify its configuration. In most cases, installing the stub package with pip is sufficient for modern type checkers.","message":"The `mypy-boto3` ecosystem migrated to PEP 561 compliant packages in `mypy-boto3-builder` 8.12.0. This change affects how type checkers locate stubs. If you experience issues, ensure your type checker (e.g., MyPy, Pyright) is up-to-date and configured correctly to discover installed stub packages.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0"},{"fix":"Ensure `mypy-boto3-sagemaker-edge` and `boto3` are updated to compatible versions. The stub's version typically reflects the `boto3` version it types (e.g., `1.42.3` for `boto3` `1.42.x`).","message":"For optimal type checking, the `mypy-boto3-sagemaker-edge` package version should align closely with your installed `boto3` version. Mismatching versions (e.g., using `mypy-boto3-sagemaker-edge==1.42.x` with `boto3==1.34.x`) can lead to incorrect or missing type hints.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Wrap type-only imports within `from typing import TYPE_CHECKING` and `if TYPE_CHECKING:` blocks, as demonstrated in the `imports` and `quickstart` sections.","message":"To prevent `mypy-boto3-*` packages from becoming runtime dependencies, it is best practice to import the type hints only within an `if TYPE_CHECKING:` block. This avoids shipping type stubs with your production code.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If using the deprecated `sms-voice` service, switch to `pinpoint-sms-voice` and install the corresponding `mypy-boto3-pinpoint-sms-voice` stub.","message":"The `sms-voice` service was removed and is no longer supported starting with `mypy-boto3-builder` 8.11.0. Users of `sms-voice` should migrate to `pinpoint-sms-voice`. While not directly related to `sagemaker-edge`, this highlights potential service deprecations across the `mypy-boto3` ecosystem.","severity":"deprecated","affected_versions":"mypy-boto3-builder >=8.11.0"},{"fix":"For PyCharm: `pip install boto3-stubs-lite[sagemaker-edge]` (if available) or adjust PyCharm's type checking settings.","message":"PyCharm users might experience performance issues due to Literal overloads. For better IDE performance, consider installing `boto3-stubs-lite` (if available for the specific service) or disable PyCharm's built-in type checker and rely on `mypy` or `pyright` instead.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}