Registry / type-stubs / mypy-boto3-xray

mypy-boto3-xray

JSON →
library1.43.0pypypi✓ verified 24d ago

mypy-boto3-xray provides type annotations (stubs) for the `boto3` AWS SDK specifically for the XRay service. It enables static type checking with tools like MyPy, improving code quality and catching errors early when working with AWS XRay. The current version is 1.42.3, which is built with `mypy-boto3-builder` version 8.12.0, and new versions are released frequently to keep pace with `boto3` updates.

pip install boto3 mypy-boto3-xray
INSTALL
IMPORT
SIG · MYPY-BOTO3-XRAY
M
mypy-boto3-xray
type-stubspythonv1.43.0
Install
3.9s avg
Import
617ms
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.636s · 52MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.9s · import 0.598s · 53MB
50MB installed
● package 50MB
Code
Verified usage

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

XRayClient
from mypy_boto3_xray.client import XRayClient
GetTraceSummariesResponseTypeDef
from mypy_boto3_xray.type_defs import GetTraceSummariesResponseTypeDef

Demonstrates how to use `mypy-boto3-xray` to add type hints to a `boto3` XRay client, allowing static analysis to verify method calls and response structures.

import boto3 from mypy_boto3_xray.client import XRayClient from mypy_boto3_xray.type_defs import GetTraceSummariesResponseTypeDef from datetime import datetime, timedelta # mypy-boto3-xray provides type hints for boto3, # so boto3 itself must be installed and used. client: XRayClient = boto3.client("xray") end_time = datetime.now() start_time = end_time - timedelta(hours=1) try: response: GetTraceSummariesResponseTypeDef = client.get_trace_summaries( StartTime=start_time, EndTime=end_time, SamplingStrategy={ "StrategyName": "PartialScan", "Value": 5.0 } ) print(f"Traces found: {len(response.get('TraceSummaries', []))}") if response.get('TraceSummaries'): for trace in response['TraceSummaries']: print(f" Trace ID: {trace['Id']}, Duration: {trace.get('Duration')}") except client.exceptions.InvalidRequestException as e: print(f"Error fetching traces: {e}. Check your AWS region and permissions.") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
breakingStarting with `mypy-boto3-builder` 8.12.0 (which generated `mypy-boto3-xray` 1.42.x), support for Python 3.8 has been removed across all packages. Ensure your project uses Python 3.9 or newer.
fix
Upgrade your Python environment to 3.9 or a later version. If you must use Python 3.8, pin to an older `mypy-boto3-xray` version (e.g., `<1.42.0`).
affects: >=1.42.0
gotcha`mypy-boto3-xray` provides *only type stubs* for static analysis. It does not include the `boto3` runtime itself. You must explicitly install `boto3` (e.g., `pip install boto3`) for your code to execute.
fix
Always install `boto3` alongside `mypy-boto3-xray` in your project dependencies.
affects: all
breakingStarting with `mypy-boto3-builder` 8.12.0, all packages (including `mypy-boto3-xray`) migrated to PEP 561 namespace packages. While this is primarily an internal change, it might affect custom build systems or type checker configurations that rely on specific package structures.
fix
Ensure your type checker (e.g., MyPy) is up-to-date and correctly configured to resolve PEP 561-compliant stub packages. Most standard setups should work without modification.
affects: >=1.42.0
breakingIn `mypy-boto3-builder` 8.9.0, there were breaking changes to TypeDef naming conventions (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`). While not specific to XRay, be aware that similar changes could occur for other services.
fix
If upgrading from very old versions, review your code for TypeDef imports and adjust names according to the new conventions as indicated by your type checker.
affects: >=1.40.0
Upgrade
Version history
1.43.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
boto3requiredThis package provides type stubs for boto3; boto3 itself must be installed to run the code.
Agent activity
36 hits · last 30 days
node
30
OpenAI (training)
1
Resources
mypy-boto3-xray — pip install mypy-boto3-xray · libregistry