{"id":3080,"library":"mypy-boto3-efs","title":"mypy-boto3-efs Type Annotations","description":"mypy-boto3-efs provides type annotations for the boto3 EFS service, generated using the `mypy-boto3-builder`. These stubs enhance type checking for `boto3` code, allowing tools like MyPy to catch type-related errors before runtime. The current version is 1.42.3, and it follows the frequent release cadence of its builder.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["mypy","boto3","aws","types","stubs","efs","type-hinting"],"install":[{"cmd":"pip install boto3 mypy-boto3-efs","lang":"bash","label":"Install boto3 and EFS type stubs"}],"dependencies":[{"reason":"Provides runtime functionality; `mypy-boto3-efs` only offers type stubs for it.","package":"boto3","optional":false}],"imports":[{"note":"Client types are typically nested under the 'client' submodule.","wrong":"from mypy_boto3_efs import EFSClient","symbol":"EFSClient","correct":"from mypy_boto3_efs.client import EFSClient"},{"note":"All TypeDef objects are located in the 'type_defs' submodule.","wrong":"from mypy_boto3_efs import CreateFileSystemRequestRequestTypeDef","symbol":"CreateFileSystemRequestRequestTypeDef","correct":"from mypy_boto3_efs.type_defs import CreateFileSystemRequestRequestTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_efs.client import EFSClient\nfrom mypy_boto3_efs.type_defs import CreateFileSystemRequestRequestTypeDef\nimport os\n\n# Ensure boto3 can find credentials (e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, or ~/.aws/credentials)\n# This example does not explicitly set credentials, relying on default boto3 behavior.\n\ndef create_efs_filesystem(token: str) -> None:\n    client: EFSClient = boto3.client(\n        \"efs\", \n        region_name=os.environ.get('AWS_REGION', 'us-east-1')\n    )\n\n    request_params: CreateFileSystemRequestRequestTypeDef = {\n        \"CreationToken\": token,\n        \"PerformanceMode\": \"generalPurpose\",\n        \"Encrypted\": False  # Set to True for encryption\n    }\n\n    try:\n        response = client.create_file_system(**request_params)\n        print(f\"Created EFS File System with ID: {response['FileSystemId']}\")\n        print(f\"ARN: {response['FileSystemArn']}\")\n    except client.exceptions.FileSystemAlreadyExists as e:\n        print(f\"File system with token '{token}' already exists: {e}\")\n    except Exception as e:\n        print(f\"Error creating file system: {e}\")\n\n# Example usage (replace with a unique token for actual creation)\n# create_efs_filesystem(\"my-unique-efs-token\")\nprint(\"Run 'create_efs_filesystem(\"my-unique-efs-token\")' to test\")","lang":"python","description":"This example demonstrates how to use `mypy-boto3-efs` to get type hints for `boto3.client('efs')`. It defines a function to create an EFS file system, explicitly typing the client and the request parameters. Note that `mypy-boto3-efs` provides *only* type stubs; `boto3` must be installed and configured for actual AWS interactions."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or a later version.","message":"Python 3.8 is no longer supported. `mypy-boto3-builder` version 8.12.0 (and subsequent versions which generate `mypy-boto3-efs` 1.42.3+) removed support for Python 3.8. Ensure your environment uses Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-efs >=1.42.3 (generated by builder >=8.12.0)"},{"fix":"Always install both `boto3` and `mypy-boto3-efs` (e.g., `pip install boto3 mypy-boto3-efs`).","message":"These packages provide only type stubs. They do not replace `boto3`. You must install both `boto3` and the `mypy-boto3-efs` package to get full type checking alongside runtime functionality.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review and update explicit TypeDef references in your code if they relied on older naming conventions.","message":"TypeDef naming conventions changed in `mypy-boto3-builder` 8.9.0. This can affect code that directly references generated TypeDefs, potentially shortening names like `CreateDistributionRequestRequestTypeDef` to `CreateDistributionRequestTypeDef`. While `mypy-boto3-efs` might not have many double-suffixed types, it's a general builder change.","severity":"breaking","affected_versions":"mypy-boto3-efs versions generated by builder >=8.9.0"},{"fix":"Ensure your `mypy` configuration is standard and recognizes PEP 561 packages. Most users won't need to change anything unless using esoteric build setups.","message":"Migration to PEP 561 packages in `mypy-boto3-builder` 8.12.0. This changes how stubs are packaged and discovered by MyPy (using `py.typed` marker files). While generally backward compatible, custom build systems or highly specific `mypy` configurations might need adjustment.","severity":"breaking","affected_versions":"mypy-boto3-efs >=1.42.3 (generated by builder >=8.12.0)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}