{"id":3693,"library":"mypy-boto3-s3outposts","title":"Type Annotations for Boto3 S3Outposts","description":"mypy-boto3-s3outposts provides type annotations for the `boto3` S3Outposts service, enhancing development with static type checking and IDE autocomplete. It is generated by `mypy-boto3-builder` and keeps pace with `boto3` releases, typically seeing frequent updates. 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","type-annotations","mypy","stubs","s3outposts","type-checking"],"install":[{"cmd":"pip install mypy-boto3-s3outposts boto3","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"This package provides type stubs for the `boto3` library; `boto3` itself is a required runtime dependency.","package":"boto3"}],"imports":[{"note":"Import the typed client for S3Outposts.","symbol":"S3OutpostsClient","correct":"from mypy_boto3_s3outposts.client import S3OutpostsClient"},{"note":"Import typed paginators for S3Outposts operations.","symbol":"ListEndpointsPaginator","correct":"from mypy_boto3_s3outposts.paginator import ListEndpointsPaginator"},{"note":"Import typed dictionaries for request/response bodies and other data structures.","symbol":"CreateEndpointRequestTypeDef","correct":"from mypy_boto3_s3outposts.type_defs import CreateEndpointRequestTypeDef"},{"note":"The actual boto3 session is still required for client creation.","symbol":"Session","correct":"from boto3.session import Session"}],"quickstart":{"code":"import os\nfrom typing import TYPE_CHECKING\n\nimport boto3\nfrom boto3.session import Session\n\nif TYPE_CHECKING:\n    from mypy_boto3_s3outposts.client import S3OutpostsClient\n    from mypy_boto3_s3outposts.type_defs import CreateEndpointRequestTypeDef\n\n\ndef get_s3outposts_client() -> 'S3OutpostsClient':\n    # Explicit type annotation is optional with full mypy-boto3-stubs\n    # but can be helpful for IDEs and type checkers like mypy/pyright.\n    session = Session(region_name=os.environ.get('AWS_DEFAULT_REGION', 'us-east-1'))\n    client: S3OutpostsClient = session.client('s3outposts')\n    return client\n\n\nif __name__ == \"__main__\":\n    s3outposts_client = get_s3outposts_client()\n\n    print(\"Listing S3Outposts endpoints:\")\n    try:\n        response = s3outposts_client.list_endpoints()\n        for endpoint in response.get(\"Endpoints\", []):\n            print(f\"  Endpoint Id: {endpoint.get('EndpointId')}, Status: {endpoint.get('Status')}\")\n    except Exception as e:\n        print(f\"Error listing endpoints: {e}\")\n\n    # Example of using a TypedDict for a request payload (if creating an endpoint)\n    # Note: This is a placeholder and would require actual valid parameters to run.\n    if TYPE_CHECKING:\n        create_endpoint_request: CreateEndpointRequestTypeDef = {\n            \"OutpostId\": \"op-0123456789abcdef0\",\n            \"S3OutpostsArn\": \"arn:aws:s3-outposts:us-east-1:123456789012:outpost/op-0123456789abcdef0/accesspoint/my-accesspoint\",\n            \"EndpointDetails\": {\n                \"SecurityGroupId\": \"sg-0abcdef1234567890\",\n                \"SubnetId\": \"subnet-0abcdef1234567890\"\n            }\n        }\n        # result = s3outposts_client.create_endpoint(**create_endpoint_request)\n        # print(f\"Created endpoint: {result.get('EndpointArn')}\")","lang":"python","description":"This quickstart demonstrates how to initialize a typed S3Outposts client using `boto3.session.Session` and `mypy-boto3-s3outposts` for enhanced type checking. It includes an example of listing endpoints and a commented-out example of using a `TypedDict` for a request payload."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer. The `requires_python` for `mypy-boto3-s3outposts` is `>=3.9`.","message":"Support for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0, which generates `mypy-boto3-s3outposts`. Users on Python 3.8 should upgrade their Python version.","severity":"breaking","affected_versions":">=8.12.0 (builder)"},{"fix":"Ensure your `mypy` and IDE environments are up-to-date and correctly configured to discover PEP 561-compliant stub packages. Reinstalling the stub packages can sometimes resolve issues.","message":"As of `mypy-boto3-builder` version 8.12.0, the generated stub packages fully migrated to PEP 561. This change generally improves compatibility but may require updates to `mypy` or IDE configurations for older setups.","severity":"breaking","affected_versions":">=8.12.0 (builder)"},{"fix":"Review your code for any custom TypeDef imports or usages and update them to the new, shorter names. Consult the `mypy-boto3-s3outposts` documentation for specific TypeDef names.","message":"In `mypy-boto3-builder` version 8.9.0, TypeDef naming conventions changed. For example, `CreateDistributionRequestRequestTypeDef` was shortened to `CreateDistributionRequestTypeDef`. This affects all generated service TypeDefs, including those for S3Outposts.","severity":"breaking","affected_versions":">=8.9.0 (builder)"},{"fix":"Add explicit type annotations to your `boto3` client and resource objects using the types imported from `mypy_boto3_s3outposts`.","message":"While `mypy-boto3` stubs generally allow implicit type discovery, explicit type annotations (e.g., `client: S3OutpostsClient = session.client('s3outposts')`) are often recommended for the best IDE autocomplete and type checker experience, especially when using `mypy-boto3-lite` variants.","severity":"gotcha","affected_versions":"All versions"},{"fix":"To resolve Pylint warnings, set the conditionally imported types to `object` in the `else` block of your `TYPE_CHECKING` statement. For example: `if TYPE_CHECKING: from mypy_boto3_s3outposts.client import S3OutpostsClient else: S3OutpostsClient = object`.","message":"Pylint may report 'undefined variable' errors when using `TYPE_CHECKING` blocks to conditionally import stubs. This is a known issue with Pylint's static analysis.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}