{"library":"mypy-boto3-lightsail","title":"mypy-boto3-lightsail Type Stubs for AWS Lightsail","description":"mypy-boto3-lightsail provides type annotations (stubs) for the AWS Lightsail service within the `boto3` library. It enables static type checking with tools like MyPy, enhancing code quality, readability, and error detection for `boto3` interactions before runtime. The library is actively maintained, with frequent releases often synchronized with `boto3` updates, and is currently at version 1.42.84.","language":"python","status":"active","last_verified":"Thu May 14","install":{"commands":["pip install mypy-boto3-lightsail boto3 mypy"],"cli":null},"imports":["from mypy_boto3_lightsail.client import LightsailClient","from mypy_boto3_lightsail.type_defs import CreateDistributionRequestTypeDef"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\nfrom mypy_boto3_lightsail.client import LightsailClient\nfrom mypy_boto3_lightsail.type_defs import GetDistributionsResultTypeDef\nimport os\n\n# Ensure boto3 is installed: pip install boto3 mypy-boto3-lightsail\n\nif TYPE_CHECKING:\n    # This block is only processed by type checkers\n    client: LightsailClient = boto3.client(\"lightsail\")\nelse:\n    # This block runs at runtime\n    client = boto3.client(\"lightsail\")\n\ndef get_lightsail_distributions() -> GetDistributionsResultTypeDef:\n    try:\n        response = client.get_distributions()\n        print(f\"Successfully retrieved {len(response.get('distributions', []))} distributions.\")\n        return response\n    except Exception as e:\n        print(f\"Error retrieving Lightsail distributions: {e}\")\n        raise\n\nif __name__ == \"__main__\":\n    # Make sure your AWS credentials are configured (e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION_NAME env vars)\n    # For a quick local test without actual AWS interaction, you can mock boto3 or ensure credentials are set.\n    # Example of calling the function:\n    # distributions = get_lightsail_distributions()\n    # if distributions:\n    #     for dist in distributions.get('distributions', []):\n    #         print(f\"  Distribution: {dist.get('name')}, Status: {dist.get('status')}\")\n    print(\"Quickstart example set up. Run `mypy <filename>.py` for type checking.\")\n    print(\"To execute, uncomment `get_lightsail_distributions()` call and ensure AWS credentials are set.\")","lang":"python","description":"This quickstart demonstrates how to use `mypy-boto3-lightsail` to add type hints for the Lightsail client and its response types. It includes a `TYPE_CHECKING` guard for runtime compatibility and shows how to retrieve Lightsail distributions with type safety. Remember to have AWS credentials configured for actual execution.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-14","installed_version":"1.43.7","pypi_latest":"1.43.7","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":5.9,"avg_import_s":0.8,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.7,"mem_mb":15.4,"disk_size":"115.4M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.73,"mem_mb":15.3,"disk_size":"110.4M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":6.2,"import_time_s":0.48,"mem_mb":15.4,"disk_size":"114M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.62,"mem_mb":15.3,"disk_size":"109M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":1.07,"mem_mb":17.1,"disk_size":"121.6M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":1.27,"mem_mb":17,"disk_size":"116.5M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":6,"import_time_s":0.91,"mem_mb":17.2,"disk_size":"120M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.96,"mem_mb":17,"disk_size":"116M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.75,"mem_mb":16.1,"disk_size":"113.2M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":1.05,"mem_mb":16,"disk_size":"108.1M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":5.2,"import_time_s":0.77,"mem_mb":16.1,"disk_size":"112M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.9,"mem_mb":16,"disk_size":"107M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.73,"mem_mb":17.4,"disk_size":"113.1M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":1.15,"mem_mb":17.3,"disk_size":"107.9M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":4.9,"import_time_s":0.8,"mem_mb":17.4,"disk_size":"112M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.9,"mem_mb":17.3,"disk_size":"107M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.52,"mem_mb":14.4,"disk_size":"106.9M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.68,"mem_mb":14.4,"disk_size":"106.2M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":7,"import_time_s":0.53,"mem_mb":14.4,"disk_size":"106M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"mypy-boto3-lightsail","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.54,"mem_mb":14.4,"disk_size":"105M"}]}}