{"id":3008,"library":"mypy-boto3-amp","title":"Type Annotations for Boto3 PrometheusService (AMP)","description":"mypy-boto3-amp provides PEP 561 compatible type annotations for `boto3`'s PrometheusService (Amazon Managed Service for Prometheus, AMP) client. It enhances developer experience by enabling static type checking and autocompletion for `boto3` code with tools like mypy, pyright, VSCode, and PyCharm. The library is actively maintained, with frequent updates in sync with `boto3` versions, and is currently at version 1.42.3, generated with mypy-boto3-builder 8.12.0.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["typing","boto3","aws","mypy","type-hints","amp","prometheus"],"install":[{"cmd":"pip install mypy-boto3-amp boto3 mypy","lang":"bash","label":"Install service stubs, boto3, and mypy"},{"cmd":"pip install 'boto3-stubs[amp]' boto3 mypy","lang":"bash","label":"Alternative: Install with boto3-stubs extras"}],"dependencies":[{"reason":"This package provides type stubs for the `boto3` library; `boto3` itself must be installed for runtime execution.","package":"boto3","optional":false},{"reason":"A static type checker that utilizes these type annotations. Other type checkers like `pyright` can also be used.","package":"mypy","optional":true}],"imports":[{"symbol":"PrometheusServiceClient","correct":"from mypy_boto3_amp import PrometheusServiceClient"},{"note":"For type-hinting paginator objects.","symbol":"ListWorkspacesPaginator","correct":"from mypy_boto3_amp.paginator import ListWorkspacesPaginator"},{"note":"For explicit type annotations of method arguments and return values.","symbol":"CreateWorkspaceRequestRequestTypeDef","correct":"from mypy_boto3_amp.type_defs import CreateWorkspaceRequestRequestTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_amp import PrometheusServiceClient\nfrom mypy_boto3_amp.type_defs import CreateWorkspaceRequestRequestTypeDef\nimport os\n\n# Boto3 client without type annotations\n# untyped_client = boto3.client(\"amp\")\n# response = untyped_client.list_workspaces()\n\n# Boto3 client with type annotations\nclient: PrometheusServiceClient = boto3.client(\"amp\")\n\n# Example usage with type-hinted client\nprint(\"Listing AMP workspaces...\")\ntry:\n    # Using a method that typically exists for AMP clients\n    response = client.list_workspaces()\n    print(f\"Found {len(response.get('workspaces', []))} workspaces.\")\n    # Example of creating a workspace with typed dictionary (requires a unique name)\n    # create_params: CreateWorkspaceRequestRequestTypeDef = {\n    #     \"alias\": f\"my-typed-workspace-{os.environ.get('UNIQUE_ID', 'test')}\"\n    # }\n    # create_response = client.create_workspace(**create_params)\n    # print(f\"Created workspace with ID: {create_response['workspaceId']}\")\nexcept client.exceptions.ResourceNotFoundException:\n    print(\"No AMP workspaces found or permissions issue.\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n\n# Run mypy to check types:\n# mypy your_script_name.py","lang":"python","description":"This quickstart demonstrates how to initialize a `boto3` client for Amazon Managed Service for Prometheus (AMP) with `mypy-boto3-amp` type annotations. It shows how to import and apply the `PrometheusServiceClient` type to get full type checking and autocompletion for client methods and their arguments/return values. Remember to have `boto3` and `mypy` installed in your environment."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Starting with `mypy-boto3-builder` version 8.12.0 (which generates these stubs), Python 3.8 is no longer supported. Projects using Python 3.8 must upgrade to Python 3.9 or newer to use the latest `mypy-boto3` stubs. The packages also migrated to PEP 561 compliance.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0 (affecting mypy-boto3-amp >= 1.42.0)"},{"fix":"Review and update `TypeDef` import paths and names in your codebase according to the new conventions.","message":"Version 8.9.0 of `mypy-boto3-builder` introduced breaking changes to `TypeDef` naming conventions. `TypeDefs` for packed method arguments now use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`), and conflicting `Extra` postfixes are moved to the end. This may require updating explicit type annotations in existing code.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.9.0 (affecting mypy-boto3-amp >= 1.35.0 or similar)"},{"fix":"Consider `pip install boto3-stubs-lite[amp]` or configure PyCharm to use external type checkers like `mypy` or `pyright`.","message":"PyCharm users might experience slow performance and high CPU usage, especially with `Literal` overloads, due to a known PyCharm issue (PY-40997). It is recommended to either use `boto3-stubs-lite` (if explicit type annotations are acceptable) or to disable PyCharm's built-in type checker and rely on `mypy` or `pyright` for type checking.","severity":"gotcha","affected_versions":"All versions, specific to PyCharm IDE."},{"fix":"Ensure both `boto3` and `mypy-boto3-amp` are installed: `pip install boto3 mypy-boto3-amp`.","message":"While `mypy-boto3-amp` provides type annotations for `boto3`'s AMP client, `boto3` itself is a separate runtime dependency and must be installed in your environment. These packages are type stubs, not the actual AWS SDK.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consult `boto3-stubs` documentation for the correct and up-to-date service module names.","message":"The `mypy-boto3` ecosystem has seen service name changes, such as `sms-voice` being deprecated in favor of `pinpoint-sms-voice` in `mypy-boto3-builder` 8.11.0. While not directly affecting AMP, this highlights that AWS service names can change, leading to deprecations in stub packages. Always verify service names against current AWS documentation.","severity":"deprecated","affected_versions":"mypy-boto3-builder >= 8.11.0 (general warning for related packages)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}