mypy-boto3-neptune Type Annotations

1.42.57 · active · verified Sat Apr 11

mypy-boto3-neptune provides comprehensive type annotations for the AWS Neptune service within the `boto3` library, ensuring type safety and enhanced developer experience in environments like mypy, VSCode, and PyCharm. It is currently at version 1.42.57 and is part of a frequently updated ecosystem, with releases often tied to new `boto3` versions and updates to the `mypy-boto3-builder` tool.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to obtain a type-hinted AWS Neptune client using `boto3` and `mypy-boto3-neptune`. The `TYPE_CHECKING` block ensures that the type import is only used during static analysis, avoiding runtime dependencies. The client will automatically use AWS credentials configured in your environment.

import boto3
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from mypy_boto3_neptune.client import NeptuneClient

def get_neptune_client() -> NeptuneClient:
    """Gets a typed Neptune client."""
    # boto3 automatically picks up credentials from environment variables or ~/.aws/credentials
    client: NeptuneClient = boto3.client("neptune")
    return client

if __name__ == "__main__":
    neptune_client = get_neptune_client()
    # Example usage (uncomment to run, requires AWS credentials)
    # try:
    #     response = neptune_client.describe_db_instances()
    #     print("Neptune DB Instances:")
    #     for db_instance in response.get("DBInstances", []):
    #         print(f"- {db_instance['DBInstanceIdentifier']}")
    # except Exception as e:
    #     print(f"Error describing DB instances: {e}")
    print(f"Successfully retrieved Neptune client: {neptune_client.__class__.__name__}")

view raw JSON →