Skip to content

Commit

Permalink
Full integration
Browse files Browse the repository at this point in the history
  • Loading branch information
vemel committed Dec 20, 2024
1 parent 78bed9e commit 6aa170f
Show file tree
Hide file tree
Showing 63 changed files with 1,767 additions and 154 deletions.
41 changes: 25 additions & 16 deletions .github/workflows/integration_full.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Integration: Full and custom"
name: "Integration: All products"

on:
schedule:
Expand All @@ -7,27 +7,36 @@ on:

jobs:
integration:
name: "Integration: Full and custom"
name: "Integration: All products"
runs-on: ubuntu-latest
strategy:
matrix:
product:
- "types-boto3"
- "types-boto3-full"
- "types-boto3-custom"
- "boto3-stubs"
- "boto3-stubs-full"
- "boto3-stubs-custom"
- "types-aioboto3"
- "types-aioboto3-full"
- "types-aioboto3-custom"
- "types-aiobotocore"
- "types-aiobotocore-full"
- "types-aiobotocore-custom"
python_version:
- "3.8"
# - "3.10"
# - "3.13"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version
- name: Set up uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: types-boto3-full integration tests
run: |
uv run scripts/integration.py --product boto3_full s3 ec2 -w -d
- name: types-aiobotocore-full integration tests
run: |
uv run scripts/integration.py --product aioboto3_full s3 -w -d
- name: types-boto3-custom integration tests
run: |
uv run scripts/integration.py --product boto3_custom s3 ec2 -w -d
- name: types-aioboto3-custom integration tests
run: |
uv run scripts/integration.py --product aioboto3_custom s3 -w -d
uv run scripts/integration.py \
--product ${{ matrix.product }} \
--python ${{ matrix.python_version }} \
-d
29 changes: 0 additions & 29 deletions aio_examples/mypy/s3_example.py.out

This file was deleted.

3 changes: 0 additions & 3 deletions examples/mypy/dynamodb_example.py.out

This file was deleted.

6 changes: 0 additions & 6 deletions examples/mypy/ec2_example.py.out

This file was deleted.

5 changes: 0 additions & 5 deletions examples/mypy/emr_example.py.out

This file was deleted.

6 changes: 0 additions & 6 deletions examples/mypy/iam_example.py.out

This file was deleted.

22 changes: 0 additions & 22 deletions examples/mypy/s3_example.py.out

This file was deleted.

3 changes: 0 additions & 3 deletions examples/mypy/secretsmanager_example.py.out

This file was deleted.

2 changes: 0 additions & 2 deletions examples/mypy/sqs_example.py.out

This file was deleted.

File renamed without changes.
54 changes: 54 additions & 0 deletions integration/boto3_stubs/dynamodb_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""
Usage example for `types-boto3-dynamodb` package.
```bash
pip install `types-boto3[dynamodb]`
mypy myproject
pyright myproject
```
"""

import decimal

import boto3
from boto3.dynamodb.conditions import Key


def dynamodb_client_example() -> None:
"""
Usage example for DynamoDBClient.
"""
client = boto3.client("dynamodb")
resource = boto3.resource("dynamodb")

my_table = resource.Table("my_table")
print(my_table.name)
batch_writer = my_table.batch_writer()
batch_writer.delete_item(Key={"HashKey": "123"})

my_table.put_item(
Item={
"str": "value",
"number": 123,
"decimal": decimal.Decimal(123.2),
"exception": ValueError("test"),
}
)

try:
client.list_backups(TableName=123)
except client.exceptions.BackupInUseException as e:
print(e)

key_exp = Key("partition_key").eq("pk") & Key("time").between(888888, 999999)
my_table.query(IndexName="my_table", FilterExpression=key_exp)

keys = [{"pk": "abc", "sk": "def"}]
resource.batch_get_item(RequestItems={"table": {"Keys": keys}})


def main() -> None:
"""
Run examples.
"""
dynamodb_client_example()
58 changes: 58 additions & 0 deletions integration/boto3_stubs/ec2_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"""
Usage example for `types-boto3-ec2` package.
```bash
pip install `types-boto3[ec2]`
mypy myproject
pyright myproject
```
"""

import boto3
from boto3.session import Session


def ec2_resource_example() -> None:
"""
Usage example for EC2ServiceResource.
"""
session = Session(region_name="us-west-1")

resource = session.resource("ec2")
boto3_resource = boto3.resource("ec2")
print(boto3_resource)

# (mypy) error: Missing positional argument "Resources" in call
# to "create_tags" of "ServiceResource"
# (mypy) error: Argument "Tags" to "create_tags" of "ServiceResource"
# has incompatible type "int"; expected "List[Tag]"
resource.create_tags(Tags=123)

vpc = resource.Vpc("foo")
vpc_peer = vpc.request_vpc_peering_connection(PeerVpcId="bar")
vpc_peer.accepter_vpc.delete(DryRun="incorrect")

image = resource.Image(id="test")
image.create_tags(Tags=[])
resource.meta.client.create_tags(Tags=[{"Key": 123}], Resources=[])


def ec2_client_example() -> None:
"""
Usage example for EC2Client.
"""
client = boto3.client("ec2")

# (mypy) error: Incompatible types (expression has type "int", TypedDict item
# "Key" has type "str")
client.create_tags(Tags=[{"Key": 123}], Resources=[])
region_name = client.meta.region_name
print(region_name)


def main() -> None:
"""
Run examples.
"""
ec2_resource_example()
ec2_client_example()
34 changes: 34 additions & 0 deletions integration/boto3_stubs/emr_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""
Usage example for `types-boto3-emr` package.
```bash
pip install `types-boto3[emr]`
mypy myproject
pyright myproject
```
"""

import boto3


def emr_client_example() -> None:
"""
Usage example for EMRClient.
"""
client = boto3.client("emr")
client.cancel_steps(ClusterId="cluster_id", StepIds=[123])

list_steps_paginator = client.get_paginator("list_steps")
pages = list_steps_paginator.paginate(ClusterId="cluster_id")
pages.build_full_result("test")
for page in pages:
print(page["Marker"])
for step in page["steps"]:
print(step)


def main() -> None:
"""
Run examples.
"""
emr_client_example()
43 changes: 43 additions & 0 deletions integration/boto3_stubs/iam_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""
Usage example for `types-boto3-iam` package.
```bash
pip install `types-boto3[iam]`
mypy myproject
pyright myproject
```
"""

import boto3


def iam_client_example() -> None:
"""
Usage example for IAMClient.
"""
client = boto3.client("iam")
client.add_user_to_group(GroupName="group", UserName=123)

list_steps_paginator = client.get_paginator("get_account_authorization_details")
pages = list_steps_paginator.paginate(ClusterId="cluster_id")
for page in pages:
print(page["Marker"])
for role in page["RoleDetail"]:
print(role)


def iam_resource_example() -> None:
"""
Usage example for IAMServiceResource.
"""
resource = boto3.resource("iam")
group = resource.Group("my")
group.add_user(UserName="my_user", Other=123)


def main() -> None:
"""
Run examples.
"""
iam_client_example()
iam_resource_example()
3 changes: 3 additions & 0 deletions integration/boto3_stubs/mypy/dynamodb_example.py.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
integration/boto3_stubs/dynamodb_example.py:34: error: Dict entry 3 has incompatible type "str": "ValueError"; expected "str": "bytes | bytearray | str | int | Decimal | <7 more items> | None" [dict-item]
integration/boto3_stubs/dynamodb_example.py:39: error: Argument "TableName" to "list_backups" of "DynamoDBClient" has incompatible type "int"; expected "str" [arg-type]
Found 2 errors in 1 file (checked 1 source file)
6 changes: 6 additions & 0 deletions integration/boto3_stubs/mypy/ec2_example.py.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
integration/boto3_stubs/ec2_example.py:29: error: Missing named argument "Resources" for "create_tags" of "EC2ServiceResource" [call-arg]
integration/boto3_stubs/ec2_example.py:29: error: Argument "Tags" to "create_tags" of "EC2ServiceResource" has incompatible type "int"; expected "Sequence[TagTypeDef]" [arg-type]
integration/boto3_stubs/ec2_example.py:33: error: Argument "DryRun" to "delete" of "Vpc" has incompatible type "str"; expected "bool" [arg-type]
integration/boto3_stubs/ec2_example.py:37: error: Incompatible types (expression has type "int", TypedDict item "Key" has type "str") [typeddict-item]
integration/boto3_stubs/ec2_example.py:48: error: Incompatible types (expression has type "int", TypedDict item "Key" has type "str") [typeddict-item]
Found 5 errors in 1 file (checked 1 source file)
5 changes: 5 additions & 0 deletions integration/boto3_stubs/mypy/emr_example.py.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
integration/boto3_stubs/emr_example.py:19: error: List item 0 has incompatible type "int"; expected "str" [list-item]
integration/boto3_stubs/emr_example.py:23: error: Too many arguments for "build_full_result" of "PageIterator" [call-arg]
integration/boto3_stubs/emr_example.py:26: error: TypedDict "ListStepsOutputTypeDef" has no key "steps" [typeddict-item]
integration/boto3_stubs/emr_example.py:26: note: Did you mean "Steps"?
Found 3 errors in 1 file (checked 1 source file)
6 changes: 6 additions & 0 deletions integration/boto3_stubs/mypy/iam_example.py.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
integration/boto3_stubs/iam_example.py:19: error: Argument "UserName" to "add_user_to_group" of "IAMClient" has incompatible type "int"; expected "str" [arg-type]
integration/boto3_stubs/iam_example.py:22: error: Unexpected keyword argument "ClusterId" for "paginate" of "GetAccountAuthorizationDetailsPaginator" [call-arg]
integration/boto3_stubs/iam_example.py:25: error: TypedDict "GetAccountAuthorizationDetailsResponseTypeDef" has no key "RoleDetail" [typeddict-item]
integration/boto3_stubs/iam_example.py:25: note: Did you mean "RoleDetailList"?
integration/boto3_stubs/iam_example.py:35: error: Unexpected keyword argument "Other" for "add_user" of "Group" [call-arg]
Found 4 errors in 1 file (checked 1 source file)
Loading

0 comments on commit 6aa170f

Please sign in to comment.