{"id":3140,"library":"mypy-boto3-serverlessrepo","title":"Type annotations for boto3 ServerlessApplicationRepository","description":"mypy-boto3-serverlessrepo provides static type annotations for the boto3 ServerlessApplicationRepository service, compatible with tools like VSCode, PyCharm, mypy, and pyright. It is part of the larger mypy-boto3 project, with packages updated hourly from boto3 documentation to ensure compatibility and accuracy. 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":["boto3","aws","mypy","type-hints","stubs","serverless","static-analysis"],"install":[{"cmd":"pip install mypy-boto3-serverlessrepo boto3","lang":"bash","label":"Install with boto3"},{"cmd":"pip install mypy-boto3-serverlessrepo mypy","lang":"bash","label":"Install with mypy"}],"dependencies":[{"reason":"Runtime dependency for AWS SDK functionality. mypy-boto3-serverlessrepo only provides type stubs.","package":"boto3","optional":false},{"reason":"Required for static type checking to utilize the provided type annotations.","package":"mypy","optional":true},{"reason":"May be required for full type compatibility on older Python versions, though builder handles its versioning.","package":"typing-extensions","optional":true}],"imports":[{"symbol":"ServerlessApplicationRepositoryClient","correct":"from mypy_boto3_serverlessrepo.client import ServerlessApplicationRepositoryClient"},{"note":"TypeDef naming conventions changed in `mypy-boto3-builder` 8.9.0, removing redundant 'Request' suffixes.","wrong":"from mypy_boto3_serverlessrepo.type_defs import CreateApplicationRequestRequestTypeDef","symbol":"CreateApplicationRequestTypeDef","correct":"from mypy_boto3_serverlessrepo.type_defs import CreateApplicationRequestTypeDef"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\nfrom mypy_boto3_serverlessrepo.client import ServerlessApplicationRepositoryClient\nfrom mypy_boto3_serverlessrepo.type_defs import CreateApplicationRequestTypeDef\n\n\n# Boto3 client without type hints (mypy/IDE might infer, but explicit is better)\nclient_untyped = boto3.client('serverlessrepo')\n\n# Boto3 client with explicit type hints\nif TYPE_CHECKING:\n    client: ServerlessApplicationRepositoryClient = boto3.client('serverlessrepo')\nelse:\n    client = boto3.client('serverlessrepo')\n\n# Example using a TypedDict for request parameters\napplication_params: CreateApplicationRequestTypeDef = {\n    'Author': 'MyCompany',\n    'Description': 'A sample serverless application.',\n    'Name': 'MySampleApp',\n    'HomePageUrl': 'https://example.com/myapp',\n    'Labels': ['python', 'example'],\n    'SourceCodeUrl': 'https://github.com/mycompany/myapp'\n}\n\ntry:\n    # In a real scenario, you'd add necessary fields like 'AppTemplateBody' or 'SemanticVersion'\n    # For a quickstart, we'll just demonstrate the client type checking.\n    # This call would typically fail without required fields or actual template body.\n    # response = client.create_application(**application_params)\n    print(\"Client type checking is active.\")\n    print(f\"Expected return type for list_applications: {{client.list_applications.__annotations__.get('return')}}\")\nexcept Exception as e:\n    print(f\"An error occurred (expected for incomplete example): {e}\")\n\n","lang":"python","description":"Demonstrates how to obtain a ServerlessApplicationRepository client with type annotations and use a TypedDict for request parameters. Explicit type annotations are recommended for full IDE support. Note that this example will not fully execute a `create_application` call without a complete application template body."},"warnings":[{"fix":"Upgrade to Python 3.9 or higher. If unable, pin `mypy-boto3-serverlessrepo` to a version generated by `mypy-boto3-builder <8.12.0`.","message":"Support for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 must use older versions or upgrade Python.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0"},{"fix":"Ensure your environment is set up to correctly resolve PEP 561 stub packages. Typically, this is handled automatically by tools like `pip` and `mypy`.","message":"The `mypy-boto3` project (which generates this stub package) migrated to PEP 561-compliant package structure. This might require updates to import paths for some internal or advanced usages, though standard client/type_def imports remain consistent.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0"},{"fix":"Review and update TypedDict import paths and variable annotations in your code to reflect the new, shorter naming conventions.","message":"TypedDict naming conventions were updated in `mypy-boto3-builder` 8.9.0. Many `RequestRequestTypeDef` and `ExtraRequestTypeDef` names were shortened (e.g., `CreateApplicationRequestRequestTypeDef` became `CreateApplicationRequestTypeDef`).","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.9.0"},{"fix":"Ensure `boto3` is included in your project's `install_requires` or `requirements.txt` (e.g., `pip install boto3`).","message":"This library provides *only* type annotations (stubs) for `boto3`. You must install the `boto3` library separately for your application to function at runtime.","severity":"gotcha","affected_versions":"All"},{"fix":"Explicitly annotate your client variables, e.g., `client: ServerlessApplicationRepositoryClient = boto3.client('serverlessrepo')`.","message":"For optimal IDE autocomplete and type checking, especially in VSCode and PyCharm, it is highly recommended to use explicit type annotations for `boto3.client()` and `boto3.session.client()` calls.","severity":"gotcha","affected_versions":"All"},{"fix":"Wrap type-dependent imports and assignments within a `if TYPE_CHECKING:` block, setting runtime variables to `object` in the `else` clause.","message":"When using `Pylint`, type checking dependencies might cause false positives for undefined variables if not handled carefully.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}