Registry / type-stubs / mypy-boto3-sagemaker-runtime

mypy-boto3-sagemaker-runtime

JSON →
library1.43.68pypypi✓ verified 24d ago

This package provides type annotations for the `boto3` SageMaker Runtime service, generated by `mypy-boto3-builder`. It ensures type safety and autocompletion for `boto3.client('sagemaker-runtime')` operations in your Python projects. The library is actively maintained, with frequent releases that align closely with `boto3` and `botocore` updates.

pip install mypy-boto3-sagemaker-runtime boto3 mypy
INSTALL
IMPORT
SIG · MYPY-BOTO3-SAGEMAK
M
mypy-boto3-sagemaker-runtime
type-stubspythonv1.43.68
Install
5.9s avg
Import
Disk
114MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.43.68 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 116.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 5.9s · import 0.000s · 114MB
114MB installed
● package 114MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SagemakerRuntimeClient
from mypy_boto3_sagemaker_runtime.client import SagemakerRuntimeClient
The primary type for the SageMaker Runtime service client.
InvokeEndpointInputRequestTypeDef
from mypy_boto3_sagemaker_runtime.type_defs import InvokeEndpointInputRequestTypeDef
Type definition for the input parameters of the InvokeEndpoint operation.
InvokeEndpointOutputTypeDef
from mypy_boto3_sagemaker_runtime.type_defs import InvokeEndpointOutputTypeDef
Type definition for the output of the InvokeEndpoint operation.

Demonstrates how to obtain a type-hinted SageMaker Runtime client and use it to invoke an endpoint. It highlights the use of `SagemakerRuntimeClient` for the client and `InvokeEndpointOutputTypeDef` for the operation's response, ensuring type safety throughout the interaction.

import boto3 from mypy_boto3_sagemaker_runtime.client import SagemakerRuntimeClient from mypy_boto3_sagemaker_runtime.type_defs import InvokeEndpointOutputTypeDef import os # Get a type-hinted SageMaker Runtime client client: SagemakerRuntimeClient = boto3.client("sagemaker-runtime") # Example: Invoke a SageMaker endpoint # For a real use case, replace 'your-endpoint-name' with an actual endpoint # and 'application/json' with the correct ContentType for your model. endpoint_name = os.environ.get("SAGEMAKER_ENDPOINT_NAME", "your-endpoint-name") content_type = "application/json" body = b'{"instances": [[1.0, 2.0, 3.0]]}' # Example JSON payload try: # The response object is type-hinted by InvokeEndpointOutputTypeDef response: InvokeEndpointOutputTypeDef = client.invoke_endpoint( EndpointName=endpoint_name, ContentType=content_type, Body=body ) # The 'Body' key in the response is a StreamingBody object response_body = response['Body'].read().decode('utf-8') print(f"Successfully invoked endpoint '{endpoint_name}'.") print(f"Response Status Code: {response['ResponseMetadata']['HTTPStatusCode']}") print(f"Response Body: {response_body}") except client.exceptions.ValidationError as e: print(f"Validation error: {e}") print("Please ensure 'SAGEMAKER_ENDPOINT_NAME' environment variable is set to a valid endpoint, and 'Body' matches its expected format.") except Exception as e: print(f"An unexpected error occurred: {e}") print("This might happen if the endpoint does not exist or credentials are not configured.")
Debug
Known issues
breakingPython 3.8 support was removed in `mypy-boto3-builder` version 8.12.0 (and consequently for generated stub packages like this one). Projects using Python 3.8 will need to upgrade to Python 3.9+ to use newer versions of these stubs.
fix
Upgrade your Python environment to version 3.9 or higher.
affects: >=8.12.0
breakingType definition naming conventions were changed in `mypy-boto3-builder` version 8.9.0. This might affect direct imports of specific `TypeDef` classes if they previously had redundant suffixes (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`).
fix
Review your imports of specific `TypeDef` classes and update their names according to the new, often shorter, conventions. Refer to the `type_defs.pyi` file in the installed package for accurate names.
affects: >=8.9.0
gotchaThis package provides only type stubs. It does not include the `boto3` runtime library itself. `boto3` must be installed separately for your code to run.
fix
Ensure `boto3` is installed in your environment: `pip install boto3`.
affects: All versions
gotchaType stubs are generated against specific `boto3` and `botocore` versions. Mismatches between your installed `mypy-boto3-sagemaker-runtime` version and your `boto3`/`botocore` version can lead to incorrect type hints or `mypy` errors, even if the runtime code functions correctly.
fix
Keep your `mypy-boto3-sagemaker-runtime` package version in sync with your `boto3` installation. The package version typically reflects the `boto3` version it types for (e.g., `mypy-boto3-sagemaker-runtime==1.x.y` for `boto3==1.x.y`).
affects: All versions
Upgrade
Version history
1.43.68latest on PyPI · released Aug 10, 2026
Audit
Dependencies
boto3requiredProvides the runtime functionality that these stubs type-hint.
mypyoptionalThe static type checker that utilizes these stubs.
Agent activity
21 hits · last 30 days
node
18
OpenAI (training)
2
Resources
mypy-boto3-sagemaker-runtime — pip install mypy-boto3-sagemaker-runtime · libregistry