{"id":3696,"library":"mypy-boto3-sagemaker-featurestore-runtime","title":"mypy-boto3-sagemaker-featurestore-runtime Stubs","description":"mypy-boto3-sagemaker-featurestore-runtime provides `mypy` compatible type annotations for `boto3`'s SageMaker Feature Store Runtime service. It helps developers catch type-related errors for `boto3` usage at static analysis time. The library is part of the `mypy-boto3` family, generated by `mypy-boto3-builder`, and its versioning is tied to `boto3`/`botocore` releases, with frequent updates.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["boto3","aws","type-hints","mypy","sagemaker-featurestore-runtime","stubs","static-analysis"],"install":[{"cmd":"pip install mypy-boto3-sagemaker-featurestore-runtime","lang":"bash","label":"Install stubs"},{"cmd":"pip install boto3 mypy","lang":"bash","label":"Install runtime and type checker"}],"dependencies":[{"reason":"Provides the runtime library that these stubs type-check. Not a direct dependency, but required for usage.","package":"boto3"},{"reason":"The static type checker that utilizes these stubs. Other type checkers may also be used.","package":"mypy","optional":true},{"reason":"Provides backported type features (e.g., `NotRequired`) for older Python versions (<3.11). Automatically handled by `mypy-boto3-builder`'s dependency resolution.","package":"typing-extensions","optional":true}],"imports":[{"note":"The primary client type for type hints. The `boto3.client` import is for runtime, not type-checking the client instance itself.","wrong":"from boto3.client import SagemakerFeatureStoreRuntimeClient","symbol":"SagemakerFeatureStoreRuntimeClient","correct":"from mypy_boto3_sagemaker_featurestore_runtime.client import SagemakerFeatureStoreRuntimeClient"},{"note":"Type definition for input parameters of the `get_record` API call.","symbol":"GetRecordRequestRequestTypeDef","correct":"from mypy_boto3_sagemaker_featurestore_runtime.type_defs import GetRecordRequestRequestTypeDef"},{"note":"Type definition for the response of the `get_record` API call.","symbol":"GetRecordResponseTypeDef","correct":"from mypy_boto3_sagemaker_featurestore_runtime.type_defs import GetRecordResponseTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_sagemaker_featurestore_runtime.client import SagemakerFeatureStoreRuntimeClient\nfrom mypy_boto3_sagemaker_featurestore_runtime.type_defs import GetRecordRequestRequestTypeDef, GetRecordResponseTypeDef\nimport os\n\ndef get_feature_store_record(\n    feature_group_name: str,\n    record_identifier_value_as_string: str\n) -> GetRecordResponseTypeDef:\n    \"\"\"Fetches a record from SageMaker Feature Store with type hints.\"\"\"\n    # boto3.client returns an untyped client by default. \n    # The type hint on 'client' variable applies the stubs.\n    client: SagemakerFeatureStoreRuntimeClient = boto3.client(\n        \"sagemaker-featurestore-runtime\",\n        region_name=os.environ.get(\"AWS_REGION\", \"us-east-1\")\n    )\n\n    request_params: GetRecordRequestRequestTypeDef = {\n        \"FeatureGroupName\": feature_group_name,\n        \"RecordIdentifierValueAsString\": record_identifier_value_as_string,\n        \"FeatureNames\": [\"example_feature_name\"]\n    }\n\n    response: GetRecordResponseTypeDef = client.get_record(**request_params)\n    return response\n\n# Example usage (ensure AWS credentials are set up)\nif __name__ == \"__main__\":\n    try:\n        # Use environment variables for sensitive or dynamic values\n        # For a runnable example, provide dummy values if env vars are not set\n        example_feature_group_name = os.environ.get(\"SAGE_FEATURE_GROUP_NAME\", \"my-test-feature-group\")\n        example_record_id = os.environ.get(\"SAGE_RECORD_ID\", \"12345\")\n\n        if not os.environ.get(\"AWS_ACCESS_KEY_ID\") or not os.environ.get(\"AWS_SECRET_ACCESS_KEY\"):\n            print(\"WARNING: AWS credentials not found in environment. Example might fail at runtime.\")\n            print(\"Please set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.\")\n\n        print(f\"Attempting to get record for Feature Group: {example_feature_group_name}, Record ID: {example_record_id}\")\n        \n        # This call is type-checked by mypy thanks to the stubs\n        record_data = get_feature_store_record(example_feature_group_name, example_record_id)\n        \n        print(\"Successfully retrieved record (type-checked):\")\n        if \"Record\" in record_data:\n            for feature in record_data[\"Record\"]:\n                print(f\"  {feature['FeatureName']}: {feature['ValueAsString']}\")\n        else:\n            print(\"Record key not found in response, or response is empty.\")\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n        print(\"Ensure AWS credentials are configured and the feature group/record exist/are accessible.\")","lang":"python","description":"This quickstart demonstrates how to use `mypy-boto3-sagemaker-featurestore-runtime` for type-checking a `boto3` client interaction. It defines a function to fetch a record from SageMaker Feature Store, explicitly typing the `boto3` client and the request/response payloads. This allows `mypy` to validate your API calls at static analysis time, catching potential errors before runtime."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or later. Update your `pyproject.toml` or `setup.cfg` to reflect `python_requires >=3.9`.","message":"Beginning with `mypy-boto3-builder` version 8.12.0 (which generates `mypy-boto3-*` packages, including this one, corresponding to `boto3` versions around 1.34.x and above), support for Python 3.8 has been removed. Projects using these stubs must upgrade to Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-sagemaker-featurestore-runtime >= 1.42.0"},{"fix":"Ensure `mypy` is up-to-date. If encountering issues, review `mypy`'s documentation on stub discovery and package layout. No changes are typically required for standard setups, as `mypy` handles PEP 561 packages automatically.","message":"Stubs generated by `mypy-boto3-builder` version 8.12.0+ are now PEP 561 compliant, changing the package structure to include the `py.typed` marker. While largely transparent, this *may* affect custom `mypy` configurations or build systems that rely on specific stub discovery paths (e.g., if you manually managed `MYPYPATH`).","severity":"breaking","affected_versions":"mypy-boto3-sagemaker-featurestore-runtime >= 1.42.0"},{"fix":"Only import symbols from the `mypy_boto3_sagemaker_featurestore_runtime` package for type annotations (e.g., in a `from typing import TYPE_CHECKING` block or as explicit type hints). Your application code should continue to `import boto3`.","message":"`mypy-boto3-sagemaker-featurestore-runtime` provides type hints for `boto3`, but it is not a runtime library itself. Do not `import mypy_boto3_sagemaker_featurestore-runtime` in your application code for runtime execution. Its purpose is solely for static analysis tools like `mypy`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `pip install boto3` is part of your project's runtime dependencies, in addition to installing these stubs for type checking.","message":"These stubs are a complement to `boto3`. You must still install `boto3` itself for your application to run. The `mypy-boto3-sagemaker-featurestore-runtime` package does not bundle or install `boto3` for you.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review your `TypedDict` usage and update names according to the latest stubs. `mypy` will guide you with type errors if you are using affected `TypedDict`s.","message":"In `mypy-boto3-builder` version 8.9.0+, some `TypedDict` argument types for API calls (e.g., `CreateDistributionRequestRequestTypeDef` from CloudFront) were shortened to `CreateDistributionRequestTypeDef`. Additionally, conflicting `TypedDict` `Extra` postfixes moved to the end (e.g., `CreateDistributionExtraRequestTypeDef` became `CreateDistributionRequestExtraTypeDef`). While this specific service may not be heavily impacted, it's a breaking change for the `mypy-boto3` ecosystem.","severity":"breaking","affected_versions":"mypy-boto3-sagemaker-featurestore-runtime versions generated by builder 8.9.0+ (approximately >=1.34.0)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}