{"id":3141,"library":"mypy-boto3-service-quotas","title":"Type annotations for boto3 ServiceQuotas","description":"mypy-boto3-service-quotas provides drop-in type annotations for the boto3 ServiceQuotas client. It enhances static type checking with tools like mypy and pyright, and improves autocompletion in IDEs such as VSCode and PyCharm, by leveraging type definitions extracted from botocore schemas. This package is generated automatically with mypy-boto3-builder and is currently at version 1.42.10, with frequent updates to align with new boto3 releases.","status":"active","version":"1.42.10","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","type-hints","mypy","pyright","servicequotas","stubs"],"install":[{"cmd":"pip install mypy-boto3-service-quotas boto3","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"This package provides type stubs for boto3; boto3 itself must be installed to use the AWS SDK functionality.","package":"boto3","optional":false}],"imports":[{"symbol":"ServiceQuotasClient","correct":"from mypy_boto3_service_quotas.client import ServiceQuotasClient"},{"note":"Type definitions (TypedDicts) are found in the `type_defs` submodule, not directly under `client`.","wrong":"from mypy_boto3_service_quotas.client import ListServiceQuotasOutputTypeDef","symbol":"ListServiceQuotasOutputTypeDef","correct":"from mypy_boto3_service_quotas.type_defs import ListServiceQuotasOutputTypeDef"}],"quickstart":{"code":"import os\nfrom typing import TYPE_CHECKING\n\nimport boto3\n\n# For runtime, boto3 client usually works without explicit import from stubs\n# For type checking, import the specific client and type defs\nif TYPE_CHECKING:\n    from mypy_boto3_service_quotas.client import ServiceQuotasClient\n    from mypy_boto3_service_quotas.type_defs import ListServiceQuotasOutputTypeDef\n\ndef get_service_quotas_client() -> \"ServiceQuotasClient\":\n    \"\"\"Returns a typed Service Quotas client.\"\"\"\n    # This assumes AWS credentials are configured via environment variables,\n    # shared credentials file, or IAM role.\n    return boto3.client(\n        \"service-quotas\", region_name=os.environ.get(\"AWS_REGION\", \"us-east-1\")\n    )\n\ndef list_quotas():\n    \"\"\"Lists service quotas and prints the first few.\"\"\"\n    client = get_service_quotas_client()\n    try:\n        response: \"ListServiceQuotasOutputTypeDef\" = client.list_service_quotas(\n            ServiceCode=\"ec2\" # Example service code, change as needed\n        )\n        quotas = response.get(\"Quotas\", [])\n        if quotas:\n            print(f\"Found {len(quotas)} EC2 quotas. First 3:\")\n            for quota in quotas[:3]:\n                print(f\"- {quota.get('QuotaName')}: {quota.get('Value')} {quota.get('Unit')}\")\n        else:\n            print(\"No EC2 quotas found for 'ec2' service code.\")\n    except Exception as e:\n        print(f\"Error listing quotas: {e}\")\n\nif __name__ == \"__main__\":\n    # Set dummy AWS credentials for local testing without actual auth\n    # In a real scenario, these would be properly configured.\n    if \"AWS_ACCESS_KEY_ID\" not in os.environ:\n        os.environ[\"AWS_ACCESS_KEY_ID\"] = os.environ.get(\"AWS_ACCESS_KEY_ID\", \"TEST_KEY\")\n        os.environ[\"AWS_SECRET_ACCESS_KEY\"] = os.environ.get(\"AWS_SECRET_ACCESS_KEY\", \"TEST_SECRET\")\n        os.environ[\"AWS_SESSION_TOKEN\"] = os.environ.get(\"AWS_SESSION_TOKEN\", \"TEST_TOKEN\")\n        os.environ[\"AWS_REGION\"] = os.environ.get(\"AWS_REGION\", \"us-east-1\") # Required for many AWS calls\n\n    print(\"Attempting to list service quotas...\")\n    list_quotas()","lang":"python","description":"This quickstart demonstrates how to initialize a typed ServiceQuotas client and make a basic API call to list service quotas, leveraging type hints for improved code quality and IDE support. It includes a fallback for dummy AWS credentials if not already configured, making it directly runnable for testing type checking."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or higher. For older Python versions, you might need to pin `mypy-boto3-service-quotas` to an older, compatible version, though this is not recommended.","message":"Support for Python 3.8 was removed starting with `mypy-boto3-builder` version 8.12.0. Users must upgrade to Python 3.9 or newer.","severity":"breaking","affected_versions":">=8.12.0 of mypy-boto3-builder (which generates mypy-boto3-service-quotas versions corresponding to boto3 >=1.42.10)"},{"fix":"Review your code for direct usage of generated TypeDefs and update their names according to the new conventions. Consult the specific service's `type_defs.pyi` for the correct names.","message":"Breaking changes in TypeDef naming conventions were introduced in `mypy-boto3-builder` 8.9.0. Type definitions for method arguments were shortened (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`), and conflicting `Extra` postfixes were moved (e.g., `CreateDistributionExtraRequestTypeDef` became `CreateDistributionRequestExtraTypeDef`).","severity":"breaking","affected_versions":">=8.9.0 of mypy-boto3-builder (which generates mypy-boto3-service-quotas versions)"},{"fix":"Monitor AWS announcements for the services you use. If a service is deprecated, migrate to its successor as recommended by AWS.","message":"Individual AWS services may be deprecated or replaced by AWS. For example, `sms-voice` was replaced by `pinpoint-sms-voice`. While `service-quotas` has no known deprecation, always check the official AWS documentation for service lifecycle updates.","severity":"deprecated","affected_versions":"N/A (service-specific)"},{"fix":"Consider disabling PyCharm's built-in type checker and using external tools like mypy or pyright for type checking, or if available for this specific service, using a 'lite' stub version (e.g., `boto3-stubs-lite`) if one is provided for the service and your usage patterns.","message":"When using `mypy-boto3-service-quotas` with PyCharm, you might experience slow performance due to PyCharm's handling of Literal overloads (issue PY-40997).","severity":"gotcha","affected_versions":"All versions, specifically with PyCharm"},{"fix":"Explicitly assign `object` to the type-hinted symbols in the non-`TYPE_CHECKING` branch: `if TYPE_CHECKING: from mypy_boto3_service_quotas.client import ServiceQuotasClient else: ServiceQuotasClient = object`.","message":"If you use `TYPE_CHECKING` guards to avoid runtime dependency on `mypy-boto3-service-quotas`, `pylint` might complain about undefined variables. This is because `pylint` does not always respect `TYPE_CHECKING` in the same way type checkers do.","severity":"gotcha","affected_versions":"All versions, when using `TYPE_CHECKING` with Pylint"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}