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

mypy-boto3-personalize-runtime

JSON →
library1.43.0pypypi✓ verified 22d ago

mypy-boto3-personalize-runtime provides high-quality type annotations for the AWS SDK for Python (boto3)'s PersonalizeRuntime service. It enables static type checking with tools like Mypy, Pyright, and enhances IDE features like autocompletion for boto3 clients, responses, and related data structures. The current version, 1.42.3, is generated with mypy-boto3-builder 8.12.0 and is updated frequently to align with boto3 releases and new AWS service features.

pip install mypy-boto3-personalize-runtime boto3
INSTALL
IMPORT
SIG · MYPY-BOTO3-PERSONA
M
mypy-boto3-personalize-runtime
type-stubspythonv1.43.0
Install
3.9s avg
Import
569ms
Disk
50MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.43.0 · 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.592s · 51.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.9s · import 0.546s · 52MB
50MB installed
● package 50MB
Code
Verified usage

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

PersonalizeRuntimeClient
from mypy_boto3_personalize_runtime.client import PersonalizeRuntimeClient
GetRecommendationsResponseTypeDef
from mypy_boto3_personalize_runtime.type_defs import GetRecommendationsResponseTypeDef
boto3
import boto3
from mypy_boto3_personalize_runtime import boto3
mypy-boto3 packages provide type stubs, not runtime modules. Use actual boto3 for client instantiation.

This example demonstrates how to create a type-hinted `PersonalizeRuntimeClient` using `boto3` and explicitly annotate the client object and the response from `get_recommendations`. This allows static type checkers to validate your usage of the client and its response, catching potential errors before runtime. Replace placeholder values with your actual AWS campaign ARN and user ID.

import boto3 from typing import TYPE_CHECKING import os if TYPE_CHECKING: from mypy_boto3_personalize_runtime.client import PersonalizeRuntimeClient from mypy_boto3_personalize_runtime.type_defs import GetRecommendationsResponseTypeDef def get_personalize_recommendations( campaign_arn: str, user_id: str, num_results: int = 10 ) -> GetRecommendationsResponseTypeDef: """Gets recommendations from AWS Personalize Runtime.""" client: PersonalizeRuntimeClient = boto3.client( "personalize-runtime", region_name=os.environ.get('AWS_REGION', 'us-east-1'), aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', ''), aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', '') ) response: GetRecommendationsResponseTypeDef = client.get_recommendations( campaignArn=campaign_arn, userId=user_id, numResults=num_results ) return response # Example usage (requires AWS credentials and a configured Personalize campaign) # if __name__ == "__main__": # campaign_arn_example = "arn:aws:personalize:us-east-1:123456789012:campaign/your-campaign-name" # user_id_example = "test_user_1" # try: # recommendations = get_personalize_recommendations(campaign_arn_example, user_id_example) # print("Recommended Items:") # for item in recommendations.get("itemList", []): # print(f" Item ID: {item.get('itemId')}") # except Exception as e: # print(f"Error getting recommendations: {e}")
Debug
Known issues
breakingAs of `mypy-boto3-builder` version 8.12.0 (which generated this stub version), support for Python 3.8 has been removed. Users on Python 3.8 should upgrade their Python version to 3.9+ or use an older `mypy-boto3` stub package version.
fix
Upgrade Python to 3.9 or higher. If unable to upgrade, pin an older `mypy-boto3-personalize-runtime` version that supported Python 3.8.
affects: >=1.42.3 (generated by mypy-boto3-builder 8.12.0)
breakingThe `mypy-boto3-builder` (version 8.9.0 and later) introduced changes to `TypeDef` naming conventions. Some generated type definition names may have been shortened or have their `Extra` postfix moved. For example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`. While this specific package is for 'personalize-runtime', such a change in the builder could affect similar patterns in type names across services.
fix
Review your code for `_TypeDef` imports and usage, and update names according to the new conventions as indicated by your type checker or documentation.
affects: >=1.42.3 (generated by mypy-boto3-builder 8.9.0+)
gotchaWhen using standalone `mypy-boto3-personalize-runtime` packages (rather than the umbrella `boto3-stubs` with extras), explicit type annotations for `boto3.client()` calls are required for proper type checking and IDE autocompletion. The type checker will not automatically infer the specific client type without the annotation.
fix
Always explicitly type hint your boto3 client objects, e.g., `client: PersonalizeRuntimeClient = boto3.client("personalize-runtime")`.
affects: All versions
gotchaPyCharm users might experience slow performance or high CPU usage due to how it handles `Literal` overloads within `mypy-boto3` stubs. It is sometimes recommended to use `boto3-stubs-lite` (a more RAM-friendly version) or disable PyCharm's internal type checker and rely on `mypy` or `pyright` instead.
fix
Consider installing `boto3-stubs-lite[personalize-runtime]` instead of the full package, or configure PyCharm to use an external type checker like `mypy` or `pyright`.
affects: All versions
gotchaPylint might raise `undefined-variable` warnings when using `TYPE_CHECKING` guards to conditionally import `mypy-boto3` types. This is a known issue with Pylint's interaction with the `TYPE_CHECKING` block.
fix
To resolve Pylint warnings, assign `object` to the type symbols outside the `TYPE_CHECKING` block. For example: `if TYPE_CHECKING: from mypy_boto3_personalize_runtime.client import PersonalizeRuntimeClient else: PersonalizeRuntimeClient = object`.
affects: All versions
Upgrade
Version history
1.43.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
boto3requiredProvides the AWS SDK for Python, for which these are type stubs.
typing-extensionsoptionalRequired for some type features on Python versions older than 3.9, though optional for newer Python versions. Generally good practice to include for robust type hinting.
Agent activity
11 hits · last 30 days
node
8
OpenAI (training)
2
Resources
mypy-boto3-personalize-runtime — pip install mypy-boto3-personalize-runtime · libregistry