{"id":3073,"library":"mypy-boto3-discovery","title":"mypy-boto3-discovery Type Annotations","description":"This package provides type annotations for the AWS boto3 client for the ApplicationDiscoveryService service. It ensures static type checking with tools like MyPy, catching potential errors before runtime. As of version 1.42.3, it is actively maintained and released in sync with `botocore` updates, typically multiple times a month.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type-hints","stubs","application-discovery-service","discovery"],"install":[{"cmd":"pip install mypy-boto3-discovery","lang":"bash","label":"Install only stubs for ApplicationDiscoveryService"},{"cmd":"pip install 'boto3-stubs[discovery]'","lang":"bash","label":"Install all boto3 stubs including ApplicationDiscoveryService (recommended)"}],"dependencies":[{"reason":"Required at runtime to use the AWS SDK. This package only provides type stubs.","package":"boto3","optional":false}],"imports":[{"symbol":"ApplicationDiscoveryServiceClient","correct":"from mypy_boto3_discovery.client import ApplicationDiscoveryServiceClient"},{"symbol":"DescribeAgentsResponseTypeDef","correct":"from mypy_boto3_discovery.type_defs import DescribeAgentsResponseTypeDef"},{"symbol":"AgentInfoTypeDef","correct":"from mypy_boto3_discovery.type_defs import AgentInfoTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_discovery.client import ApplicationDiscoveryServiceClient\nfrom mypy_boto3_discovery.type_defs import DescribeAgentsResponseTypeDef, AgentInfoTypeDef\nimport os\n\ndef list_discovery_agents() -> None:\n    # Using type hints for the boto3 client\n    client: ApplicationDiscoveryServiceClient = boto3.client(\n        \"discovery\",\n        region_name=os.environ.get('AWS_REGION', 'us-east-1')\n    )\n\n    try:\n        # The response object is type-hinted\n        response: DescribeAgentsResponseTypeDef = client.describe_agents()\n        agents: list[AgentInfoTypeDef] = response.get(\"agents\", [])\n\n        if agents:\n            print(\"Discovery Agents:\")\n            for agent in agents:\n                print(f\"  Agent ID: {agent.get('agentId')}\")\n                print(f\"    Agent Status: {agent.get('agentStatus')}\")\n                print(f\"    Host Name: {agent.get('hostName')}\")\n                print(f\"    Version: {agent.get('version')}\")\n                print(f\"    IP Address: {agent.get('agentIp')}\")\n        else:\n            print(\"No discovery agents found.\")\n\n    except Exception as e:\n        print(f\"Error describing agents: {e}\")\n\nif __name__ == \"__main__\":\n    # Ensure AWS credentials are configured (e.g., via environment variables or ~/.aws/credentials)\n    # and that the IAM user/role has permissions for 'discovery:DescribeAgents'.\n    list_discovery_agents()","lang":"python","description":"This example demonstrates how to initialize a type-hinted `ApplicationDiscoveryServiceClient` and call `describe_agents`. It uses `os.environ.get` for region to make it runnable without hardcoding. Remember to configure AWS credentials and ensure the necessary IAM permissions are granted."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or later. Consider using a virtual environment manager like `pyenv` or `conda`.","message":"Starting with version 8.12.0, support for Python 3.8 has been removed. Projects using this library must upgrade to Python 3.9 or newer.","severity":"breaking","affected_versions":">=8.12.0"},{"fix":"Ensure your `mypy` configuration correctly points to installed packages. If experiencing issues, verify the `py.typed` marker file exists in the installed package. Re-evaluate any custom stub file paths or `mypy` plugins.","message":"Version 8.12.0 migrated all `mypy-boto3-*` packages to PEP 561-compliant distribution. While `pip install` generally works, advanced `mypy` configurations or custom build systems that directly manipulate stub files might require adjustments.","severity":"breaking","affected_versions":">=8.12.0"},{"fix":"Always install `boto3` (e.g., `pip install boto3`) alongside `mypy-boto3-discovery` or `boto3-stubs`.","message":"This package provides only type stubs. You must install the `boto3` library separately for your application to function at runtime. Type checkers will use these stubs, but `boto3` is the actual dependency for AWS SDK functionality.","severity":"gotcha","affected_versions":"All"},{"fix":"Regularly update both `boto3` and your `mypy-boto3-discovery` (or `boto3-stubs`) packages. Consider pinning versions in your `requirements.txt` to ensure compatibility across your development team and CI/CD.","message":"For the most accurate type checking, it is crucial to keep your `boto3` library version and your `mypy-boto3-*` stub versions in sync. Significant version discrepancies can lead to incorrect type hints or missing attributes as AWS services evolve.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}