mypy-boto3-omics
mypy-boto3-omics provides type annotations for the AWS boto3 Omics service, enhancing developer experience with static type checking, improved IDE autocompletion, and early error detection for Python code. It is currently at version 1.42.78 and is frequently updated to align with boto3 releases, as it's generated by the mypy-boto3-builder project.
Warnings
- breaking Support for Python 3.8 was removed starting with `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 will need to upgrade their Python version to use recent versions of `mypy-boto3-omics`.
- breaking TypeDef naming conventions changed in `mypy-boto3-builder` version 8.9.0. Some generated TypeDef names might have become shorter or had postfixes moved, potentially breaking code that explicitly referenced the old generated names (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`).
- gotcha This package provides *only* type stubs. You must install `boto3` separately (e.g., `pip install boto3`) for your code to run. Without `boto3`, you will encounter runtime `ModuleNotFoundError` or similar issues.
- gotcha For optimal performance and to avoid unnecessary runtime dependencies, it is recommended to wrap type stub imports within an `if TYPE_CHECKING:` block. This makes `mypy-boto3-omics` purely a development dependency.
- gotcha When using PyCharm, performance issues with `Literal` overloads have been reported (issue PY-40997). If you experience slowness, consider using `boto3-stubs-lite` (e.g., `pip install 'boto3-stubs-lite[omics]'`) or disabling PyCharm's internal type checker in favor of `mypy` or `pyright`.
Install
-
pip install mypy-boto3-omics -
pip install 'boto3-stubs[omics]' --force-reinstall
Imports
- OmicsClient
from mypy_boto3_omics import OmicsClient
- OmicsClient
if TYPE_CHECKING: from mypy_boto3_omics import OmicsClient
Quickstart
import boto3
from typing import TYPE_CHECKING
# Recommended: Use TYPE_CHECKING guard to avoid runtime dependency on type stubs
if TYPE_CHECKING:
from mypy_boto3_omics import OmicsClient
from mypy_boto3_omics.type_defs import ListReferencesResponseTypeDef
def list_omics_references() -> None:
# Initialize the Omics client with type hints
omics_client: OmicsClient = boto3.client("omics")
print("Listing Omics references...")
try:
response: ListReferencesResponseTypeDef = omics_client.list_references(referenceStoreId="some-store-id") # Replace with a valid store ID
for ref in response.get("references", []):
print(f" - Reference: {ref.get('name')}, Status: {ref.get('status')}")
except omics_client.exceptions.ResourceNotFoundException:
print("Error: Reference store not found. Please provide a valid referenceStoreId.")
except Exception as e:
print(f"An unexpected error occurred: {e}")
if __name__ == "__main__":
# Ensure boto3 is installed (pip install boto3) and AWS credentials are configured
# For this example, 'some-store-id' needs to be a valid Omics Reference Store ID
# in your AWS account and region with appropriate permissions.
list_omics_references()