mypy-boto3-schemas
mypy-boto3-schemas provides type annotations for the AWS Schemas service within the boto3 library, enhancing static type checking for Python applications. It is part of the `mypy-boto3` family of projects, generated by `mypy-boto3-builder`. The current version is 1.42.3 and new versions are released frequently to keep pace with boto3 updates and new AWS service features.
Warnings
- breaking Starting with `mypy-boto3-builder` version 8.12.0 (which generates this package), support for Python 3.8 has been removed. Projects using `mypy-boto3-schemas` must use Python 3.9 or newer.
- breaking In `mypy-boto3-builder` version 8.9.0, there were breaking changes to TypeDef naming conventions. Conflicting TypeDef names had `Extra` moved to the end (e.g., `CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`), and packed method arguments use shorter names (`CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`).
- deprecated The `sms-voice` service was removed in `mypy-boto3-builder` version 8.11.0. If your project uses type hints for `sms-voice`, you should migrate to `pinpoint-sms-voice`.
- gotcha This package (`mypy-boto3-schemas`) is a stub-only library for static type checking. It does not contain any runtime code. You must have `boto3` (or `aioboto3` for async variants) installed in your environment for your application to run.
- gotcha When using `mypy-boto3` stubs with `pylint`, `pylint` might complain about undefined variables if types are used directly without a `TYPE_CHECKING` guard. This is because `pylint` may not fully understand the stub-only nature of the imports.
Install
-
pip install mypy-boto3-schemas
Imports
- SchemaSummaryTypeDef
from mypy_boto3_schemas.type_defs import SchemaSummaryTypeDef
- SchemasClient
from mypy_boto3_schemas.client import SchemasClient
Quickstart
from typing import TYPE_CHECKING
from mypy_boto3_schemas.type_defs import CreateSchemaInputRequestTypeDef
if TYPE_CHECKING:
import boto3
from mypy_boto3_schemas.client import SchemasClient
def create_example_schema(client: "SchemasClient") -> None:
# Example of a TypeDef for schema creation input
schema_input: CreateSchemaInputRequestTypeDef = {
"RegistryName": "my-registry",
"SchemaName": "my-schema",
"Content": "{\"type\": \"object\", \"properties\": {\"foo\": {\"type\": \"string\"}}}",
"Type": "OpenApi3", # Or 'JSONSchema', 'WSDL', 'XSD'
}
print(f"Attempting to create schema: {schema_input['SchemaName']}")
# In a real application, you would call a boto3 client method here, e.g.:
# client.create_schema(**schema_input)
# Example usage (requires boto3 to be installed and configured)
if __name__ == "__main__":
# This part would typically interact with a real boto3 client
# For demonstration, we'll use a mock if boto3 is not present
try:
import boto3
schemas_client: "SchemasClient" = boto3.client("schemas")
create_example_schema(schemas_client)
except ImportError:
print("boto3 not installed. Skipping live client example, but type hints are still valid.")