# {{ package.pypi_name }}

[![PyPI - {{ package.pypi_name }}](https://img.shields.io/pypi/v/{{ package.pypi_name }}.svg?color=blue)](https://pypi.org/project/{{ package.pypi_name }})
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/{{ package.pypi_name }}.svg?color=blue)](https://pypi.org/project/{{ package.pypi_name }})
[![Docs](https://img.shields.io/readthedocs/mypy-boto3-builder.svg?color=blue)](https://mypy-boto3-builder.readthedocs.io/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/{{ package.pypi_name }}?color=blue)](https://pypistats.org/packages/{{ package.pypi_name }})

![boto3.typed]({{ builder_repo_url }}/raw/main/logo.png)

Type annotations for
[boto3 {{ package.library_version }}](https://boto3.amazonaws.com/v1/documentation/api/{{ package.library_version }}/index.html)
compatible with
[VSCode](https://code.visualstudio.com/),
[PyCharm](https://www.jetbrains.com/pycharm/),
[Emacs](https://www.gnu.org/software/emacs/),
[Sublime Text](https://www.sublimetext.com/),
[mypy](https://github.com/python/mypy),
[pyright](https://github.com/microsoft/pyright)
and other tools.

Generated by [mypy-boto3-builder {{ builder_version }}]({{ builder_repo_url }}).

More information can be found in [{{ package.pypi_name }} docs]({{ package.get_local_doc_link() }}).

See how it helps to find and fix potential bugs:

![boto3-stubs demo]({{ builder_repo_url }}/raw/main/demo.gif)

{% include "common/how_to_install.md.jinja2" with context %}

{% with extras_name="essential" %}
{% include "common/usage.md.jinja2" with context %}
{% endwith %}

### Explicit type annotations

To speed up type checking and code completion, you can set types explicitly.

```python
import boto3
from boto3.session import Session

from mypy_boto3_ec2.client import EC2Client
from mypy_boto3_ec2.service_resource import EC2ServiceResource
from mypy_boto3_ec2.waiter import BundleTaskCompleteWaiter
from mypy_boto3_ec2.paginator import DescribeVolumesPaginator

session = Session(region_name="us-west-1")

ec2_client: EC2Client = boto3.client("ec2", region_name="us-west-1")
ec2_resource: EC2ServiceResource = session.resource("ec2")

bundle_task_complete_waiter: BundleTaskCompleteWaiter = ec2_client.get_waiter("bundle_task_complete")
describe_volumes_paginator: DescribeVolumesPaginator = ec2_client.get_paginator("describe_volumes")
```

### Pylint compatibility

It is totally safe to use `TYPE_CHECKING` flag in order to avoid `boto3-stubs`
dependency in production.
However, there is an issue in `pylint` that it complains about undefined
variables. To fix it, set all types to `object` in non-`TYPE_CHECKING` mode.

```python
import boto3
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from mypy_boto3_ec2 import EC2Client, EC2ServiceResource
    from mypy_boto3_ec2.waiters import BundleTaskCompleteWaiter
    from mypy_boto3_ec2.paginators import DescribeVolumesPaginator
else:
    EC2Client = object
    EC2ServiceResource = object
    BundleTaskCompleteWaiter = object
    DescribeVolumesPaginator = object

...
```

{% include "common/footer.md.jinja2" with context %}

{% include "common/submodules.md.jinja2" with context %}
