{"id":3581,"library":"mypy-boto3-finspace","title":"mypy-boto3-finspace Type Annotations","description":"mypy-boto3-finspace provides type annotations (type stubs) for the boto3 Finspace service, enabling static type checking with tools like MyPy. It ensures your boto3 code interacting with AWS Finspace is type-safe. The current version is 1.42.3, which aligns with a specific boto3 version, and updates are released regularly in sync with new boto3 releases and the underlying mypy-boto3-builder.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["mypy","boto3","finspace","aws","types","stubs","typing","type-hinting"],"install":[{"cmd":"pip install mypy-boto3-finspace","lang":"bash","label":"Install package"}],"dependencies":[{"reason":"Provides the actual runtime AWS SDK functionality; mypy-boto3-finspace only provides type stubs.","package":"boto3","optional":false},{"reason":"May be required for full type compatibility on older Python versions (before 3.9) or for specific advanced typing features.","package":"typing-extensions","optional":true}],"imports":[{"note":"The FinspaceClient type stub is provided by mypy-boto3-finspace, not directly by boto3 itself.","wrong":"from boto3.finspace import FinspaceClient","symbol":"FinspaceClient","correct":"from mypy_boto3_finspace.client import FinspaceClient"},{"note":"Before builder version 8.9.0, some TypeDefs might have shorter names. Always refer to the package's specific type_defs module.","wrong":"from mypy_boto3_finspace.type_defs import ListEnvironmentsRequestTypeDef","symbol":"ListEnvironmentsRequestRequestTypeDef","correct":"from mypy_boto3_finspace.type_defs import ListEnvironmentsRequestRequestTypeDef"}],"quickstart":{"code":"import boto3\nimport os\nfrom typing import TYPE_CHECKING\n\n# Only import type stubs when type checking\nif TYPE_CHECKING:\n    from mypy_boto3_finspace.client import FinspaceClient\n    from mypy_boto3_finspace.type_defs import ListEnvironmentsResponseTypeDef\n\n# Create a boto3 client (runtime object)\nclient = boto3.client(\n    \"finspace\",\n    aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', 'DUMMY_KEY'),\n    aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', 'DUMMY_SECRET'),\n    region_name=os.environ.get('AWS_REGION', 'us-east-1')\n)\n\n# Type hint the client for static analysis (optional at runtime, crucial for mypy)\nif TYPE_CHECKING:\n    finspace_client: FinspaceClient = client\nelse:\n    finspace_client = client\n\ntry:\n    # Use the client with type-checked arguments and return types\n    response: ListEnvironmentsResponseTypeDef = finspace_client.list_environments()\n    print(\"Finspace Environments:\")\n    for env in response.get('environments', []):\n        print(f\"  - {env.get('name')} ({env.get('status')})\")\nexcept Exception as e:\n    print(f\"Error listing Finspace environments: {e}\")\n","lang":"python","description":"This quickstart demonstrates how to initialize a boto3 Finspace client and use it with type hints provided by `mypy-boto3-finspace`. The `TYPE_CHECKING` guard ensures that type stub imports do not affect runtime behavior. It fetches a list of Finspace environments, illustrating type-safe interaction."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer. If you must use Python 3.8, pin your `mypy-boto3-finspace` version to a compatible older release (e.g., < 1.42.3).","message":"Python 3.8 is no longer supported. Packages generated by `mypy-boto3-builder` version 8.12.0 and later, including `mypy-boto3-finspace` 1.42.3, require Python 3.9 or higher.","severity":"breaking","affected_versions":"mypy-boto3-finspace >= 1.42.3 (aligned with builder >= 8.12.0)"},{"fix":"Ensure `boto3` is installed in your environment: `pip install boto3`.","message":"This library provides type *stubs* for boto3, not the boto3 library itself. You must install `boto3` separately for your code to run.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update your code to use the new, shorter TypeDef names. Refer to the `type_defs.pyi` file within the installed package or the `mypy-boto3` documentation for the correct names.","message":"Many generated TypeDef names were shortened by `mypy-boto3-builder` (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). This can break explicit references to these types.","severity":"breaking","affected_versions":"mypy-boto3-finspace >= 1.35.0 (aligned with builder >= 8.9.0)"},{"fix":"When troubleshooting or upgrading, remember that the `mypy-boto3-*` package version reflects the specific `boto3` API version it types. Consult the `mypy-boto3` GitHub repository or PyPI page for clarity on version alignment if issues arise after a `boto3` or `mypy-boto3-builder` update.","message":"The version of `mypy-boto3-finspace` (e.g., `1.42.3`) is primarily tied to the `boto3` version that defines the Finspace service client, not the `mypy-boto3-builder`'s semantic versioning. This can lead to confusion when tracking updates.","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"}