Skip to content

XRay module#

Index > XRay

Auto-generated documentation for XRay type annotations stubs module mypy-boto3-xray.

How to install#

VSCode extension#

Add AWS Boto3 extension to your VSCode and run AWS boto3: Quick Start command.

Click Modify and select boto3 common and XRay.

From PyPI with pip#

Install boto3-stubs for XRay service.

# install with boto3 type annotations
python -m pip install 'boto3-stubs[xray]'

# Lite version does not provide session.client/resource overloads
# it is more RAM-friendly, but requires explicit type annotations
python -m pip install 'boto3-stubs-lite[xray]'

# standalone installation
python -m pip install mypy-boto3-xray

How to uninstall#

python -m pip uninstall -y mypy-boto3-xray


Code samples can be found in Examples.


Type annotations and code completion for boto3.client("xray") as XRayClient boto3 documentation

# XRayClient usage example

from boto3.session import Session

from mypy_boto3_xray.client import XRayClient

def get_client() -> XRayClient:
    return Session().client("xray")


Type annotations and code completion for paginators from boto3.client("xray").get_paginator("...").

# BatchGetTracesPaginator usage example

from boto3.session import Session

from mypy_boto3_xray.paginator import BatchGetTracesPaginator

def get_batch_get_traces_paginator() -> BatchGetTracesPaginator:
    return Session().client("xray").get_paginator("batch_get_traces"))


Type annotations for literals used in methods and schemas.

# BatchGetTracesPaginatorName usage example

from mypy_boto3_xray.literals import BatchGetTracesPaginatorName

def get_value() -> BatchGetTracesPaginatorName:
    return "batch_get_traces"

Typed dictionaries#

Type annotations for typed dictionaries used in methods and schema.

# AliasTypeDef usage example

from mypy_boto3_xray.type_defs import AliasTypeDef

def get_value() -> AliasTypeDef:
    return {
        "Name": ...,