├── .all-contributorsrc
├── .dockerignore
├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── feature_request.md
│ └── vulnerability_report.md
├── PULL_REQUEST_TEMPLATE.md
├── dependabot.yml
└── workflows
│ ├── helpers.js
│ ├── integration_build.yml
│ ├── integration_full.yml
│ ├── on_push.yml
│ ├── on_push_coverage.yml
│ ├── on_release.yml
│ ├── on_release_docs.yml
│ ├── publish_aiobotocore_full.yml
│ ├── publish_aiobotocore_stubs.yml
│ ├── publish_boto3_full.yml
│ ├── publish_boto3_stubs.yml
│ ├── publish_types_aioboto3.yml
│ ├── publish_types_boto3.yml
│ ├── publish_types_boto3_full.yml
│ ├── sanity_boto3_stubs.yml
│ ├── sanity_check.yml
│ ├── sanity_types_aioboto3.yml
│ └── sanity_types_aiobotocore.yml
├── .gitignore
├── .pre-commit-config.yaml
├── .python-version
├── .readthedocs.yml
├── .vscode
├── extensions.json
├── launch.json
└── settings.json
├── CLAUDE.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Dockerfile
├── LICENSE
├── MANIFEST.in
├── README.md
├── SECURITY.md
├── codecov.yml
├── conftest.py
├── demo.gif
├── docsmd
├── architecture.md
├── development.md
├── how_it_works.md
├── how_to_build.md
├── index.md
├── js
│ └── highlight.js
├── pre_build.md
└── thank_you.md
├── examples
├── __init__.py
├── dynamodb_example.py
├── ec2_example.py
├── emr_example.py
├── iam_example.py
├── s3_example.py
├── secretsmanager_example.py
└── sqs_example.py
├── integration
├── boto3_stubs
│ ├── __init__.py
│ ├── dynamodb_example.py
│ ├── ec2_example.py
│ ├── emr_example.py
│ ├── iam_example.py
│ ├── mypy
│ │ ├── dynamodb_example.py.out
│ │ ├── ec2_example.py.out
│ │ ├── emr_example.py.out
│ │ ├── iam_example.py.out
│ │ ├── s3_example.py.out
│ │ ├── secretsmanager_example.py.out
│ │ └── sqs_example.py.out
│ ├── pyright
│ │ ├── dynamodb_example.py.json
│ │ ├── ec2_example.py.json
│ │ ├── emr_example.py.json
│ │ ├── iam_example.py.json
│ │ ├── s3_example.py.json
│ │ ├── secretsmanager_example.py.json
│ │ └── sqs_example.py.json
│ ├── s3_example.py
│ ├── secretsmanager_example.py
│ └── sqs_example.py
├── boto3_stubs_lite
│ ├── __init__.py
│ ├── mypy
│ │ └── s3_example.py.out
│ ├── pyright
│ │ └── s3_example.py.json
│ └── s3_example.py
├── types_aioboto3
│ ├── __init__.py
│ ├── mypy
│ │ └── s3_example.py.out
│ ├── pyright
│ │ └── s3_example.py.json
│ └── s3_example.py
├── types_aioboto3_lite
│ ├── __init__.py
│ ├── mypy
│ │ └── s3_example.py.out
│ ├── pyright
│ │ └── s3_example.py.json
│ └── s3_example.py
├── types_aiobotocore
│ ├── __init__.py
│ ├── mypy
│ │ └── s3_example.py.out
│ ├── pyright
│ │ └── s3_example.py.json
│ └── s3_example.py
├── types_aiobotocore_lite
│ ├── __init__.py
│ ├── mypy
│ │ └── s3_example.py.out
│ ├── pyright
│ │ └── s3_example.py.json
│ └── s3_example.py
├── types_boto3
│ ├── __init__.py
│ ├── dynamodb_example.py
│ ├── ec2_example.py
│ ├── emr_example.py
│ ├── iam_example.py
│ ├── mypy
│ │ ├── dynamodb_example.py.out
│ │ ├── ec2_example.py.out
│ │ ├── emr_example.py.out
│ │ ├── iam_example.py.out
│ │ ├── s3_example.py.out
│ │ ├── secretsmanager_example.py.out
│ │ └── sqs_example.py.out
│ ├── pyright
│ │ ├── dynamodb_example.py.json
│ │ ├── ec2_example.py.json
│ │ ├── emr_example.py.json
│ │ ├── iam_example.py.json
│ │ ├── s3_example.py.json
│ │ ├── secretsmanager_example.py.json
│ │ └── sqs_example.py.json
│ ├── s3_example.py
│ ├── secretsmanager_example.py
│ └── sqs_example.py
└── types_boto3_lite
│ ├── __init__.py
│ ├── mypy
│ └── s3_example.py.out
│ ├── pyright
│ └── s3_example.py.json
│ └── s3_example.py
├── istub.yml
├── istub_aio.yml
├── logo.png
├── mkdocs.yml
├── mypy_boto3_builder
├── __init__.py
├── __main__.py
├── boto3_ports
│ ├── __init__.py
│ └── model.py
├── chat
│ ├── __init__.py
│ ├── chat.py
│ ├── chat_buddy.py
│ ├── choice.py
│ ├── enums.py
│ ├── prompts
│ │ ├── __init__.py
│ │ ├── base_prompt.py
│ │ ├── multiselect_prompt.py
│ │ ├── path_prompt.py
│ │ └── select_prompt.py
│ ├── text_style.py
│ ├── type_defs.py
│ └── utils.py
├── cli_parser.py
├── constants.py
├── debug.py
├── enums
│ ├── __init__.py
│ ├── output_type.py
│ ├── product.py
│ ├── product_library.py
│ ├── product_type.py
│ └── service_module_name.py
├── exceptions.py
├── generators
│ ├── __init__.py
│ ├── aioboto3_generator.py
│ ├── aiobotocore_generator.py
│ ├── base_generator.py
│ ├── boto34_generator.py
│ ├── boto3_generator.py
│ ├── mypy_boto3_generator.py
│ └── types_boto3_generator.py
├── import_helpers
│ ├── __init__.py
│ ├── import_helper.py
│ ├── import_parent.py
│ ├── import_record.py
│ ├── import_record_group.py
│ ├── import_string.py
│ └── internal_import_record.py
├── jinja_manager.py
├── logger.py
├── main.py
├── package_data.py
├── parsers
│ ├── __init__.py
│ ├── client_parser.py
│ ├── fake_service_package.py
│ ├── mypy_boto3_package.py
│ ├── parse_attributes.py
│ ├── parse_collections.py
│ ├── parse_references.py
│ ├── parse_wrapper_package.py
│ ├── resource_loader.py
│ ├── resource_parser.py
│ ├── service_package_parser.py
│ ├── service_resource_parser.py
│ ├── shape_parser.py
│ ├── shape_parser_types.py
│ ├── typed_dict_map.py
│ └── wrapper_package_parser.py
├── postprocessors
│ ├── __init__.py
│ ├── aio_imports.py
│ ├── aioboto3.py
│ ├── aiobotocore.py
│ ├── base.py
│ └── botocore.py
├── py.typed
├── service_name.py
├── structures
│ ├── __init__.py
│ ├── argument.py
│ ├── attribute.py
│ ├── base_class.py
│ ├── class_record.py
│ ├── client.py
│ ├── collection.py
│ ├── function.py
│ ├── method.py
│ ├── package.py
│ ├── package_extra.py
│ ├── package_url.py
│ ├── packages
│ │ ├── __init__.py
│ │ ├── boto34_package.py
│ │ ├── mypy_boto3_package.py
│ │ ├── service_package.py
│ │ ├── types_aioboto3_package.py
│ │ ├── types_aiobotocore_package.py
│ │ ├── types_boto3_package.py
│ │ └── wrapper_package.py
│ ├── paginator.py
│ ├── resource_record.py
│ ├── service_resource.py
│ └── waiter.py
├── stubs_static
│ ├── types-aioboto3
│ │ ├── __init__.pyi
│ │ ├── dynamodb
│ │ │ ├── __init__.pyi
│ │ │ └── table.pyi
│ │ ├── experimental
│ │ │ ├── __init__.pyi
│ │ │ └── async_chalice.pyi
│ │ ├── resources
│ │ │ ├── __init__.pyi
│ │ │ ├── action.pyi
│ │ │ ├── base.pyi
│ │ │ ├── collection.pyi
│ │ │ ├── factory.pyi
│ │ │ └── response.pyi
│ │ ├── s3
│ │ │ ├── __init__.pyi
│ │ │ ├── cse.pyi
│ │ │ └── inject.pyi
│ │ └── session.pyi
│ ├── types-aiobotocore
│ │ ├── __init__.pyi
│ │ ├── args.pyi
│ │ ├── awsrequest.pyi
│ │ ├── client.pyi
│ │ ├── config.pyi
│ │ ├── configprovider.pyi
│ │ ├── credentials.pyi
│ │ ├── discovery.pyi
│ │ ├── endpoint.pyi
│ │ ├── eventstream.pyi
│ │ ├── handlers.pyi
│ │ ├── hooks.pyi
│ │ ├── httpchecksum.pyi
│ │ ├── httpsession.pyi
│ │ ├── paginate.pyi
│ │ ├── parsers.pyi
│ │ ├── regions.pyi
│ │ ├── response.pyi
│ │ ├── retries
│ │ │ ├── __init__.pyi
│ │ │ ├── adaptive.pyi
│ │ │ ├── bucket.pyi
│ │ │ ├── special.pyi
│ │ │ └── standard.pyi
│ │ ├── retryhandler.pyi
│ │ ├── session.pyi
│ │ ├── signers.pyi
│ │ ├── stub.pyi
│ │ ├── tokens.pyi
│ │ ├── utils.pyi
│ │ └── waiter.pyi
│ └── types-boto3
│ │ ├── __init__.pyi
│ │ ├── compat.pyi
│ │ ├── crt.pyi
│ │ ├── docs
│ │ ├── __init__.pyi
│ │ ├── action.pyi
│ │ ├── attr.pyi
│ │ ├── base.pyi
│ │ ├── client.pyi
│ │ ├── collection.pyi
│ │ ├── docstring.pyi
│ │ ├── method.pyi
│ │ ├── resource.pyi
│ │ ├── service.pyi
│ │ ├── subresource.pyi
│ │ ├── utils.pyi
│ │ └── waiter.pyi
│ │ ├── dynamodb
│ │ ├── __init__.pyi
│ │ ├── conditions.pyi
│ │ ├── table.pyi
│ │ ├── transform.pyi
│ │ └── types.pyi
│ │ ├── ec2
│ │ ├── __init__.pyi
│ │ ├── createtags.pyi
│ │ └── deletetags.pyi
│ │ ├── exceptions.pyi
│ │ ├── resources
│ │ ├── __init__.pyi
│ │ ├── action.pyi
│ │ ├── base.pyi
│ │ ├── collection.pyi
│ │ ├── factory.pyi
│ │ ├── model.pyi
│ │ ├── params.pyi
│ │ └── response.pyi
│ │ ├── s3
│ │ ├── __init__.pyi
│ │ ├── constants.pyi
│ │ ├── inject.pyi
│ │ └── transfer.pyi
│ │ ├── session.pyi
│ │ └── utils.pyi
├── templates
│ ├── boto34
│ │ ├── aioboto3_service.py.jinja2
│ │ ├── aioboto3_session.py.jinja2
│ │ ├── aioboto3_session_full.jinja2
│ │ ├── aiobotocore_service.py.jinja2
│ │ ├── aiobotocore_session.py.jinja2
│ │ ├── aiobotocore_session_full.py.jinja2
│ │ ├── boto3_service.py.jinja2
│ │ ├── boto3_session.py.jinja2
│ │ ├── boto3_session_full.py.jinja2
│ │ └── services.md.jinja2
│ ├── common
│ │ ├── LICENSE.jinja2
│ │ ├── argument.py.jinja2
│ │ ├── arguments_list.md.jinja2
│ │ ├── arguments_list_code.md.jinja2
│ │ ├── class.py.jinja2
│ │ ├── footer.md.jinja2
│ │ ├── function.py.jinja2
│ │ ├── header.md.jinja2
│ │ ├── header_note.md.jinja2
│ │ ├── how_to_install.md.jinja2
│ │ ├── how_to_install_full.md.jinja2
│ │ ├── how_to_install_service.md.jinja2
│ │ ├── import_record_string.py.jinja2
│ │ ├── literal.py.jinja2
│ │ ├── method.md.jinja2
│ │ ├── method.py.jinja2
│ │ ├── method_code.md.jinja2
│ │ ├── module.py.jinja2
│ │ ├── named_union.py.jinja2
│ │ ├── readme
│ │ │ ├── literals.md.jinja2
│ │ │ └── type_defs.md.jinja2
│ │ ├── service
│ │ │ ├── literals.pyi.jinja2
│ │ │ ├── setup.py.jinja2
│ │ │ ├── type_defs.pyi.jinja2
│ │ │ └── version.py.jinja2
│ │ ├── service_docs
│ │ │ ├── literals.md.jinja2
│ │ │ ├── readme_literals.md.jinja2
│ │ │ ├── readme_resources.md.jinja2
│ │ │ ├── readme_type_defs.md.jinja2
│ │ │ └── type_defs.md.jinja2
│ │ ├── submodules.md.jinja2
│ │ ├── type_annotation.md.jinja2
│ │ ├── type_annotation_code.md.jinja2
│ │ ├── type_hint.md.jinja2
│ │ ├── typed_dict.py.jinja2
│ │ ├── typed_dict_class.py.jinja2
│ │ ├── usage.md.jinja2
│ │ ├── usage_full.md.jinja2
│ │ └── wrapper
│ │ │ ├── README.md.jinja2
│ │ │ └── setup.py.jinja2
│ ├── mypy-boto3
│ │ ├── README.md.jinja2
│ │ ├── mypy_boto3
│ │ │ ├── __init__.py.jinja2
│ │ │ ├── __main__.py.jinja2
│ │ │ ├── boto3_init.py.jinja2
│ │ │ ├── boto3_init_stub.py.jinja2
│ │ │ ├── boto3_session.py.jinja2
│ │ │ ├── boto3_session_stub.py.jinja2
│ │ │ ├── literals.py.jinja2
│ │ │ ├── main.py.jinja2
│ │ │ ├── py.typed.jinja2
│ │ │ ├── submodules.py.jinja2
│ │ │ └── version.py.jinja2
│ │ └── setup.py.jinja2
│ ├── types-aioboto3-custom
│ │ ├── README.md.jinja2
│ │ ├── aioboto3-stubs
│ │ │ ├── py.typed.jinja2
│ │ │ └── session.pyi.jinja2
│ │ └── setup.py.jinja2
│ ├── types-aioboto3-docs
│ │ └── README.md.jinja2
│ ├── types-aioboto3-service-docs
│ │ ├── README.md.jinja2
│ │ ├── client.md.jinja2
│ │ ├── literals.md.jinja2
│ │ ├── paginators.md.jinja2
│ │ ├── service_resource.md.jinja2
│ │ ├── type_defs.md.jinja2
│ │ ├── usage.md.jinja2
│ │ └── waiters.md.jinja2
│ ├── types-aioboto3
│ │ ├── README.md.jinja2
│ │ ├── aioboto3-stubs
│ │ │ ├── py.typed.jinja2
│ │ │ └── session.pyi.jinja2
│ │ └── setup.py.jinja2
│ ├── types-aiobotocore-custom
│ │ ├── README.md.jinja2
│ │ ├── aiobotocore-stubs
│ │ │ ├── py.typed.jinja2
│ │ │ └── session.pyi.jinja2
│ │ └── setup.py.jinja2
│ ├── types-aiobotocore-docs
│ │ └── README.md.jinja2
│ ├── types-aiobotocore-full
│ │ ├── README.md.jinja2
│ │ └── setup.py.jinja2
│ ├── types-aiobotocore-service-docs
│ │ ├── README.md.jinja2
│ │ ├── client.md.jinja2
│ │ ├── literals.md.jinja2
│ │ ├── paginators.md.jinja2
│ │ ├── service_resource.md.jinja2
│ │ ├── type_defs.md.jinja2
│ │ ├── usage.md.jinja2
│ │ └── waiters.md.jinja2
│ ├── types-aiobotocore-service
│ │ ├── README.md.jinja2
│ │ ├── service
│ │ │ ├── __init__.pyi.jinja2
│ │ │ ├── __main__.py.jinja2
│ │ │ ├── client.pyi.jinja2
│ │ │ ├── literals.pyi.jinja2
│ │ │ ├── paginator.pyi.jinja2
│ │ │ ├── py.typed.jinja2
│ │ │ ├── service_resource.pyi.jinja2
│ │ │ ├── type_defs.pyi.jinja2
│ │ │ ├── version.py.jinja2
│ │ │ └── waiter.pyi.jinja2
│ │ └── setup.py.jinja2
│ ├── types-aiobotocore
│ │ ├── README.md.jinja2
│ │ ├── aiobotocore-stubs
│ │ │ ├── py.typed.jinja2
│ │ │ └── session.pyi.jinja2
│ │ └── setup.py.jinja2
│ ├── types-boto3-custom
│ │ ├── README.md.jinja2
│ │ ├── boto3-stubs
│ │ │ ├── __init__.pyi.jinja2
│ │ │ ├── py.typed.jinja2
│ │ │ └── session.pyi.jinja2
│ │ └── setup.py.jinja2
│ ├── types-boto3-docs
│ │ └── README.md.jinja2
│ ├── types-boto3-full
│ │ ├── README.md.jinja2
│ │ └── setup.py.jinja2
│ ├── types-boto3-service-docs
│ │ ├── README.md.jinja2
│ │ ├── client.md.jinja2
│ │ ├── literals.md.jinja2
│ │ ├── paginators.md.jinja2
│ │ ├── service_resource.md.jinja2
│ │ ├── type_defs.md.jinja2
│ │ ├── usage.md.jinja2
│ │ └── waiters.md.jinja2
│ ├── types-boto3-service
│ │ ├── README.md.jinja2
│ │ ├── service
│ │ │ ├── __init__.pyi.jinja2
│ │ │ ├── __main__.py.jinja2
│ │ │ ├── client.pyi.jinja2
│ │ │ ├── literals.pyi.jinja2
│ │ │ ├── paginator.pyi.jinja2
│ │ │ ├── py.typed.jinja2
│ │ │ ├── service_resource.pyi.jinja2
│ │ │ ├── type_defs.pyi.jinja2
│ │ │ ├── version.py.jinja2
│ │ │ └── waiter.pyi.jinja2
│ │ └── setup.py.jinja2
│ └── types-boto3
│ │ ├── README.md.jinja2
│ │ ├── boto3-stubs
│ │ ├── __init__.pyi.jinja2
│ │ ├── py.typed.jinja2
│ │ └── session.pyi.jinja2
│ │ └── setup.py.jinja2
├── type_annotations
│ ├── __init__.py
│ ├── external_import.py
│ ├── fake_annotation.py
│ ├── internal_import.py
│ ├── type.py
│ ├── type_annotation.py
│ ├── type_constant.py
│ ├── type_def_sortable.py
│ ├── type_literal.py
│ ├── type_parent.py
│ ├── type_subscript.py
│ ├── type_typed_dict.py
│ └── type_union.py
├── type_defs.py
├── type_maps
│ ├── __init__.py
│ ├── aio_resource_method_map.py
│ ├── argument_alias_map.py
│ ├── literal_type_map.py
│ ├── literals.py
│ ├── method_type_map.py
│ ├── named_unions.py
│ ├── required_attribute_map.py
│ ├── service_stub_map
│ │ ├── __init__.py
│ │ ├── dynamodb.py
│ │ ├── ec2.py
│ │ ├── rds.py
│ │ └── s3.py
│ ├── shape_type_map.py
│ └── typed_dicts.py
├── utils
│ ├── __init__.py
│ ├── boto3_utils.py
│ ├── botocore_changelog.py
│ ├── github.py
│ ├── install_requires.py
│ ├── jinja2.py
│ ├── lookup_dict.py
│ ├── markdown.py
│ ├── package_builder.py
│ ├── path.py
│ ├── pypi_manager.py
│ ├── strings.py
│ ├── type_checks.py
│ ├── type_def_sorter.py
│ ├── version.py
│ └── version_getters.py
└── writers
│ ├── __init__.py
│ ├── package_writer.py
│ ├── ruff_formatter.py
│ └── utils.py
├── pyproject.toml
├── requirements.mkdocs.txt
├── scripts
├── before_commit.sh
├── build.sh
├── build_aiobotocore_docs.sh
├── build_docs.sh
├── build_main.sh
├── check_output.py
├── ci.py
├── coverage.sh
├── docker.sh
├── dockerize.sh
├── get_services.js
├── install.sh
├── install_aiobotocore.sh
├── integration.py
├── open.sh
├── publish_types.sh
├── pull_static.py
├── pyproject.toml
├── pyrightconfig_output.json
└── release.py
├── tests
├── __init__.py
├── enums
│ ├── __init__.py
│ └── test_service_module_name.py
├── import_helpers
│ ├── __init__.py
│ ├── test_import_helper.py
│ ├── test_import_record.py
│ ├── test_import_record_group.py
│ ├── test_import_string.py
│ └── test_internal_import_record.py
├── parsers
│ ├── __init__.py
│ ├── test_parse_wrapper_package.py
│ ├── test_service_package.py
│ └── test_shape_parser.py
├── postprocessors
│ ├── __init__.py
│ └── test_botocore.py
├── structures
│ ├── __init__.py
│ ├── pacakges
│ │ ├── __init__.py
│ │ ├── test_mypy_boto3_package.py
│ │ └── test_service_package.py
│ ├── test_attribute.py
│ ├── test_class_record.py
│ ├── test_collection.py
│ ├── test_function.py
│ ├── test_method.py
│ ├── test_package.py
│ ├── test_package_url.py
│ ├── test_paginator.py
│ └── test_resource_record.py
├── test_cli_parser.py
├── test_constants.py
├── test_jinja_manager.py
├── test_main.py
├── test_service_name.py
├── type_annotations
│ ├── __init__.py
│ ├── test_external_import.py
│ ├── test_internal_import.py
│ ├── test_type_annotation.py
│ ├── test_type_constant.py
│ ├── test_type_literal.py
│ ├── test_type_subscript.py
│ ├── test_type_typed_dict.py
│ └── test_type_union.py
├── type_maps
│ ├── __init__.py
│ ├── test_argument_alias_type_map.py
│ ├── test_literal_type_map.py
│ ├── test_method_type_map.py
│ ├── test_required_attribute_map.py
│ └── test_shape_type_map.py
├── utils
│ ├── __init__.py
│ ├── fake_changelog.rst
│ ├── test_boto3_utils.py
│ ├── test_botocore_changelog.py
│ ├── test_jinja2.py
│ ├── test_lookup_dict.py
│ ├── test_markdown.py
│ ├── test_path.py
│ ├── test_strings.py
│ ├── test_type_checks.py
│ └── test_version.py
└── writers
│ ├── __init__.py
│ ├── test_ruff_formatter.py
│ └── test_utils.py
├── uv.lock
└── vulture_whitelist.txt
/.all-contributorsrc:
--------------------------------------------------------------------------------
1 | {
2 | "projectName": "mypy_boto3_builder",
3 | "projectOwner": "youtype"
4 | }
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | **
2 |
3 | !mypy_boto3_builder/**
4 | !scripts/**
5 | !README.md
6 | !pyproject.toml
7 | !LICENSE
8 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: youtype
2 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ""
5 | labels: "🐞 bug"
6 | assignees: ""
7 | ---
8 |
9 | **Describe the bug**
10 | A clear and concise description of what the bug is.
11 |
12 | **To Reproduce**
13 | Steps to reproduce the behavior:
14 |
15 | 1. Install `types-boto3[...]`
16 | 2. Run `mypy`/`pyright` on the following code sample
17 |
18 | ```python
19 | import boto3
20 |
21 | ...
22 | ```
23 |
24 | **Actual output**
25 |
26 | ```
27 | ...
28 | ```
29 |
30 | **Expected output**
31 |
32 | ```
33 | ...
34 | ```
35 |
36 | **Additional context**
37 | Your OS, `types-boto3` installation method, `boto3` version, etc.
38 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an improvement idea
4 | title: ""
5 | labels: "🚀 enhancement"
6 | assignees: ""
7 | ---
8 |
9 | **Describe your idea**
10 | A clear and concise description of what is needed.
11 |
12 | **Code sample**
13 | Provide a code sample to test the feature implementation.
14 |
15 | **Additional context**
16 | Your OS, `types-boto3` installation method, `boto3` version, etc.
17 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/vulnerability_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Vulnerability report
3 | about: Report a vulnerability in types-boto3, boto3-stubs, types-aiobotocore or types-aioboto3
4 | title: "Vulnerability report:"
5 | labels: "🐞 bug"
6 | assignees: ""
7 | ---
8 |
9 | **Describe the vulnerability**
10 | A clear and concise description of what the vulnerability is.
11 |
12 | **Additional context**
13 |
14 | Product: `types-boto3`/`boto3-stubs`/`types-aiobotocore`/`types-aioboto3`
15 | Version: `x.x.x`
16 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### Notes
2 |
3 | Please describe your changes here.
4 |
5 | ### Type of change
6 |
7 | - [ ] Bug fix (non-breaking change which fixes an issue)
8 | - [ ] New feature (non-breaking change which adds functionality)
9 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
10 |
11 | ### Checklist
12 |
13 | All of these are optional:
14 |
15 | - [ ] I have performed a self-review of my own code
16 | - [ ] I have run `./scripts/before_commit.sh` to follow the style guidelines of this project
17 | - [ ] I have tested my code changes
18 |
19 | Thank you!
20 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: "pip"
4 | directory: "/"
5 | schedule:
6 | interval: "weekly"
7 |
--------------------------------------------------------------------------------
/.github/workflows/on_push.yml:
--------------------------------------------------------------------------------
1 | name: "Test: style and tests"
2 |
3 | on:
4 | push: {}
5 | workflow_dispatch: {}
6 |
7 | jobs:
8 | unit-tests:
9 | name: "Test: style and tests"
10 | runs-on: ubuntu-latest
11 | strategy:
12 | matrix:
13 | version:
14 | - "3.12"
15 | - "3.13"
16 | - "3.14"
17 | steps:
18 | - uses: actions/checkout@v4
19 | - name: Set up Python
20 | uses: actions/setup-python@v5
21 | with:
22 | python-version: ${{ matrix.version }}
23 | allow-prereleases: true
24 | - name: Set up uv
25 | uses: astral-sh/setup-uv@v4
26 | with:
27 | version: "latest"
28 | enable-cache: true
29 | - name: Install the project
30 | run: uv sync --extra check --dev
31 | - name: Install extra dependencies
32 | run: uv pip install -U aioboto3
33 | - name: Run pre-commit
34 | run: uvx pre-commit run --all-files
35 |
--------------------------------------------------------------------------------
/.github/workflows/on_push_coverage.yml:
--------------------------------------------------------------------------------
1 | name: "Test: coverage report"
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | paths:
8 | - mypy_boto3_builder/**
9 | - tests/**
10 | workflow_dispatch: {}
11 |
12 | jobs:
13 | coverage:
14 | name: "Test: coverage report"
15 | runs-on: ubuntu-latest
16 | steps:
17 | - uses: actions/checkout@v4
18 | - name: Set up Python
19 | uses: actions/setup-python@v5
20 | with:
21 | python-version-file: .python-version
22 | - name: Set up uv
23 | uses: astral-sh/setup-uv@v4
24 | with:
25 | version: "latest"
26 | - name: Install the project
27 | run: uv sync --dev
28 | - name: Build coverage report
29 | run: uv run pytest --cov mypy_boto3_builder --cov-report=xml --junitxml=junit.xml
30 | - name: Upload coverage to Codecov
31 | uses: codecov/codecov-action@v4
32 | with:
33 | token: ${{ secrets.CODECOV_TOKEN }}
34 | - name: Upload test results to Codecov
35 | if: ${{ !cancelled() }}
36 | uses: codecov/test-results-action@v1
37 | with:
38 | token: ${{ secrets.CODECOV_TOKEN }}
39 |
--------------------------------------------------------------------------------
/.pre-commit-config.yaml:
--------------------------------------------------------------------------------
1 | repos:
2 | - repo: local
3 | hooks:
4 | - id: lint
5 | name: lint
6 | language: system
7 | pass_filenames: false
8 | entry: uvx ruff check --fix
9 | - id: format
10 | name: format
11 | language: system
12 | pass_filenames: false
13 | entry: uvx ruff format
14 | - id: vulture
15 | name: vulture
16 | language: system
17 | pass_filenames: false
18 | entry: uvx vulture
19 | - id: pyright
20 | name: pyright
21 | language: system
22 | pass_filenames: false
23 | entry: uv run pyright mypy_boto3_builder
24 | - id: mypy
25 | name: mypy
26 | language: system
27 | pass_filenames: false
28 | entry: uv run mypy mypy_boto3_builder
29 | - id: pytest
30 | name: pytest
31 | language: system
32 | pass_filenames: false
33 | entry: uv run pytest
34 |
--------------------------------------------------------------------------------
/.python-version:
--------------------------------------------------------------------------------
1 | 3.13
--------------------------------------------------------------------------------
/.readthedocs.yml:
--------------------------------------------------------------------------------
1 | # .readthedocs.yml
2 | # Read the Docs configuration file
3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4 |
5 | # Required
6 | version: 2
7 |
8 | build:
9 | os: ubuntu-22.04
10 | tools:
11 | python: "3.12"
12 |
13 | # Build documentation with MkDocs
14 | mkdocs:
15 | configuration: "mkdocs.yml"
16 | fail_on_warning: false
17 |
18 | # Build all formats
19 | formats: all
20 |
21 | python:
22 | install:
23 | - requirements: requirements.mkdocs.txt
24 |
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": [
3 | "samuelcolvin.jinjahtml",
4 | "tamasfe.even-better-toml",
5 | "charliermarsh.ruff",
6 | "ms-python.vscode-pylance"
7 | ]
8 | }
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "Python: Current File with profiler",
9 | "type": "debugpy",
10 | "request": "launch",
11 | "module": "cProfile",
12 | "console": "integratedTerminal",
13 | "args": [
14 | "-o",
15 | "/tmp/tmp.prof",
16 | "${file}"
17 | ]
18 | },
19 | {
20 | "name": "Python: Current File",
21 | "type": "debugpy",
22 | "request": "launch",
23 | "program": "${file}",
24 | "console": "integratedTerminal"
25 | }
26 | ]
27 | }
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "[python]": {
3 | "editor.formatOnSave": true,
4 | "editor.defaultFormatter": "charliermarsh.ruff",
5 | "editor.codeActionsOnSave": {
6 | "source.organizeImports": "explicit"
7 | }
8 | },
9 | "python.testing.unittestEnabled": false,
10 | "python.testing.pytestEnabled": true,
11 | "ruff.nativeServer": "on",
12 | "python.analysis.autoImportCompletions": true,
13 | "yaml.schemas": {
14 | "https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml"
15 | },
16 | "yaml.customTags": [
17 | "!ENV scalar",
18 | "!ENV sequence",
19 | "!relative scalar",
20 | "tag:yaml.org,2002:python/name:material.extensions.emoji.to_svg",
21 | "tag:yaml.org,2002:python/name:material.extensions.emoji.twemoji",
22 | "tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format"
23 | ],
24 | "files.exclude": {
25 | ".venv": true,
26 | ".mypy_cache": true,
27 | ".pytest_cache": true,
28 | "**/.ruff_cache": true,
29 | "*.egg-info": true,
30 | "build": true,
31 | "dist": true,
32 | "mypy_boto3_output": true,
33 | "**/__pycache__": true
34 | }
35 | }
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.13.0-alpine3.20
2 |
3 | RUN mkdir -p /home/builder/scripts
4 | RUN mkdir -p /output
5 | WORKDIR /home/builder
6 |
7 | COPY ./mypy_boto3_builder ./mypy_boto3_builder
8 | COPY ./LICENSE ./LICENSE
9 | COPY ./pyproject.toml ./pyproject.toml
10 | COPY ./README.md ./README.md
11 |
12 | RUN adduser \
13 | --disabled-password \
14 | --home /home/builder \
15 | builder
16 |
17 | USER builder
18 |
19 | ENV PATH "$PATH:/home/builder/.local/bin"
20 | RUN python -m pip install --no-cache-dir .
21 |
22 | COPY ./scripts/docker.sh ./scripts/docker.sh
23 |
24 | WORKDIR /output
25 |
26 | ENV BOTO3_VERSION ""
27 | ENV BOTOCORE_VERSION ""
28 |
29 | ENTRYPOINT ["/builder/scripts/docker.sh"]
30 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Vlad Emelianov
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include mypy_boto3_builder/py.typed
2 | include mypy_boto3_builder/templates/*/*.jinja2
3 | include mypy_boto3_builder/templates/*/*/*.jinja2
4 | include mypy_boto3_builder/stubs_static/*/*.pyi
5 | include mypy_boto3_builder/stubs_static/*/*/*.pyi
6 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Supported `types-boto3` versions
4 |
5 | | Version | Supported |
6 | | ------- | ------------------ |
7 | | 1.24.x | :white_check_mark: |
8 | | <= 1.23.x | :x: |
9 |
10 | ## Supported `boto3-stubs` versions
11 |
12 | | Version | Supported |
13 | | ------- | ------------------ |
14 | | 1.24.x | :white_check_mark: |
15 | | <= 1.23.x | :x: |
16 |
17 | ## Supported `types-aiobotocore` versions
18 |
19 | | Version | Supported |
20 | | ------- | ------------------ |
21 | | 2.3.x | :white_check_mark: |
22 | | <= 2.2.x | :x: |
23 |
24 | ## Supported `types-aioboto3` versions
25 |
26 | | Version | Supported |
27 | | ------- | ------------------ |
28 | | 9.6.x | :white_check_mark: |
29 | | <= 9.5.x | :x: |
30 |
31 | ## Reporting a Vulnerability
32 |
33 | Create a new [issue](https://github.com/youtype/mypy_boto3_builder/issues/new/choose) and use `Vulnerability report` template.
34 |
--------------------------------------------------------------------------------
/codecov.yml:
--------------------------------------------------------------------------------
1 | coverage:
2 | status:
3 | project:
4 | default:
5 | target: auto
6 | threshold: 0.5%
7 | patch: false
8 |
--------------------------------------------------------------------------------
/conftest.py:
--------------------------------------------------------------------------------
1 | from unittest.mock import MagicMock
2 |
3 | import pytest
4 | from pytest_mock import MockerFixture
5 |
6 | BOTOCORE_SESSION = MagicMock()
7 |
8 |
9 | @pytest.fixture(autouse=True)
10 | def botocore_session_mock(mocker: MockerFixture) -> MagicMock:
11 | mocker.patch("mypy_boto3_builder.utils.boto3_utils.get_session", return_value=BOTOCORE_SESSION)
12 | return BOTOCORE_SESSION
13 |
14 |
15 | @pytest.fixture(autouse=True)
16 | def import_version_mock(mocker: MockerFixture) -> MagicMock:
17 | return mocker.patch(
18 | "mypy_boto3_builder.utils.version_getters._import_version", return_value="1.2.3"
19 | )
20 |
--------------------------------------------------------------------------------
/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/demo.gif
--------------------------------------------------------------------------------
/docsmd/development.md:
--------------------------------------------------------------------------------
1 | # Development
2 |
3 | - Install [uv](https://docs.astral.sh/uv/): `curl -LsSf https://astral.sh/uv/install.sh | sh`
4 | - Install dependencies: `uv sync --all-extras --dev`
5 | - Use scripts for repo to check if everything works: `./scripts/build.sh`
6 | - Run manual pre-commit: `./scripts/before_commit.sh`
7 |
--------------------------------------------------------------------------------
/docsmd/how_it_works.md:
--------------------------------------------------------------------------------
1 | # How it works
2 |
3 | Fully automated [mypy-boto3-builder](https://github.com/youtype/mypy_boto3_builder) carefully generates
4 | type annotations for each service, patiently waiting for `boto3` updates. It delivers
5 | drop-in type annotations for you and makes sure that:
6 |
7 | - All available `botocore` services are covered.
8 | - Each public class and method of every `botocore` service gets valid type annotations
9 | extracted from `botocore` schemas.
10 | - Type annotations include up-to-date documentation.
11 | - Link to documentation is provided for every method.
12 | - Code is processed by [ruff](https://docs.astral.sh/ruff/) for readability.
13 |
--------------------------------------------------------------------------------
/docsmd/js/highlight.js:
--------------------------------------------------------------------------------
1 | document$.subscribe(() => {
2 | const navbar = document.querySelector('.md-sidebar--secondary')
3 | if (navbar.querySelectorAll('.md-nav__item').length > 1000) {
4 | navbar.style.display = 'none';
5 | }
6 |
7 | document.querySelectorAll('code').forEach(el => {
8 | setTimeout(() => {
9 | hljs.highlightElement(el)
10 | el.classList.remove('hljs')
11 | }, 0)
12 | })
13 | })
14 |
--------------------------------------------------------------------------------
/docsmd/thank_you.md:
--------------------------------------------------------------------------------
1 | # Thank you
2 |
3 | ## Toolset
4 |
5 | - [black](https://github.com/psf/black) developers for an awesome formatting tool
6 | - [Timothy Edmund Crosley](https://github.com/timothycrosley) for
7 | [isort](https://github.com/PyCQA/isort) and how flexible it is
8 | - [mypy](https://github.com/python/mypy) developers for doing all dirty work for us
9 | - [pyright](https://github.com/microsoft/pyright) team for the new era of typed Python
10 | - [ruff](https://github.com/astral-sh/ruff) developers for the fastest swiss knife for Python
11 |
12 | ## Contributors
13 |
14 | - [Allie Fitter](https://github.com/alliefitter), author of original
15 | [boto3-type-annotations](https://pypi.org/project/boto3-type-annotations/)
16 | - [jbpratt](https://github.com/jbpratt)
17 | - [Chris Hollinworth](https://github.com/chrishollinworth)
18 | - [Yoan Blanc](https://github.com/greut)
19 | - [Kostya Leschenko](https://github.com/kleschenko)
20 | - [pyto86](https://github.com/pyto86pri)
21 | - [Ashton Honnecke](https://github.com/ahonnecke)
22 | - [Mike Carey](https://github.com/mike-carey)
23 | - [Ole-Martin Bratteng](https://github.com/omBratteng)
24 | - [Nikhil Benesch](https://github.com/benesch)
25 | - [Maksym Balatsko](https://github.com/mbalatsko)
26 | - [Jacob](https://github.com/fivepapertigers)
27 | - [Jakob Keller](https://github.com/jakob-keller)
28 | - [Ari Pollak](https://github.com/aripollak)
29 |
--------------------------------------------------------------------------------
/examples/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/examples/__init__.py
--------------------------------------------------------------------------------
/examples/dynamodb_example.py:
--------------------------------------------------------------------------------
1 | """
2 | Usage example for `types-boto3-dynamodb` package.
3 |
4 | ```bash
5 | pip install `types-boto3[dynamodb]`
6 | mypy myproject
7 | pyright myproject
8 | ```
9 | """
10 |
11 | import decimal
12 |
13 | import boto3
14 | from boto3.dynamodb.conditions import Key
15 |
16 |
17 | def dynamodb_client_example() -> None:
18 | """
19 | Usage example for DynamoDBClient.
20 | """
21 | client = boto3.client("dynamodb")
22 | resource = boto3.resource("dynamodb")
23 |
24 | my_table = resource.Table("my_table")
25 | print(my_table.name)
26 | batch_writer = my_table.batch_writer()
27 | batch_writer.delete_item(Key={"HashKey": "123"})
28 |
29 | my_table.put_item(
30 | Item={
31 | "str": "value",
32 | "number": 123,
33 | "decimal": decimal.Decimal(123.2),
34 | "exception": ValueError("test"),
35 | }
36 | )
37 |
38 | try:
39 | client.list_backups(TableName=123)
40 | except client.exceptions.BackupInUseException as e:
41 | print(e)
42 |
43 | key_exp = Key("partition_key").eq("pk") & Key("time").between(888888, 999999)
44 | my_table.query(IndexName="my_table", FilterExpression=key_exp)
45 |
46 | keys = [{"pk": "abc", "sk": "def"}]
47 | resource.batch_get_item(RequestItems={"table": {"Keys": keys}})
48 |
49 |
50 | def main() -> None:
51 | """
52 | Run examples.
53 | """
54 | dynamodb_client_example()
55 |
--------------------------------------------------------------------------------
/examples/emr_example.py:
--------------------------------------------------------------------------------
1 | """
2 | Usage example for `types-boto3-emr` package.
3 |
4 | ```bash
5 | pip install `types-boto3[emr]`
6 | mypy myproject
7 | pyright myproject
8 | ```
9 | """
10 |
11 | import boto3
12 |
13 |
14 | def emr_client_example() -> None:
15 | """
16 | Usage example for EMRClient.
17 | """
18 | client = boto3.client("emr")
19 | client.cancel_steps(ClusterId="cluster_id", StepIds=[123])
20 |
21 | list_steps_paginator = client.get_paginator("list_steps")
22 | pages = list_steps_paginator.paginate(ClusterId="cluster_id")
23 | pages.build_full_result("test")
24 | for page in pages:
25 | print(page["Marker"])
26 | for step in page["steps"]:
27 | print(step)
28 |
29 |
30 | def main() -> None:
31 | """
32 | Run examples.
33 | """
34 | emr_client_example()
35 |
--------------------------------------------------------------------------------
/examples/iam_example.py:
--------------------------------------------------------------------------------
1 | """
2 | Usage example for `types-boto3-iam` package.
3 |
4 | ```bash
5 | pip install `types-boto3[iam]`
6 | mypy myproject
7 | pyright myproject
8 | ```
9 | """
10 |
11 | import boto3
12 |
13 |
14 | def iam_client_example() -> None:
15 | """
16 | Usage example for IAMClient.
17 | """
18 | client = boto3.client("iam")
19 | client.add_user_to_group(GroupName="group", UserName=123)
20 |
21 | list_steps_paginator = client.get_paginator("get_account_authorization_details")
22 | pages = list_steps_paginator.paginate(ClusterId="cluster_id")
23 | for page in pages:
24 | print(page["Marker"])
25 | for role in page["RoleDetail"]:
26 | print(role)
27 |
28 |
29 | def iam_resource_example() -> None:
30 | """
31 | Usage example for IAMServiceResource.
32 | """
33 | resource = boto3.resource("iam")
34 | group = resource.Group("my")
35 | group.add_user(UserName="my_user", Other=123)
36 |
37 |
38 | def main() -> None:
39 | """
40 | Run examples.
41 | """
42 | iam_client_example()
43 | iam_resource_example()
44 |
--------------------------------------------------------------------------------
/examples/secretsmanager_example.py:
--------------------------------------------------------------------------------
1 | """
2 | Usage example for `types-boto3-secretsmanager` package.
3 |
4 | ```bash
5 | pip install `types-boto3[secretsmanager]`
6 | mypy myproject
7 | pyright myproject
8 | ```
9 | """
10 |
11 | import boto3
12 |
13 |
14 | def secretsmanager_client_example() -> None:
15 | """
16 | Usage example for SecretsManagerClient.
17 | """
18 | client = boto3.client("secretsmanager")
19 | secret_value = client.get_secret(SecretId="secret_id")
20 | secret_value = client.get_secret_value(SecretId=123)
21 | print(secret_value)
22 |
23 |
24 | def main() -> None:
25 | """
26 | Run examples.
27 | """
28 | secretsmanager_client_example()
29 |
--------------------------------------------------------------------------------
/examples/sqs_example.py:
--------------------------------------------------------------------------------
1 | """
2 | Usage example for `types-boto3-sqs` package.
3 |
4 | ```bash
5 | pip install `types-boto3[sqs]`
6 | mypy myproject
7 | pyright myproject
8 | ```
9 | """
10 |
11 | import boto3
12 |
13 |
14 | def sqs_resource_example() -> None:
15 | """
16 | Usage example for SQSClient.
17 | """
18 | resource = boto3.resource(service_name="sqs")
19 |
20 | queue = resource.Queue("my_queue")
21 | message_list = queue.receive_messages()
22 | for message in message_list:
23 | message.delete(test=True)
24 |
25 |
26 | def main() -> None:
27 | """
28 | Run examples.
29 | """
30 | sqs_resource_example()
31 |
--------------------------------------------------------------------------------
/integration/boto3_stubs/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/integration/boto3_stubs/__init__.py
--------------------------------------------------------------------------------
/integration/boto3_stubs/emr_example.py:
--------------------------------------------------------------------------------
1 | """
2 | Integration test sample for `mypy-boto3-emr` package.
3 |
4 | ```bash
5 | pip install `boto3-stubs[emr]`
6 | mypy myproject
7 | pyright myproject
8 | ```
9 | """
10 |
11 | import boto3
12 |
13 |
14 | def emr_client_example() -> None:
15 | """
16 | Integration test sample for EMRClient.
17 | """
18 | client = boto3.client("emr")
19 | client.cancel_steps(ClusterId="cluster_id", StepIds=[123])
20 |
21 | list_steps_paginator = client.get_paginator("list_steps")
22 | pages = list_steps_paginator.paginate(ClusterId="cluster_id")
23 | pages.build_full_result("test")
24 | for page in pages:
25 | print(page["Marker"])
26 | for step in page["steps"]:
27 | print(step)
28 |
29 |
30 | def main() -> None:
31 | """
32 | Run examples.
33 | """
34 | emr_client_example()
35 |
--------------------------------------------------------------------------------
/integration/boto3_stubs/iam_example.py:
--------------------------------------------------------------------------------
1 | """
2 | Integration test sample for `mypy-boto3-iam` package.
3 |
4 | ```bash
5 | pip install `boto3-stubs[iam]`
6 | mypy myproject
7 | pyright myproject
8 | ```
9 | """
10 |
11 | import boto3
12 |
13 |
14 | def iam_client_example() -> None:
15 | """
16 | Integration test sample for IAMClient.
17 | """
18 | client = boto3.client("iam")
19 | client.add_user_to_group(GroupName="group", UserName=123)
20 |
21 | list_steps_paginator = client.get_paginator("get_account_authorization_details")
22 | pages = list_steps_paginator.paginate(ClusterId="cluster_id")
23 | for page in pages:
24 | print(page["Marker"])
25 | for role in page["RoleDetail"]:
26 | print(role)
27 |
28 |
29 | def iam_resource_example() -> None:
30 | """
31 | Integration test sample for IAMServiceResource.
32 | """
33 | resource = boto3.resource("iam")
34 | group = resource.Group("my")
35 | group.add_user(UserName="my_user", Other=123)
36 |
37 |
38 | def main() -> None:
39 | """
40 | Run examples.
41 | """
42 | iam_client_example()
43 | iam_resource_example()
44 |
--------------------------------------------------------------------------------
/integration/boto3_stubs/mypy/dynamodb_example.py.out:
--------------------------------------------------------------------------------
1 | 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]
2 | integration/boto3_stubs/dynamodb_example.py:39: error: Argument "TableName" to "list_backups" of "DynamoDBClient" has incompatible type "int"; expected "str" [arg-type]
3 | Found 2 errors in 1 file (checked 1 source file)
--------------------------------------------------------------------------------
/integration/boto3_stubs/mypy/ec2_example.py.out:
--------------------------------------------------------------------------------
1 | integration/boto3_stubs/ec2_example.py:29: error: Missing named argument "Resources" for "create_tags" of "EC2ServiceResource" [call-arg]
2 | integration/boto3_stubs/ec2_example.py:29: error: Argument "Tags" to "create_tags" of "EC2ServiceResource" has incompatible type "int"; expected "Sequence[TagTypeDef]" [arg-type]
3 | integration/boto3_stubs/ec2_example.py:33: error: Argument "DryRun" to "delete" of "Vpc" has incompatible type "str"; expected "bool" [arg-type]
4 | integration/boto3_stubs/ec2_example.py:37: error: Incompatible types (expression has type "int", TypedDict item "Key" has type "str") [typeddict-item]
5 | integration/boto3_stubs/ec2_example.py:48: error: Incompatible types (expression has type "int", TypedDict item "Key" has type "str") [typeddict-item]
6 | Found 5 errors in 1 file (checked 1 source file)
--------------------------------------------------------------------------------
/integration/boto3_stubs/mypy/emr_example.py.out:
--------------------------------------------------------------------------------
1 | integration/boto3_stubs/emr_example.py:19: error: List item 0 has incompatible type "int"; expected "str" [list-item]
2 | integration/boto3_stubs/emr_example.py:23: error: Too many arguments for "build_full_result" of "PageIterator" [call-arg]
3 | integration/boto3_stubs/emr_example.py:26: error: TypedDict "ListStepsOutputTypeDef" has no key "steps" [typeddict-item]
4 | integration/boto3_stubs/emr_example.py:26: note: Did you mean "Steps"?
5 | Found 3 errors in 1 file (checked 1 source file)
--------------------------------------------------------------------------------
/integration/boto3_stubs/mypy/iam_example.py.out:
--------------------------------------------------------------------------------
1 | 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]
2 | integration/boto3_stubs/iam_example.py:22: error: Unexpected keyword argument "ClusterId" for "paginate" of "GetAccountAuthorizationDetailsPaginator" [call-arg]
3 | integration/boto3_stubs/iam_example.py:25: error: TypedDict "GetAccountAuthorizationDetailsResponseTypeDef" has no key "RoleDetail" [typeddict-item]
4 | integration/boto3_stubs/iam_example.py:25: note: Did you mean "RoleDetailList"?
5 | integration/boto3_stubs/iam_example.py:35: error: Unexpected keyword argument "Other" for "add_user" of "Group" [call-arg]
6 | Found 4 errors in 1 file (checked 1 source file)
--------------------------------------------------------------------------------
/integration/boto3_stubs/mypy/secretsmanager_example.py.out:
--------------------------------------------------------------------------------
1 | integration/boto3_stubs/secretsmanager_example.py:19: error: "SecretsManagerClient" has no attribute "get_secret"; maybe "create_secret", "delete_secret", or "get_secret_value"? [attr-defined]
2 | integration/boto3_stubs/secretsmanager_example.py:20: error: Argument "SecretId" to "get_secret_value" of "SecretsManagerClient" has incompatible type "int"; expected "str" [arg-type]
3 | Found 2 errors in 1 file (checked 1 source file)
--------------------------------------------------------------------------------
/integration/boto3_stubs/mypy/sqs_example.py.out:
--------------------------------------------------------------------------------
1 | integration/boto3_stubs/sqs_example.py:23: error: Unexpected keyword argument "test" for "delete" of "Message" [call-arg]
2 | Found 1 error in 1 file (checked 1 source file)
--------------------------------------------------------------------------------
/integration/boto3_stubs/pyright/iam_example.py.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "severity": "error",
4 | "message": "Argument of type \"Literal[123]\" cannot be assigned to parameter \"UserName\" of type \"str\" in function \"add_user_to_group\"\n\u00a0\u00a0\"Literal[123]\" is not assignable to \"str\"",
5 | "range": {
6 | "start": {
7 | "line": 18,
8 | "character": 57
9 | },
10 | "end": {
11 | "line": 18,
12 | "character": 60
13 | }
14 | },
15 | "rule": "reportArgumentType"
16 | },
17 | {
18 | "severity": "error",
19 | "message": "No parameter named \"ClusterId\"",
20 | "range": {
21 | "start": {
22 | "line": 21,
23 | "character": 42
24 | },
25 | "end": {
26 | "line": 21,
27 | "character": 51
28 | }
29 | },
30 | "rule": "reportCallIssue"
31 | },
32 | {
33 | "severity": "error",
34 | "message": "No parameter named \"Other\"",
35 | "range": {
36 | "start": {
37 | "line": 34,
38 | "character": 39
39 | },
40 | "end": {
41 | "line": 34,
42 | "character": 44
43 | }
44 | },
45 | "rule": "reportCallIssue"
46 | }
47 | ]
--------------------------------------------------------------------------------
/integration/boto3_stubs/pyright/secretsmanager_example.py.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "severity": "error",
4 | "message": "Cannot access attribute \"get_secret\" for class \"SecretsManagerClient\"\n\u00a0\u00a0Attribute \"get_secret\" is unknown",
5 | "range": {
6 | "start": {
7 | "line": 18,
8 | "character": 26
9 | },
10 | "end": {
11 | "line": 18,
12 | "character": 36
13 | }
14 | },
15 | "rule": "reportAttributeAccessIssue"
16 | },
17 | {
18 | "severity": "error",
19 | "message": "Argument of type \"Literal[123]\" cannot be assigned to parameter \"SecretId\" of type \"str\" in function \"get_secret_value\"\n\u00a0\u00a0\"Literal[123]\" is not assignable to \"str\"",
20 | "range": {
21 | "start": {
22 | "line": 19,
23 | "character": 52
24 | },
25 | "end": {
26 | "line": 19,
27 | "character": 55
28 | }
29 | },
30 | "rule": "reportArgumentType"
31 | }
32 | ]
--------------------------------------------------------------------------------
/integration/boto3_stubs/pyright/sqs_example.py.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "severity": "error",
4 | "message": "No parameter named \"test\"",
5 | "range": {
6 | "start": {
7 | "line": 22,
8 | "character": 23
9 | },
10 | "end": {
11 | "line": 22,
12 | "character": 27
13 | }
14 | },
15 | "rule": "reportCallIssue"
16 | }
17 | ]
--------------------------------------------------------------------------------
/integration/boto3_stubs/secretsmanager_example.py:
--------------------------------------------------------------------------------
1 | """
2 | Integration test sample for `mypy-boto3-secretsmanager` package.
3 |
4 | ```bash
5 | pip install `boto3-stubs[secretsmanager]`
6 | mypy myproject
7 | pyright myproject
8 | ```
9 | """
10 |
11 | import boto3
12 |
13 |
14 | def secretsmanager_client_example() -> None:
15 | """
16 | Integration test sample for SecretsManagerClient.
17 | """
18 | client = boto3.client("secretsmanager")
19 | secret_value = client.get_secret(SecretId="secret_id")
20 | secret_value = client.get_secret_value(SecretId=123)
21 | print(secret_value)
22 |
23 |
24 | def main() -> None:
25 | """
26 | Run examples.
27 | """
28 | secretsmanager_client_example()
29 |
--------------------------------------------------------------------------------
/integration/boto3_stubs/sqs_example.py:
--------------------------------------------------------------------------------
1 | """
2 | Integration test sample for `mypy-boto3-sqs` package.
3 |
4 | ```bash
5 | pip install `boto3-stubs[sqs]`
6 | mypy myproject
7 | pyright myproject
8 | ```
9 | """
10 |
11 | import boto3
12 |
13 |
14 | def sqs_resource_example() -> None:
15 | """
16 | Integration test sample for SQSClient.
17 | """
18 | resource = boto3.resource(service_name="sqs")
19 |
20 | queue = resource.Queue("my_queue")
21 | message_list = queue.receive_messages()
22 | for message in message_list:
23 | message.delete(test=True)
24 |
25 |
26 | def main() -> None:
27 | """
28 | Run examples.
29 | """
30 | sqs_resource_example()
31 |
--------------------------------------------------------------------------------
/integration/boto3_stubs_lite/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/integration/boto3_stubs_lite/__init__.py
--------------------------------------------------------------------------------
/integration/types_aioboto3/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/integration/types_aioboto3/__init__.py
--------------------------------------------------------------------------------
/integration/types_aioboto3_lite/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/integration/types_aioboto3_lite/__init__.py
--------------------------------------------------------------------------------
/integration/types_aiobotocore/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/integration/types_aiobotocore/__init__.py
--------------------------------------------------------------------------------
/integration/types_aiobotocore_lite/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/integration/types_aiobotocore_lite/__init__.py
--------------------------------------------------------------------------------
/integration/types_boto3/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/integration/types_boto3/__init__.py
--------------------------------------------------------------------------------
/integration/types_boto3/emr_example.py:
--------------------------------------------------------------------------------
1 | """
2 | Integration test sample for `types-boto3-emr` package.
3 |
4 | ```bash
5 | pip install `types-boto3[emr]`
6 | mypy myproject
7 | pyright myproject
8 | ```
9 | """
10 |
11 | import boto3
12 |
13 |
14 | def emr_client_example() -> None:
15 | """
16 | Integration test sample for EMRClient.
17 | """
18 | client = boto3.client("emr")
19 | client.cancel_steps(ClusterId="cluster_id", StepIds=[123])
20 |
21 | list_steps_paginator = client.get_paginator("list_steps")
22 | pages = list_steps_paginator.paginate(ClusterId="cluster_id")
23 | pages.build_full_result("test")
24 | for page in pages:
25 | print(page["Marker"])
26 | for step in page["steps"]:
27 | print(step)
28 |
29 |
30 | def main() -> None:
31 | """
32 | Run examples.
33 | """
34 | emr_client_example()
35 |
--------------------------------------------------------------------------------
/integration/types_boto3/iam_example.py:
--------------------------------------------------------------------------------
1 | """
2 | Integration test sample for `types-boto3-iam` package.
3 |
4 | ```bash
5 | pip install `types-boto3[iam]`
6 | mypy myproject
7 | pyright myproject
8 | ```
9 | """
10 |
11 | import boto3
12 |
13 |
14 | def iam_client_example() -> None:
15 | """
16 | Integration test sample for IAMClient.
17 | """
18 | client = boto3.client("iam")
19 | client.add_user_to_group(GroupName="group", UserName=123)
20 |
21 | list_steps_paginator = client.get_paginator("get_account_authorization_details")
22 | pages = list_steps_paginator.paginate(ClusterId="cluster_id")
23 | for page in pages:
24 | print(page["Marker"])
25 | for role in page["RoleDetail"]:
26 | print(role)
27 |
28 |
29 | def iam_resource_example() -> None:
30 | """
31 | Integration test sample for IAMServiceResource.
32 | """
33 | resource = boto3.resource("iam")
34 | group = resource.Group("my")
35 | group.add_user(UserName="my_user", Other=123)
36 |
37 |
38 | def main() -> None:
39 | """
40 | Run examples.
41 | """
42 | iam_client_example()
43 | iam_resource_example()
44 |
--------------------------------------------------------------------------------
/integration/types_boto3/mypy/dynamodb_example.py.out:
--------------------------------------------------------------------------------
1 | integration/types_boto3/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]
2 | integration/types_boto3/dynamodb_example.py:39: error: Argument "TableName" to "list_backups" of "DynamoDBClient" has incompatible type "int"; expected "str" [arg-type]
3 | Found 2 errors in 1 file (checked 1 source file)
--------------------------------------------------------------------------------
/integration/types_boto3/mypy/ec2_example.py.out:
--------------------------------------------------------------------------------
1 | integration/types_boto3/ec2_example.py:29: error: Missing named argument "Resources" for "create_tags" of "EC2ServiceResource" [call-arg]
2 | integration/types_boto3/ec2_example.py:29: error: Argument "Tags" to "create_tags" of "EC2ServiceResource" has incompatible type "int"; expected "Sequence[TagTypeDef]" [arg-type]
3 | integration/types_boto3/ec2_example.py:33: error: Argument "DryRun" to "delete" of "Vpc" has incompatible type "str"; expected "bool" [arg-type]
4 | integration/types_boto3/ec2_example.py:37: error: Incompatible types (expression has type "int", TypedDict item "Key" has type "str") [typeddict-item]
5 | integration/types_boto3/ec2_example.py:48: error: Incompatible types (expression has type "int", TypedDict item "Key" has type "str") [typeddict-item]
6 | Found 5 errors in 1 file (checked 1 source file)
--------------------------------------------------------------------------------
/integration/types_boto3/mypy/emr_example.py.out:
--------------------------------------------------------------------------------
1 | integration/types_boto3/emr_example.py:19: error: List item 0 has incompatible type "int"; expected "str" [list-item]
2 | integration/types_boto3/emr_example.py:23: error: Too many arguments for "build_full_result" of "PageIterator" [call-arg]
3 | integration/types_boto3/emr_example.py:26: error: TypedDict "ListStepsOutputTypeDef" has no key "steps" [typeddict-item]
4 | integration/types_boto3/emr_example.py:26: note: Did you mean "Steps"?
5 | Found 3 errors in 1 file (checked 1 source file)
--------------------------------------------------------------------------------
/integration/types_boto3/mypy/iam_example.py.out:
--------------------------------------------------------------------------------
1 | integration/types_boto3/iam_example.py:19: error: Argument "UserName" to "add_user_to_group" of "IAMClient" has incompatible type "int"; expected "str" [arg-type]
2 | integration/types_boto3/iam_example.py:22: error: Unexpected keyword argument "ClusterId" for "paginate" of "GetAccountAuthorizationDetailsPaginator" [call-arg]
3 | integration/types_boto3/iam_example.py:25: error: TypedDict "GetAccountAuthorizationDetailsResponseTypeDef" has no key "RoleDetail" [typeddict-item]
4 | integration/types_boto3/iam_example.py:25: note: Did you mean "RoleDetailList"?
5 | integration/types_boto3/iam_example.py:35: error: Unexpected keyword argument "Other" for "add_user" of "Group" [call-arg]
6 | Found 4 errors in 1 file (checked 1 source file)
--------------------------------------------------------------------------------
/integration/types_boto3/mypy/secretsmanager_example.py.out:
--------------------------------------------------------------------------------
1 | integration/types_boto3/secretsmanager_example.py:19: error: "SecretsManagerClient" has no attribute "get_secret"; maybe "create_secret", "delete_secret", or "get_secret_value"? [attr-defined]
2 | integration/types_boto3/secretsmanager_example.py:20: error: Argument "SecretId" to "get_secret_value" of "SecretsManagerClient" has incompatible type "int"; expected "str" [arg-type]
3 | Found 2 errors in 1 file (checked 1 source file)
--------------------------------------------------------------------------------
/integration/types_boto3/mypy/sqs_example.py.out:
--------------------------------------------------------------------------------
1 | integration/types_boto3/sqs_example.py:23: error: Unexpected keyword argument "test" for "delete" of "Message" [call-arg]
2 | Found 1 error in 1 file (checked 1 source file)
--------------------------------------------------------------------------------
/integration/types_boto3/pyright/iam_example.py.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "severity": "error",
4 | "message": "Argument of type \"Literal[123]\" cannot be assigned to parameter \"UserName\" of type \"str\" in function \"add_user_to_group\"\n\u00a0\u00a0\"Literal[123]\" is not assignable to \"str\"",
5 | "range": {
6 | "start": {
7 | "line": 18,
8 | "character": 57
9 | },
10 | "end": {
11 | "line": 18,
12 | "character": 60
13 | }
14 | },
15 | "rule": "reportArgumentType"
16 | },
17 | {
18 | "severity": "error",
19 | "message": "No parameter named \"ClusterId\"",
20 | "range": {
21 | "start": {
22 | "line": 21,
23 | "character": 42
24 | },
25 | "end": {
26 | "line": 21,
27 | "character": 51
28 | }
29 | },
30 | "rule": "reportCallIssue"
31 | },
32 | {
33 | "severity": "error",
34 | "message": "No parameter named \"Other\"",
35 | "range": {
36 | "start": {
37 | "line": 34,
38 | "character": 39
39 | },
40 | "end": {
41 | "line": 34,
42 | "character": 44
43 | }
44 | },
45 | "rule": "reportCallIssue"
46 | }
47 | ]
--------------------------------------------------------------------------------
/integration/types_boto3/pyright/secretsmanager_example.py.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "severity": "error",
4 | "message": "Cannot access attribute \"get_secret\" for class \"SecretsManagerClient\"\n\u00a0\u00a0Attribute \"get_secret\" is unknown",
5 | "range": {
6 | "start": {
7 | "line": 18,
8 | "character": 26
9 | },
10 | "end": {
11 | "line": 18,
12 | "character": 36
13 | }
14 | },
15 | "rule": "reportAttributeAccessIssue"
16 | },
17 | {
18 | "severity": "error",
19 | "message": "Argument of type \"Literal[123]\" cannot be assigned to parameter \"SecretId\" of type \"str\" in function \"get_secret_value\"\n\u00a0\u00a0\"Literal[123]\" is not assignable to \"str\"",
20 | "range": {
21 | "start": {
22 | "line": 19,
23 | "character": 52
24 | },
25 | "end": {
26 | "line": 19,
27 | "character": 55
28 | }
29 | },
30 | "rule": "reportArgumentType"
31 | }
32 | ]
--------------------------------------------------------------------------------
/integration/types_boto3/pyright/sqs_example.py.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "severity": "error",
4 | "message": "No parameter named \"test\"",
5 | "range": {
6 | "start": {
7 | "line": 22,
8 | "character": 23
9 | },
10 | "end": {
11 | "line": 22,
12 | "character": 27
13 | }
14 | },
15 | "rule": "reportCallIssue"
16 | }
17 | ]
--------------------------------------------------------------------------------
/integration/types_boto3/secretsmanager_example.py:
--------------------------------------------------------------------------------
1 | """
2 | Integration test sample for `types-boto3-secretsmanager` package.
3 |
4 | ```bash
5 | pip install `types-boto3[secretsmanager]`
6 | mypy myproject
7 | pyright myproject
8 | ```
9 | """
10 |
11 | import boto3
12 |
13 |
14 | def secretsmanager_client_example() -> None:
15 | """
16 | Integration test sample for SecretsManagerClient.
17 | """
18 | client = boto3.client("secretsmanager")
19 | secret_value = client.get_secret(SecretId="secret_id")
20 | secret_value = client.get_secret_value(SecretId=123)
21 | print(secret_value)
22 |
23 |
24 | def main() -> None:
25 | """
26 | Run examples.
27 | """
28 | secretsmanager_client_example()
29 |
--------------------------------------------------------------------------------
/integration/types_boto3/sqs_example.py:
--------------------------------------------------------------------------------
1 | """
2 | Integration test sample for `types-boto3-sqs` package.
3 |
4 | ```bash
5 | pip install `types-boto3[sqs]`
6 | mypy myproject
7 | pyright myproject
8 | ```
9 | """
10 |
11 | import boto3
12 |
13 |
14 | def sqs_resource_example() -> None:
15 | """
16 | Integration test sample for SQSClient.
17 | """
18 | resource = boto3.resource(service_name="sqs")
19 |
20 | queue = resource.Queue("my_queue")
21 | message_list = queue.receive_messages()
22 | for message in message_list:
23 | message.delete(test=True)
24 |
25 |
26 | def main() -> None:
27 | """
28 | Run examples.
29 | """
30 | sqs_resource_example()
31 |
--------------------------------------------------------------------------------
/integration/types_boto3_lite/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/integration/types_boto3_lite/__init__.py
--------------------------------------------------------------------------------
/istub_aio.yml:
--------------------------------------------------------------------------------
1 | packages:
2 | - name: aioboto3
3 | path: mypy_boto3_output/types_aioboto3_lite_package
4 | checks:
5 | mypy: true
6 | stubtest: true
7 | flake8: false
8 | pyright: true
9 | install:
10 | - mypy_boto3_output/types_aiobotocore_lite_package
11 | - mypy_boto3_output/types_aioboto3_lite_package
12 | - mypy_boto3_output/boto3_stubs_lite_package
13 | pip_install:
14 | - aiobotocore
15 | - aioboto3
16 | - chalice
17 | pip_uninstall:
18 | - types-aioboto3
19 | - types-aiobotocore
20 | build:
21 | - mypy_boto3_builder ./mypy_boto3_output --product aioboto3 aiobotocore boto3
22 | - name: aiobotocore
23 | path: mypy_boto3_output/types_aiobotocore_lite_package
24 | checks:
25 | mypy: true
26 | stubtest: true
27 | flake8: false
28 | pyright: true
29 | install:
30 | - mypy_boto3_output/types_aiobotocore_lite_package
31 | pip_install:
32 | - aiobotocore
33 | pip_uninstall:
34 | - types-aiobotocore
35 | build:
36 | - mypy_boto3_builder ./mypy_boto3_output --product aiobotocore boto3
37 |
--------------------------------------------------------------------------------
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/logo.png
--------------------------------------------------------------------------------
/mkdocs.yml:
--------------------------------------------------------------------------------
1 | site_name: "Mypy Boto3 Builder"
2 | repo_url: "https://github.com/youtype/mypy_boto3_builder/"
3 | site_dir: "docs"
4 | docs_dir: "docsmd"
5 |
6 | theme:
7 | name: material
8 | icon:
9 | logo: material/file-check-outline
10 | palette:
11 | - scheme: slate
12 | primary: blue
13 | accent: blue
14 | toggle:
15 | icon: material/toggle-switch
16 | name: Switch to light mode
17 | - scheme: default
18 | toggle:
19 | icon: material/toggle-switch-off-outline
20 | name: Switch to dark mode
21 | features:
22 | - navigation.expand
23 | - navigation.instant
24 | - navigation.tracking
25 | - content.code.annotate
26 | markdown_extensions:
27 | - admonition
28 | - pymdownx.details
29 | - pymdownx.tabbed:
30 | alternate_style: true
31 | - pymdownx.highlight:
32 | use_pygments: false
33 | anchor_linenums: true
34 | - pymdownx.inlinehilite
35 | - pymdownx.snippets
36 | - pymdownx.superfences
37 | - pymdownx.emoji:
38 | emoji_index: !!python/name:material.extensions.emoji.twemoji
39 | emoji_generator: !!python/name:material.extensions.emoji.to_svg
40 | - toc:
41 | permalink: "#"
42 | extra_javascript:
43 | - https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/highlight.min.js
44 | - js/highlight.js
45 | extra_css:
46 | - https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/styles/stackoverflow-dark.min.css
47 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Main library entrypoint.
3 | """
4 |
5 | from mypy_boto3_builder.logger import disable_logger
6 |
7 | disable_logger()
8 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/__main__.py:
--------------------------------------------------------------------------------
1 | """
2 | Main entrypoint for module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from mypy_boto3_builder.main import main
8 |
9 | if __name__ == "__main__":
10 | main()
11 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/boto3_ports/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Files vendored from boto3 package.
3 | """
4 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/chat/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Chat CLI interface.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/chat/prompts/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Prompts based on questionary.
3 | """
4 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/chat/type_defs.py:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for Chat.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from __future__ import annotations
8 |
9 | from collections.abc import MutableSequence
10 |
11 | from mypy_boto3_builder.chat.text_style import TextStyle
12 |
13 | MessagePair = tuple[TextStyle, str]
14 | MessageToken = MessagePair | str
15 | Message = tuple[MessageToken, ...] | MutableSequence[MessageToken]
16 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/chat/utils.py:
--------------------------------------------------------------------------------
1 | """
2 | Message-related utils.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from mypy_boto3_builder.chat.type_defs import Message
8 |
9 |
10 | def as_string(message: Message | list[tuple[str, str]] | str) -> str:
11 | """
12 | Convert message to string.
13 | """
14 | if isinstance(message, str):
15 | return message
16 | result = (item if isinstance(item, str) else item[1] for item in message)
17 | return "".join(result)
18 |
19 |
20 | def as_message(message: Message | str) -> Message:
21 | """
22 | Convert message or string to Message.
23 | """
24 | if not message:
25 | return ()
26 | if isinstance(message, str):
27 | return (message,)
28 |
29 | return message
30 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/debug.py:
--------------------------------------------------------------------------------
1 | """
2 | Profiling entrypoint.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from pathlib import Path
8 |
9 | from mypy_boto3_builder.cli_parser import CLINamespace
10 | from mypy_boto3_builder.enums.output_type import OutputType
11 | from mypy_boto3_builder.enums.product import Product
12 | from mypy_boto3_builder.main import run
13 |
14 |
15 | def main() -> None:
16 | """
17 | Profiling entrypoint.
18 | """
19 | args = CLINamespace(
20 | log_level=0,
21 | output_path=Path("./mypy_boto3_output"),
22 | service_names=["acm"],
23 | build_version="1.0.0",
24 | output_types=[OutputType.package],
25 | products=[Product.boto3_stubs_services],
26 | list_services=False,
27 | partial_overload=False,
28 | skip_published=False,
29 | disable_smart_version=True,
30 | download_static_stubs=False,
31 | )
32 | run(args)
33 |
34 |
35 | if __name__ == "__main__":
36 | main()
37 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/enums/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Different helpful enums.
3 | """
4 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/enums/output_type.py:
--------------------------------------------------------------------------------
1 | """
2 | Output type choice for CLI.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from enum import Enum
8 |
9 |
10 | class OutputType(Enum):
11 | """
12 | Output type choice for CLI.
13 | """
14 |
15 | package = "package"
16 | wheel = "wheel"
17 | sdist = "sdist"
18 | installed = "installed"
19 |
20 | def is_installed(self) -> bool:
21 | """
22 | Whether output type is a ready-to-use directory.
23 | """
24 | return self is OutputType.installed
25 |
26 | def is_packaged(self) -> bool:
27 | """
28 | Whether output type is packaged for installation.
29 | """
30 | return self is OutputType.wheel or self is OutputType.sdist
31 |
32 | def is_preserved(self) -> bool:
33 | """
34 | Check if output is preserved.
35 | """
36 | return not self.is_packaged()
37 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/enums/product_library.py:
--------------------------------------------------------------------------------
1 | """
2 | Product library choice for CLI.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from enum import Enum
8 |
9 |
10 | class ProductLibrary(Enum):
11 | """
12 | Product library choice for CLI.
13 | """
14 |
15 | boto3 = "boto3"
16 | boto3_legacy = "boto3-legacy"
17 | aiobotocore = "aiobotocore"
18 | aioboto3 = "aioboto3"
19 | mypy_boto3 = "mypy_boto3"
20 |
21 | def get_library_name(self) -> str:
22 | """
23 | Get library name.
24 | """
25 | match self:
26 | case ProductLibrary.boto3 | ProductLibrary.boto3_legacy | ProductLibrary.mypy_boto3:
27 | return "boto3"
28 | case ProductLibrary.aiobotocore:
29 | return "aiobotocore"
30 | case ProductLibrary.aioboto3:
31 | return "aioboto3"
32 |
33 | def get_chat_choice(self) -> str:
34 | """
35 | Get chat choice.
36 | """
37 | match self:
38 | case ProductLibrary.boto3 | ProductLibrary.mypy_boto3:
39 | return "boto3"
40 | case ProductLibrary.boto3_legacy:
41 | return "boto3-stubs"
42 | case ProductLibrary.aiobotocore:
43 | return "aiobotocore"
44 | case ProductLibrary.aioboto3:
45 | return "aioboto3"
46 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/enums/product_type.py:
--------------------------------------------------------------------------------
1 | """
2 | Product type choice for CLI.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from enum import Enum
8 |
9 |
10 | class ProductType(Enum):
11 | """
12 | Product type choice for CLI.
13 | """
14 |
15 | stubs = "stubs"
16 | stubs_lite = "stubs_lite"
17 | service_stubs = "service_stubs"
18 | docs = "docs"
19 | full = "full"
20 | custom = "custom"
21 | boto34 = "boto34"
22 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/enums/service_module_name.py:
--------------------------------------------------------------------------------
1 | """
2 | Enum for service modules.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from enum import Enum
8 |
9 |
10 | class ServiceModuleName(Enum):
11 | """
12 | Enum for service modules.
13 | """
14 |
15 | client = "client"
16 | service_resource = "service_resource"
17 | paginator = "paginator"
18 | waiter = "waiter"
19 | type_defs = "type_defs"
20 | literals = "literals"
21 |
22 | @property
23 | def stub_file_name(self) -> str:
24 | """
25 | Module file name.
26 | """
27 | return f"{self.value}.pyi"
28 |
29 | @property
30 | def file_name(self) -> str:
31 | """
32 | Module file name.
33 | """
34 | return f"{self.value}.py"
35 |
36 | @property
37 | def template_name(self) -> str:
38 | """
39 | Module template file name.
40 | """
41 | return f"{self.value}.pyi.jinja2"
42 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/exceptions.py:
--------------------------------------------------------------------------------
1 | """
2 | Exceptions for mypy_boto3_builder.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 |
8 | class BuilderError(ValueError):
9 | """
10 | Base error for mypy_boto3_builder.
11 | """
12 |
13 |
14 | class JinjaManagerError(BuilderError):
15 | """
16 | Base JinjaManager exception.
17 | """
18 |
19 |
20 | class ShapeParserError(BuilderError):
21 | """
22 | Main error for ShapeParser.
23 | """
24 |
25 |
26 | class BuildError(BuilderError):
27 | """
28 | Error during build process.
29 | """
30 |
31 |
32 | class BuildEnvError(BuildError):
33 | """
34 | Error during getting 3rd party data.
35 | """
36 |
37 |
38 | class BuildInternalError(BuildError):
39 | """
40 | Error on invalid build.
41 | """
42 |
43 |
44 | class TypeAnnotationError(BuildInternalError):
45 | """
46 | Error on invalid internal type annotation.
47 | """
48 |
49 |
50 | class StructureError(BuildInternalError):
51 | """
52 | Error on invalid internal structure.
53 | """
54 |
55 |
56 | class AlreadyPublishedError(BuildInternalError):
57 | """
58 | Error on already published package.
59 | """
60 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/generators/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Stubs and docs generators.
3 | """
4 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/import_helpers/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Various import-related helpers.
3 | """
4 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/import_helpers/import_parent.py:
--------------------------------------------------------------------------------
1 | """
2 | Enum with all parent imports.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from enum import Enum
8 | from typing import Final
9 |
10 |
11 | class ImportParent(Enum):
12 | """
13 | Enum with all parent imports.
14 | """
15 |
16 | future = "__future__"
17 | builtins = "builtins"
18 | boto3 = "boto3"
19 | botocore = "botocore"
20 | typing = "typing"
21 | awscrt = "awscrt"
22 | s3transfer = "s3transfer"
23 | aiobotocore = "aiobotocore"
24 | aioboto3 = "aioboto3"
25 | typing_extensions = "typing_extensions"
26 | types = "types"
27 | sys = "sys"
28 | collections = "collections"
29 |
30 | @classmethod
31 | def is_third_party(cls, parent_name: str) -> bool:
32 | """
33 | Whether import is from 3rd party module.
34 | """
35 | return parent_name in _THIRD_PARTY
36 |
37 | @classmethod
38 | def is_builtins(cls, parent_name: str) -> bool:
39 | """
40 | Whether import is from Python `builtins` module.
41 | """
42 | return parent_name == cls.builtins.value
43 |
44 |
45 | _THIRD_PARTY: Final = frozenset(
46 | (
47 | ImportParent.boto3.value,
48 | ImportParent.botocore.value,
49 | ImportParent.aioboto3.value,
50 | ImportParent.aiobotocore.value,
51 | ImportParent.s3transfer.value,
52 | ImportParent.awscrt.value,
53 | )
54 | )
55 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/import_helpers/internal_import_record.py:
--------------------------------------------------------------------------------
1 | """
2 | Helper for Python import strings without parent module name.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from mypy_boto3_builder.enums.service_module_name import ServiceModuleName
8 | from mypy_boto3_builder.import_helpers.import_helper import Import
9 | from mypy_boto3_builder.import_helpers.import_record import ImportRecord
10 |
11 |
12 | class InternalImportRecord(ImportRecord):
13 | """
14 | Helper for Python import strings without parent module name.
15 |
16 | Arguments:
17 | service_module_name -- Service module name.
18 | name -- Import name.
19 | alias -- Import local name.
20 | """
21 |
22 | def __init__(
23 | self,
24 | service_module_name: ServiceModuleName,
25 | name: str = "",
26 | alias: str = "",
27 | ) -> None:
28 | source = Import.local(service_module_name.name)
29 | super().__init__(source, name=name, alias=alias)
30 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/parsers/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Parsers for boto3 clients and resources.
3 | """
4 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/parsers/parse_references.py:
--------------------------------------------------------------------------------
1 | """
2 | Parser for Boto3 ServiceResource identifiers, produces `structures.Attribute`.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from typing import TYPE_CHECKING
8 |
9 | from mypy_boto3_builder.boto3_ports.model import ResourceModel
10 | from mypy_boto3_builder.structures.attribute import Attribute
11 | from mypy_boto3_builder.type_annotations.internal_import import InternalImport
12 | from mypy_boto3_builder.type_annotations.type import Type
13 |
14 | if TYPE_CHECKING:
15 | from mypy_boto3_builder.type_annotations.fake_annotation import FakeAnnotation
16 |
17 |
18 | def parse_references(resource_model: ResourceModel) -> list[Attribute]:
19 | """
20 | Extract references from boto3 resource.
21 |
22 | Arguments:
23 | resource_model -- boto3 ResourceModel.
24 |
25 | Returns:
26 | A list of Attribute structures.
27 | """
28 | result: list[Attribute] = []
29 | for reference in resource_model.references:
30 | if not reference.resource:
31 | continue
32 | type_annotation: FakeAnnotation = InternalImport(reference.resource.type)
33 | if reference.resource.path and "[]" in reference.resource.path:
34 | type_annotation = Type.wrap_list(type_annotation)
35 | result.append(Attribute(reference.name, type_annotation=type_annotation, is_reference=True))
36 | return result
37 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/postprocessors/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Package postprocessors are used to postprocess generated packages.
3 | """
4 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/postprocessors/aioboto3.py:
--------------------------------------------------------------------------------
1 | """
2 | Postprocessor for aioboto3 classes and methods.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from mypy_boto3_builder.postprocessors.aiobotocore import AioBotocorePostprocessor
8 |
9 |
10 | class AioBoto3Postprocessor(AioBotocorePostprocessor):
11 | """
12 | Postprocessor for aioboto3 classes and methods.
13 | """
14 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/postprocessors/botocore.py:
--------------------------------------------------------------------------------
1 | """
2 | Postprocessor for all classes and methods.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from mypy_boto3_builder.postprocessors.base import BasePostprocessor
8 |
9 |
10 | class BotocorePostprocessor(BasePostprocessor):
11 | """
12 | Postprocessor for botocore classes and methods.
13 | """
14 |
15 | def process_package(self) -> None:
16 | """
17 | Leave package as it is.
18 | """
19 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/py.typed:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/py.typed
--------------------------------------------------------------------------------
/mypy_boto3_builder/structures/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Structures produced by parsers.
3 | """
4 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/structures/package_extra.py:
--------------------------------------------------------------------------------
1 | """
2 | Package extra entry.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from typing import NamedTuple
8 |
9 |
10 | class PackageExtra(NamedTuple):
11 | """
12 | Package extra entry.
13 | """
14 |
15 | name: str
16 | packages: tuple[str, ...]
17 | description: str = ""
18 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/structures/packages/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Package wrappers for generated products.
3 | """
4 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/structures/packages/mypy_boto3_package.py:
--------------------------------------------------------------------------------
1 | """
2 | Structure for mypy-boto3 package.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from collections.abc import Iterable
8 | from typing import TYPE_CHECKING
9 |
10 | from mypy_boto3_builder.package_data import MypyBoto3PackageData
11 | from mypy_boto3_builder.service_name import ServiceName
12 | from mypy_boto3_builder.structures.package import Package
13 | from mypy_boto3_builder.structures.packages.service_package import ServicePackage
14 |
15 | if TYPE_CHECKING:
16 | from mypy_boto3_builder.type_annotations.type_literal import TypeLiteral
17 |
18 |
19 | class MypyBoto3Package(Package):
20 | """
21 | Structure for mypy-boto3 package.
22 |
23 | Arguments:
24 | service_names -- List of included service names.
25 | service_packages -- List of included service packages.
26 | version -- Package version.
27 | """
28 |
29 | def __init__(
30 | self,
31 | service_names: Iterable[ServiceName],
32 | service_packages: Iterable[ServicePackage],
33 | version: str,
34 | ) -> None:
35 | super().__init__(MypyBoto3PackageData(), service_names, version=version)
36 | self.service_packages = list(service_packages)
37 | self.literals: list[TypeLiteral] = []
38 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/structures/packages/types_aioboto3_package.py:
--------------------------------------------------------------------------------
1 | """
2 | Structure for types-aioboto3 module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from mypy_boto3_builder.structures.packages.wrapper_package import WrapperPackage
8 | from mypy_boto3_builder.utils.version import get_max_build_version, get_min_build_version
9 | from mypy_boto3_builder.utils.version_getters import get_aiobotocore_version
10 |
11 |
12 | class TypesAioBoto3Package(WrapperPackage):
13 | """
14 | Structure for types-aioboto3 module.
15 | """
16 |
17 | def get_all_names(self) -> list[str]:
18 | """
19 | Get names for `__all__` directive.
20 | """
21 | result = [
22 | "Session",
23 | ]
24 | return sorted(result)
25 |
26 | @property
27 | def min_library_version(self) -> str:
28 | """
29 | Minimum required library version.
30 | """
31 | return get_min_build_version(get_aiobotocore_version())
32 |
33 | @property
34 | def max_library_version(self) -> str:
35 | """
36 | Minimum required library version.
37 | """
38 | return get_max_build_version(get_aiobotocore_version())
39 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/structures/packages/types_aiobotocore_package.py:
--------------------------------------------------------------------------------
1 | """
2 | Structure for types-aiobotocore module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from mypy_boto3_builder.structures.packages.wrapper_package import WrapperPackage
8 |
9 |
10 | class TypesAioBotocorePackage(WrapperPackage):
11 | """
12 | Structure for types-aiobotocore module.
13 | """
14 |
15 | def get_all_names(self) -> list[str]:
16 | """
17 | Get names for `__all__` directive.
18 | """
19 | result = [
20 | "get_session",
21 | "Session",
22 | ]
23 | return sorted(result)
24 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/structures/packages/types_boto3_package.py:
--------------------------------------------------------------------------------
1 | """
2 | Structure for types-boto3 module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from mypy_boto3_builder.structures.packages.wrapper_package import WrapperPackage
8 |
9 |
10 | class TypesBoto3Package(WrapperPackage):
11 | """
12 | Structure for types-boto3 module.
13 | """
14 |
15 | def get_all_names(self) -> list[str]:
16 | """
17 | Get names for `__all__` directive.
18 | """
19 | result = [
20 | "session",
21 | "Session",
22 | "DEFAULT_SESSION",
23 | "setup_default_session",
24 | "set_stream_logger",
25 | "NullHandler",
26 | "client",
27 | "resource",
28 | ]
29 | return sorted(result)
30 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aioboto3/__init__.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aioboto3 module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | import logging
8 | from typing import Any
9 |
10 | from aioboto3.session import Session as Session
11 |
12 | __author__: str
13 | __email__: str
14 | __version__: str
15 |
16 | class NullHandler(logging.Handler):
17 | def emit(self, record: Any) -> Any: ...
18 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aioboto3/dynamodb/__init__.pyi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/stubs_static/types-aioboto3/dynamodb/__init__.pyi
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aioboto3/experimental/__init__.pyi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/stubs_static/types-aioboto3/experimental/__init__.pyi
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aioboto3/experimental/async_chalice.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aioboto3.experimental.async_chalice module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from typing import Any
8 |
9 | from aioboto3.session import Session as Session
10 | from chalice import Chalice # type: ignore
11 | from chalice.app import RestAPIEventHandler # type: ignore
12 |
13 | class AsyncRestAPIEventHandler(RestAPIEventHandler): ... # type: ignore
14 |
15 | class AsyncChalice(Chalice): # type: ignore
16 | aioboto3: Any
17 | def __init__(
18 | self, *args: Any, aioboto3_session: Session | None = ..., **kwargs: Any
19 | ) -> None: ...
20 | lambda_context: Any
21 | current_request: Any
22 | def __call__(self, event: Any, context: Any) -> Any: ...
23 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aioboto3/resources/__init__.pyi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/stubs_static/types-aioboto3/resources/__init__.pyi
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aioboto3/resources/action.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aioboto3.resources.action module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | import logging
8 | from typing import Any
9 |
10 | from boto3.resources.action import ServiceAction, WaiterAction
11 | from boto3.resources.base import ServiceResource
12 | from boto3.resources.factory import ResourceFactory
13 | from boto3.resources.model import Action
14 | from boto3.utils import ServiceContext
15 |
16 | logger: logging.Logger
17 |
18 | class AIOServiceAction(ServiceAction):
19 | def __init__(
20 | self,
21 | action_model: Action,
22 | factory: ResourceFactory | None = ...,
23 | service_context: ServiceContext | None = ...,
24 | ) -> None: ...
25 | async def __call__( # type: ignore[override]
26 | self, parent: ServiceResource, *args: Any, **kwargs: Any
27 | ) -> ServiceResource | list[ServiceResource] | dict[str, Any]: ...
28 |
29 | class AioBatchAction(ServiceAction):
30 | async def __call__( # type: ignore[override]
31 | self, parent: ServiceResource, *args: Any, **kwargs: Any
32 | ) -> list[dict[str, Any]]: ...
33 |
34 | class AIOWaiterAction(WaiterAction):
35 | async def __call__( # type: ignore[override]
36 | self, parent: ServiceResource, *args: Any, **kwargs: Any
37 | ) -> None: ...
38 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aioboto3/resources/base.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aioboto3.resources.base module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | import logging
8 | from types import TracebackType
9 | from typing import TypeVar
10 |
11 | from boto3.resources.base import ServiceResource
12 |
13 | _R = TypeVar("_R", bound=AIOBoto3ServiceResource)
14 |
15 | logger: logging.Logger
16 |
17 | class AIOBoto3ServiceResource(ServiceResource):
18 | async def __aenter__(self: _R) -> _R: ...
19 | async def __aexit__(
20 | self,
21 | exc_type: type[BaseException] | None,
22 | exc_value: BaseException | None,
23 | tb: TracebackType | None,
24 | ) -> None: ...
25 | def close(self) -> None: ...
26 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aioboto3/resources/factory.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aioboto3.resources.factory module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | import logging
8 | from typing import Any
9 |
10 | from aioboto3.resources.base import AIOBoto3ServiceResource
11 | from boto3.resources.factory import ResourceFactory
12 | from boto3.utils import ServiceContext
13 | from botocore.hooks import BaseEventHooks
14 |
15 | logger: logging.Logger
16 |
17 | class AIOBoto3ResourceFactory(ResourceFactory):
18 | def __init__(self, emitter: BaseEventHooks) -> None: ...
19 | async def load_from_definition( # type: ignore[override]
20 | self,
21 | resource_name: str,
22 | single_resource_json_definition: Any,
23 | service_context: ServiceContext,
24 | ) -> AIOBoto3ServiceResource: ...
25 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aioboto3/resources/response.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aioboto3.resources.response module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from typing import Any
8 |
9 | from boto3.resources.base import ServiceResource
10 | from boto3.resources.response import RawHandler, ResourceHandler
11 |
12 | class AIOResourceHandler(ResourceHandler):
13 | async def __call__( # type: ignore[override]
14 | self, parent: ServiceResource, params: dict[str, Any], response: dict[str, Any]
15 | ) -> ServiceResource | list[ServiceResource]: ...
16 |
17 | class AIORawHandler(RawHandler):
18 | async def __call__( # type: ignore[override]
19 | self, parent: ServiceResource, params: dict[str, Any], response: dict[str, Any]
20 | ) -> dict[str, Any]: ...
21 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aioboto3/s3/__init__.pyi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/stubs_static/types-aioboto3/s3/__init__.pyi
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/__init__.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | __version__: str
8 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/awsrequest.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.awsrequest module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from botocore.awsrequest import AWSResponse
8 |
9 | class AioAWSResponse(AWSResponse):
10 | @property
11 | def content(self) -> bytes: ...
12 | @property
13 | def text(self) -> str: ...
14 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/config.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.config module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from typing import Any, TypeVar
8 |
9 | from aiobotocore.httpsession import AIOHTTPSession
10 | from botocore.config import Config
11 |
12 | _Config = TypeVar("_Config", bound=Config)
13 |
14 | class AioConfig(Config):
15 | def __init__(
16 | self, connector_args: Any = ..., http_session_cls: type[AIOHTTPSession] = ..., **kwargs: Any
17 | ) -> None: ...
18 | def merge(self: _Config, other_config: _Config) -> _Config: ...
19 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/configprovider.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.configprovider module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from botocore.configprovider import ConfigValueStore, SmartDefaultsConfigStoreFactory
8 |
9 | class AioSmartDefaultsConfigStoreFactory(SmartDefaultsConfigStoreFactory):
10 | async def merge_smart_defaults( # type: ignore[override]
11 | self,
12 | config_store: ConfigValueStore,
13 | mode: str,
14 | region_name: str,
15 | ) -> None: ...
16 | async def resolve_auto_mode(self, region_name: str) -> str: ... # type: ignore[override]
17 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/discovery.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.discovery module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from typing import Any
8 |
9 | from botocore.discovery import EndpointDiscoveryHandler, EndpointDiscoveryManager
10 | from requests.models import Request
11 |
12 | class AioEndpointDiscoveryManager(EndpointDiscoveryManager):
13 | async def describe_endpoint(self, **kwargs: Any) -> Any: ...
14 |
15 | class AioEndpointDiscoveryHandler(EndpointDiscoveryHandler):
16 | async def discover_endpoint( # type: ignore[override]
17 | self, request: Request, operation_name: str, **kwargs: Any
18 | ) -> None: ...
19 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/eventstream.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.eventstream module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from typing import AsyncIterator, Generic, Iterator, TypeVar
8 |
9 | from botocore.eventstream import EventStream
10 |
11 | _T = TypeVar("_T")
12 |
13 | class AioEventStream(EventStream[_T], Generic[_T]):
14 | def __iter__(self) -> Iterator[_T]: ...
15 | def __aiter__(self) -> AsyncIterator[_T]: ...
16 | async def __anext__(self) -> _T: ...
17 | async def get_initial_response(self) -> _T: ... # type: ignore[override]
18 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/handlers.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.handlers module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from typing import Any, Mapping
8 |
9 | from botocore.signers import RequestSigner
10 | from requests.models import Response
11 |
12 | async def check_for_200_error(response: Response, **kwargs: Any) -> None: ...
13 | async def inject_presigned_url_ec2(
14 | params: Mapping[str, Any], request_signer: RequestSigner, model: Any, **kwargs: Any
15 | ) -> None: ...
16 | async def inject_presigned_url_rds(
17 | params: Mapping[str, Any], request_signer: RequestSigner, model: Any, **kwargs: Any
18 | ) -> None: ...
19 | async def parse_get_bucket_location(
20 | parsed: dict[str, Any], http_response: Response, **kwargs: Any
21 | ) -> None: ...
22 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/hooks.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.hooks module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from typing import Any
8 |
9 | from botocore.hooks import HierarchicalEmitter
10 | from requests.models import Response
11 |
12 | class AioHierarchicalEmitter(HierarchicalEmitter):
13 | async def emit_until_response(self, event_name: str, **kwargs: Any) -> list[Response]: ...
14 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/httpchecksum.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.httpchecksum module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from typing import Any, Mapping, TypeVar
8 |
9 | from aiobotocore.response import StreamingBody
10 | from aiohttp import StreamReader
11 | from botocore.awsrequest import AWSHTTPResponse, AWSRequest
12 | from botocore.httpchecksum import AwsChunkedWrapper, BaseChecksum
13 | from botocore.model import OperationModel
14 |
15 | _R = TypeVar("_R")
16 |
17 | class AioAwsChunkedWrapper(AwsChunkedWrapper):
18 | async def read(self, size: int | None = ...) -> bytes: ... # type: ignore[override]
19 | async def _make_chunk(self) -> bytes: ...
20 | def __aiter__(self: _R) -> _R: ...
21 | async def __anext__(self) -> bytes: ...
22 |
23 | class StreamingChecksumBody(StreamingBody):
24 | def __init__(
25 | self,
26 | raw_stream: StreamReader,
27 | content_length: str,
28 | checksum: BaseChecksum,
29 | expected: BaseChecksum,
30 | ) -> None: ...
31 | async def read(self, amt: int | None = ...) -> bytes: ...
32 |
33 | async def handle_checksum_body(
34 | http_response: AWSHTTPResponse,
35 | response: dict[str, Any],
36 | context: Mapping[str, Any],
37 | operation_model: OperationModel,
38 | ) -> None: ...
39 | def apply_request_checksum(request: AWSRequest) -> None: ...
40 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/httpsession.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.httpsession module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from types import TracebackType
8 | from typing import Any, TypeVar
9 |
10 | from botocore.endpoint import MAX_POOL_CONNECTIONS as MAX_POOL_CONNECTIONS
11 | from requests.models import Request, Response
12 |
13 | _R = TypeVar("_R")
14 |
15 | class AIOHTTPSession:
16 | def __init__(
17 | self,
18 | verify: bool = ...,
19 | proxies: dict[str, str] | None = ...,
20 | timeout: float | None = ...,
21 | max_pool_connections: int = ...,
22 | socket_options: Any | None = ...,
23 | client_cert: Any | None = ...,
24 | proxies_config: Any | None = ...,
25 | connector_args: Any | None = ...,
26 | ) -> None: ...
27 | async def __aenter__(self: _R) -> _R: ...
28 | async def __aexit__(
29 | self,
30 | exc_type: type[BaseException] | None,
31 | exc_val: BaseException | None,
32 | tb: TracebackType | None,
33 | ) -> None: ...
34 | async def close(self) -> None: ...
35 | async def send(self, request: Request) -> Response: ...
36 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/paginate.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.paginate module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from typing import Any, AsyncIterator, Generic, TypeVar
8 |
9 | from botocore.paginate import PageIterator, Paginator
10 |
11 | _R = TypeVar("_R")
12 |
13 | class AioPageIterator(PageIterator[_R], Generic[_R]):
14 | def __aiter__(self) -> AsyncIterator[_R]: ...
15 | async def __anext__(self) -> _R: ...
16 | def result_key_iters(self) -> Any: ...
17 | async def build_full_result(self) -> dict[str, Any]: ... # type: ignore[override]
18 | def search(self, expression: str) -> AsyncIterator[_R]: ... # type: ignore[override]
19 |
20 | class AioPaginator(Paginator[_R], Generic[_R]):
21 | PAGE_ITERATOR_CLS: type[AioPageIterator[Any]] # type: ignore[override]
22 |
23 | class ResultKeyIterator(Generic[_R]):
24 | result_key: str
25 | def __init__(self, pages_iterator: PageIterator[_R], result_key: str) -> None: ...
26 | def __aiter__(self) -> AsyncIterator[_R]: ...
27 | async def __anext__(self) -> _R: ...
28 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/regions.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.regions module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from logging import Logger
8 | from typing import Any, Mapping
9 |
10 | from botocore.endpoint_provider import RuleSetEndpoint
11 | from botocore.model import OperationModel
12 | from botocore.regions import EndpointRulesetResolver
13 |
14 | LOG: Logger
15 |
16 | class AioEndpointRulesetResolver(EndpointRulesetResolver):
17 | async def construct_endpoint( # type: ignore[override]
18 | self,
19 | operation_model: OperationModel,
20 | call_args: Mapping[str, Any] | None,
21 | request_context: Mapping[str, Any] | None,
22 | ) -> RuleSetEndpoint: ...
23 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/retries/__init__.pyi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/stubs_static/types-aiobotocore/retries/__init__.pyi
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/retries/adaptive.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.retries.adaptive module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | import logging
8 | from typing import Any
9 |
10 | from aiobotocore.client import AioBaseClient
11 | from botocore.retries.adaptive import RateClocker
12 | from botocore.retries.bucket import Clock, TokenBucket
13 | from botocore.retries.standard import ThrottlingErrorDetector
14 | from botocore.retries.throttling import CubicCalculator
15 |
16 | logger: logging.Logger = ...
17 |
18 | def register_retry_handler(client: AioBaseClient) -> AsyncClientRateLimiter: ...
19 |
20 | class AsyncClientRateLimiter:
21 | def __init__(
22 | self,
23 | rate_adjustor: CubicCalculator,
24 | rate_clocker: RateClocker,
25 | token_bucket: TokenBucket,
26 | throttling_detector: ThrottlingErrorDetector,
27 | clock: Clock,
28 | ) -> None: ...
29 | async def on_sending_request(self, request: Any, **kwargs: Any) -> None: ...
30 | async def on_receiving_response(self, **kwargs: Any) -> None: ...
31 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/retries/bucket.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.retries.bucket module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from botocore.retries.bucket import Clock as Clock
8 |
9 | class AsyncTokenBucket:
10 | def __init__(self, max_rate: float, clock: Clock, min_rate: float = ...) -> None: ...
11 | @property
12 | def max_rate(self) -> float: ...
13 | async def set_max_rate(self, value: float) -> None: ...
14 | def _set_max_rate(self, value: float) -> None: ...
15 | @property
16 | def max_capacity(self) -> int: ...
17 | @property
18 | def available_capacity(self) -> int: ...
19 | async def acquire(self, amount: int = ..., block: bool = ...) -> bool: ...
20 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/retries/special.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.retries.special module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from botocore.retries.special import RetryDDBChecksumError
8 | from botocore.retries.standard import RetryContext
9 |
10 | class AioRetryDDBChecksumError(RetryDDBChecksumError):
11 | async def is_retryable(self, context: RetryContext) -> bool: ... # type: ignore
12 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/retries/standard.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.retries.standard module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from typing import Any
8 |
9 | from botocore.client import BaseClient
10 | from botocore.retries.standard import (
11 | OrRetryChecker,
12 | RetryContext,
13 | RetryHandler,
14 | RetryPolicy,
15 | StandardRetryConditions,
16 | )
17 |
18 | def register_retry_handler(client: BaseClient, max_attempts: int = ...) -> AioRetryHandler: ...
19 |
20 | class AioRetryHandler(RetryHandler):
21 | async def needs_retry(self, **kwargs: Any) -> float | None: ... # type: ignore
22 |
23 | class AioRetryPolicy(RetryPolicy):
24 | async def should_retry(self, context: RetryContext) -> bool: ...
25 |
26 | class AioStandardRetryConditions(StandardRetryConditions):
27 | def __init__(self, max_attempts: int = ...) -> None: ...
28 | async def is_retryable(self, context: RetryContext) -> bool: ... # type: ignore
29 |
30 | class AioOrRetryChecker(OrRetryChecker):
31 | async def is_retryable(self, context: RetryContext) -> bool: ... # type: ignore
32 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/retryhandler.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.retryhandler module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from typing import Any
8 |
9 | from botocore.config import Config
10 | from botocore.retryhandler import CRC32Checker, MaxAttemptsDecorator, MultiChecker, RetryHandler
11 |
12 | def create_retry_handler(config: Config, operation_name: str | None = ...) -> AioRetryHandler: ...
13 | def create_checker_from_retry_config(
14 | config: Config, operation_name: str | None = ...
15 | ) -> AioMaxAttemptsDecorator: ...
16 |
17 | class AioRetryHandler(RetryHandler):
18 | def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
19 |
20 | class AioMaxAttemptsDecorator(MaxAttemptsDecorator):
21 | def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
22 |
23 | class AioMultiChecker(MultiChecker):
24 | def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
25 |
26 | class AioCRC32Checker(CRC32Checker):
27 | def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
28 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/stub.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.stub module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from typing import Any, Mapping
8 |
9 | from botocore.stub import Stubber
10 |
11 | class AioStubber(Stubber):
12 | def add_client_error(
13 | self,
14 | method: str,
15 | service_error_code: str = ...,
16 | service_message: str = ...,
17 | http_status_code: int = ...,
18 | service_error_meta: Mapping[str, Any] | None = ...,
19 | expected_params: Mapping[str, Any] | None = ...,
20 | response_meta: Mapping[str, Any] | None = ...,
21 | modeled_fields: Mapping[str, Any] | None = ...,
22 | ) -> None: ...
23 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/tokens.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.tokens module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | import datetime
8 | from logging import Logger
9 | from typing import Any, Callable
10 |
11 | from botocore.session import Session
12 | from botocore.tokens import (
13 | DeferredRefreshableToken,
14 | FrozenAuthToken,
15 | SSOTokenProvider,
16 | TokenProviderChain,
17 | )
18 |
19 | logger: Logger
20 |
21 | def create_token_resolver(session: Session) -> TokenProviderChain: ...
22 |
23 | class AioDeferredRefreshableToken(DeferredRefreshableToken):
24 | def __init__(
25 | self,
26 | method: Any,
27 | refresh_using: Callable[[], FrozenAuthToken],
28 | time_fetcher: Callable[[], datetime.datetime] = ...,
29 | ) -> None: ...
30 | async def get_frozen_token(self) -> FrozenAuthToken: ... # type: ignore[override]
31 |
32 | class AioSSOTokenProvider(SSOTokenProvider):
33 | def load_token(self) -> AioDeferredRefreshableToken: ...
34 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-aiobotocore/waiter.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for aiobotocore.waiter module.
3 |
4 | Copyright 2025 Vlad Emelianov
5 | """
6 |
7 | from typing import Any
8 |
9 | from botocore.client import BaseClient
10 | from botocore.waiter import NormalizedOperationMethod as _NormalizedOperationMethod
11 | from botocore.waiter import Waiter
12 | from botocore.waiter import WaiterModel as WaiterModel
13 |
14 | class NormalizedOperationMethod(_NormalizedOperationMethod):
15 | async def __call__(self, **kwargs: Any) -> Any: ...
16 |
17 | class AIOWaiter(Waiter):
18 | async def wait(self, **kwargs: Any) -> None: ... # type: ignore[override]
19 |
20 | def create_waiter_with_client(
21 | waiter_name: str, waiter_model: WaiterModel, client: BaseClient
22 | ) -> AIOWaiter: ...
23 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/compat.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.compat module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | import os
8 | from typing import Any
9 |
10 | SOCKET_ERROR: type[ConnectionError]
11 |
12 | rename_file = os.rename
13 |
14 | def filter_python_deprecation_warnings() -> None: ...
15 | def is_append_mode(fileobj: Any) -> bool: ...
16 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/crt.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.crt module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | import threading
8 | from typing import Any
9 |
10 | from botocore.client import BaseClient
11 | from s3transfer.crt import BotocoreCRTRequestSerializer, CRTTransferManager
12 |
13 | CRT_S3_CLIENT: CRTS3Client | None = ...
14 | BOTOCORE_CRT_SERIALIZER: BotocoreCRTRequestSerializer | None = ...
15 |
16 | CLIENT_CREATION_LOCK: threading.Lock = ...
17 | PROCESS_LOCK_NAME: str = ...
18 |
19 | def get_crt_s3_client(client: BaseClient, config: Any) -> CRTS3Client: ...
20 |
21 | class CRTS3Client:
22 | def __init__(
23 | self, crt_client: Any, process_lock: Any, region: str, cred_provider: Any
24 | ) -> None: ...
25 |
26 | def is_crt_compatible_request(client: BaseClient, crt_s3_client: CRTS3Client) -> bool: ...
27 | def compare_identity(boto3_creds: Any, crt_s3_creds: Any) -> bool: ...
28 | def create_crt_transfer_manager(client: BaseClient, config: Any) -> CRTTransferManager | None: ...
29 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/docs/__init__.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.docs module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from boto3.session import Session
8 |
9 | def generate_docs(root_dir: str, session: Session) -> None: ...
10 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/docs/action.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.docs.action module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from boto3.resources.model import Action
8 | from botocore.docs.bcdoc.restdoc import DocumentStructure
9 | from botocore.hooks import BaseEventHooks
10 | from botocore.model import ServiceModel
11 |
12 | from .base import NestedDocumenter
13 |
14 | PUT_DATA_WARNING_MESSAGE: str
15 | WARNING_MESSAGES: dict[str, dict[str, str]]
16 | IGNORE_PARAMS: dict[str, dict[str, list[str]]]
17 |
18 | class ActionDocumenter(NestedDocumenter):
19 | def document_actions(self, section: DocumentStructure) -> None: ...
20 |
21 | def document_action(
22 | section: DocumentStructure,
23 | resource_name: str,
24 | event_emitter: BaseEventHooks,
25 | action_model: Action,
26 | service_model: ServiceModel,
27 | include_signature: bool = ...,
28 | ) -> None: ...
29 | def document_load_reload_action(
30 | section: DocumentStructure,
31 | action_name: str,
32 | resource_name: str,
33 | event_emitter: BaseEventHooks,
34 | load_model: Action,
35 | service_model: ServiceModel,
36 | include_signature: bool = ...,
37 | ) -> None: ...
38 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/docs/attr.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.docs.attr module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from boto3.resources.model import Identifier
8 | from botocore.docs.bcdoc.restdoc import DocumentStructure
9 | from botocore.docs.params import ResponseParamsDocumenter
10 | from botocore.hooks import BaseEventHooks
11 | from botocore.model import Shape
12 |
13 | class ResourceShapeDocumenter(ResponseParamsDocumenter):
14 | EVENT_NAME: str
15 |
16 | def document_attribute(
17 | section: DocumentStructure,
18 | service_name: str,
19 | resource_name: str,
20 | attr_name: str,
21 | event_emitter: BaseEventHooks,
22 | attr_model: Shape,
23 | include_signature: bool = True,
24 | ) -> None: ...
25 | def document_identifier(
26 | section: DocumentStructure,
27 | resource_name: str,
28 | identifier_model: Identifier,
29 | include_signature: bool = ...,
30 | ) -> None: ...
31 | def document_reference(
32 | section: DocumentStructure, reference_model: Shape, include_signature: bool = ...
33 | ) -> None: ...
34 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/docs/base.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.docs.base module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from typing import Any
8 |
9 | class BaseDocumenter:
10 | member_map: dict[str, Any]
11 | represents_service_resource: Any
12 | def __init__(self, resource: Any) -> None: ...
13 | @property
14 | def class_name(self) -> str: ...
15 |
16 | class NestedDocumenter(BaseDocumenter):
17 | def __init__(self, resource: Any, root_docs_path: str) -> None: ...
18 | @property
19 | def class_name(self) -> str: ...
20 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/docs/client.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.docs.client module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from botocore.docs.client import ClientDocumenter
8 |
9 | class Boto3ClientDocumenter(ClientDocumenter): ...
10 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/docs/collection.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.docs.collection module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from boto3.resources.model import Action, Collection
8 | from botocore.docs.bcdoc.restdoc import DocumentStructure
9 | from botocore.hooks import BaseEventHooks
10 | from botocore.model import ServiceModel
11 |
12 | from .base import NestedDocumenter
13 |
14 | class CollectionDocumenter(NestedDocumenter):
15 | def document_collections(self, section: DocumentStructure) -> None: ...
16 |
17 | def document_collection_object(
18 | section: DocumentStructure, collection_model: Collection, include_signature: bool = ...
19 | ) -> None: ...
20 | def document_batch_action(
21 | section: DocumentStructure,
22 | resource_name: str,
23 | event_emitter: BaseEventHooks,
24 | batch_action_model: Action,
25 | service_model: ServiceModel,
26 | collection_model: Collection,
27 | include_signature: bool = ...,
28 | ) -> None: ...
29 | def document_collection_method(
30 | section: DocumentStructure,
31 | resource_name: str,
32 | action_name: str,
33 | event_emitter: BaseEventHooks,
34 | collection_model: Collection,
35 | service_model: ServiceModel,
36 | include_signature: bool = ...,
37 | ) -> None: ...
38 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/docs/docstring.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.docs.docstring module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from botocore.docs.docstring import LazyLoadedDocstring
8 |
9 | class ActionDocstring(LazyLoadedDocstring): ...
10 | class LoadReloadDocstring(LazyLoadedDocstring): ...
11 | class SubResourceDocstring(LazyLoadedDocstring): ...
12 | class AttributeDocstring(LazyLoadedDocstring): ...
13 | class IdentifierDocstring(LazyLoadedDocstring): ...
14 | class ReferenceDocstring(LazyLoadedDocstring): ...
15 | class CollectionDocstring(LazyLoadedDocstring): ...
16 | class CollectionMethodDocstring(LazyLoadedDocstring): ...
17 | class BatchActionDocstring(LazyLoadedDocstring): ...
18 | class ResourceWaiterDocstring(LazyLoadedDocstring): ...
19 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/docs/method.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.docs.method module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from typing import Any
8 |
9 | from boto3.resources.model import Action
10 | from botocore.docs.bcdoc.restdoc import DocumentStructure
11 | from botocore.hooks import BaseEventHooks
12 |
13 | def document_model_driven_resource_method(
14 | section: DocumentStructure,
15 | method_name: str,
16 | operation_model: Any,
17 | event_emitter: BaseEventHooks,
18 | method_description: str | None = ...,
19 | example_prefix: str | None = ...,
20 | include_input: Any | None = ...,
21 | include_output: Any | None = ...,
22 | exclude_input: Any | None = ...,
23 | exclude_output: Any | None = ...,
24 | document_output: bool = ...,
25 | resource_action_model: Action | None = ...,
26 | include_signature: bool = ...,
27 | ) -> None: ...
28 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/docs/resource.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.docs.resource module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from typing import Any
8 |
9 | from botocore.docs.bcdoc.restdoc import DocumentStructure
10 | from botocore.session import Session
11 |
12 | from .base import BaseDocumenter
13 |
14 | class ResourceDocumenter(BaseDocumenter):
15 | def __init__(self, resource: Any, botocore_session: Session, root_docs_path: str) -> None: ...
16 | def document_resource(self, section: DocumentStructure) -> None: ...
17 |
18 | class ServiceResourceDocumenter(ResourceDocumenter):
19 | @property
20 | def class_name(self) -> str: ...
21 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/docs/service.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.docs.service module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from botocore.docs.bcdoc.restdoc import DocumentStructure
8 | from botocore.docs.service import ServiceDocumenter as BaseServiceDocumenter
9 | from botocore.session import Session
10 |
11 | class ServiceDocumenter(BaseServiceDocumenter):
12 | EXAMPLE_PATH: str
13 | sections: list[str]
14 | def __init__(self, service_name: str, session: Session, root_docs_path: str) -> None: ...
15 | def document_service(self) -> bytes: ...
16 | def client_api(self, section: DocumentStructure) -> None: ...
17 | def resource_section(self, section: DocumentStructure) -> None: ...
18 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/docs/subresource.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.docs.subresource module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from boto3.resources.model import ResourceModel
8 | from botocore.docs.bcdoc.restdoc import DocumentStructure
9 | from botocore.model import ServiceModel
10 |
11 | from .base import NestedDocumenter
12 |
13 | class SubResourceDocumenter(NestedDocumenter):
14 | def document_sub_resources(self, section: DocumentStructure) -> None: ...
15 |
16 | def document_sub_resource(
17 | section: DocumentStructure,
18 | resource_name: str,
19 | sub_resource_model: ResourceModel,
20 | service_model: ServiceModel,
21 | include_signature: bool = ...,
22 | ) -> None: ...
23 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/docs/utils.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.docs.utils module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from typing import Any, Iterable, Mapping
8 |
9 | from botocore.docs.bcdoc.restdoc import DocumentStructure
10 |
11 | def get_resource_ignore_params(params: Mapping[str, Any]) -> list[str]: ...
12 | def is_resource_action(action_handle: Any) -> bool: ...
13 | def get_resource_public_actions(resource_class: Any) -> list[Any]: ...
14 | def get_identifier_values_for_example(identifier_names: Iterable[str]) -> str: ...
15 | def get_identifier_args_for_signature(identifier_names: Iterable[str]) -> str: ...
16 | def get_identifier_description(resource_name: str, identifier_name: str) -> str: ...
17 | def add_resource_type_overview(
18 | section: DocumentStructure,
19 | resource_type: str,
20 | description: str,
21 | intro_link: str | None = ...,
22 | ) -> None: ...
23 |
24 | class DocumentModifiedShape:
25 | def __init__(
26 | self, shape_name: str, new_type: str, new_description: str, new_example_value: str
27 | ) -> None: ...
28 | def replace_documentation_for_matching_shape(
29 | self, event_name: str, section: DocumentStructure, **kwargs: Any
30 | ) -> None: ...
31 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/docs/waiter.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.docs.waiter module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from typing import Any
8 |
9 | from botocore.docs.bcdoc.restdoc import DocumentStructure
10 | from botocore.hooks import BaseEventHooks
11 | from botocore.model import ServiceModel
12 | from botocore.waiter import WaiterModel
13 |
14 | from .base import NestedDocumenter
15 |
16 | class WaiterResourceDocumenter(NestedDocumenter):
17 | def __init__(
18 | self,
19 | resource: Any,
20 | service_waiter_model: WaiterModel,
21 | root_docs_path: str,
22 | ) -> None: ...
23 | def document_resource_waiters(self, section: DocumentStructure) -> None: ...
24 |
25 | def document_resource_waiter(
26 | section: DocumentStructure,
27 | resource_name: str,
28 | event_emitter: BaseEventHooks,
29 | service_model: ServiceModel,
30 | resource_waiter_model: Any,
31 | service_waiter_model: WaiterModel,
32 | include_signature: bool = ...,
33 | ) -> None: ...
34 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/dynamodb/__init__.pyi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/stubs_static/types-boto3/dynamodb/__init__.pyi
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/dynamodb/table.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.dynamodb.table module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | import logging
8 | from types import TracebackType
9 | from typing import Any, TypeVar
10 |
11 | from botocore.client import BaseClient
12 |
13 | logger: logging.Logger
14 |
15 | def register_table_methods(base_classes: list[Any], **kwargs: Any) -> None: ...
16 |
17 | class TableResource:
18 | def __init__(self, *args: Any, **kwargs: Any) -> None: ...
19 | def batch_writer(self, overwrite_by_pkeys: list[str] | None = ...) -> BatchWriter: ...
20 |
21 | _R = TypeVar("_R")
22 |
23 | class BatchWriter:
24 | def __init__(
25 | self,
26 | table_name: str,
27 | client: BaseClient,
28 | flush_amount: int = ...,
29 | overwrite_by_pkeys: list[str] | None = ...,
30 | ) -> None: ...
31 | def put_item(self, Item: dict[str, Any]) -> None: ...
32 | def delete_item(self, Key: dict[str, Any]) -> None: ...
33 | def __enter__(self: _R) -> _R: ...
34 | def __exit__(
35 | self,
36 | exc_type: type[BaseException] | None,
37 | exc_value: BaseException | None,
38 | tb: TracebackType | None,
39 | ) -> None: ...
40 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/dynamodb/types.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.dynamodb.types module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from decimal import Context
8 | from typing import Any, Literal, Mapping, Sequence, TypedDict
9 |
10 | class _AttributeValueTypeDef(TypedDict, total=False):
11 | S: str
12 | N: str
13 | B: bytes
14 | SS: Sequence[str]
15 | NS: Sequence[str]
16 | BS: Sequence[bytes]
17 | M: Mapping[str, Any]
18 | L: Sequence[Any]
19 | NULL: bool
20 | BOOL: bool
21 |
22 | STRING: Literal["S"]
23 | NUMBER: Literal["N"]
24 | BINARY: Literal["B"]
25 | STRING_SET: Literal["SS"]
26 | NUMBER_SET: Literal["NS"]
27 | BINARY_SET: Literal["BS"]
28 | NULL: Literal["NULL"]
29 | BOOLEAN: Literal["BOOL"]
30 | MAP: Literal["M"]
31 | LIST: Literal["L"]
32 |
33 | DYNAMODB_CONTEXT: Context
34 |
35 | BINARY_TYPES: tuple[Any, ...]
36 |
37 | class Binary:
38 | def __init__(self, value: Any) -> None: ...
39 | def __eq__(self, other: object) -> bool: ...
40 | def __ne__(self, other: object) -> bool: ...
41 | def __bytes__(self) -> str: ...
42 | def __hash__(self) -> int: ...
43 |
44 | class TypeSerializer:
45 | def serialize(self, value: Any) -> _AttributeValueTypeDef: ...
46 |
47 | class TypeDeserializer:
48 | def deserialize(self, value: _AttributeValueTypeDef) -> Any: ...
49 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/ec2/__init__.pyi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/stubs_static/types-boto3/ec2/__init__.pyi
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/ec2/createtags.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.ec2.createtags module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from typing import Any, Iterable
8 |
9 | def inject_create_tags(
10 | event_name: str, class_attributes: dict[str, Any], **kwargs: Any
11 | ) -> None: ...
12 | def create_tags(self: Any, **kwargs: Iterable[Any]) -> list[dict[str, Any]]: ...
13 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/ec2/deletetags.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.ec2.deletetags module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from typing import Any
8 |
9 | from botocore.hooks import BaseEventHooks
10 |
11 | def inject_delete_tags(event_emitter: BaseEventHooks, **kwargs: Any) -> None: ...
12 | def delete_tags(self: Any, **kwargs: Any) -> None: ...
13 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/resources/__init__.pyi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/stubs_static/types-boto3/resources/__init__.pyi
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/resources/base.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.resources.base module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | import logging
8 | from typing import Any, TypeVar
9 |
10 | from boto3.resources.model import ResourceModel
11 | from botocore.client import BaseClient
12 |
13 | logger: logging.Logger
14 |
15 | _ResourceMeta = TypeVar("_ResourceMeta")
16 |
17 | class ResourceMeta:
18 | client: BaseClient
19 | def __init__(
20 | self,
21 | service_name: str,
22 | identifiers: list[str] | None = ...,
23 | client: BaseClient | None = ...,
24 | data: dict[str, Any] | None = ...,
25 | resource_model: ResourceModel | None = ...,
26 | ) -> None:
27 | self.service_name: str
28 | self.identifiers: list[str]
29 | self.data: dict[str, Any]
30 | self.resource_model: ResourceModel
31 |
32 | def __eq__(self, other: object) -> bool: ...
33 | def copy(self: _ResourceMeta) -> _ResourceMeta: ...
34 |
35 | class ServiceResource:
36 | meta: ResourceMeta = ... # type: ignore
37 |
38 | def __init__(self, *args: Any, client: BaseClient | None = ..., **kwargs: Any) -> None: ...
39 | def __eq__(self, other: object) -> bool: ...
40 | def __hash__(self) -> int: ...
41 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/resources/factory.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.resources.factory module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | import logging
8 | from typing import Any
9 |
10 | from boto3.resources.base import ServiceResource
11 | from boto3.utils import ServiceContext
12 | from botocore.hooks import BaseEventHooks
13 |
14 | logger: logging.Logger
15 |
16 | class ResourceFactory:
17 | def __init__(self, emitter: BaseEventHooks) -> None: ...
18 | def load_from_definition(
19 | self,
20 | resource_name: str,
21 | single_resource_json_definition: dict[str, Any],
22 | service_context: ServiceContext,
23 | ) -> type[ServiceResource]: ...
24 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/resources/params.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.resources.params module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from typing import Any, Pattern
8 |
9 | from boto3.resources.base import ServiceResource
10 | from boto3.resources.model import Request
11 |
12 | INDEX_RE: Pattern[str]
13 |
14 | def get_data_member(parent: ServiceResource, path: str) -> dict[str, Any] | None: ...
15 | def create_request_parameters(
16 | parent: ServiceResource,
17 | request_model: Request,
18 | params: dict[str, Any] | None = ...,
19 | index: int | None = ...,
20 | ) -> dict[str, Any]: ...
21 | def build_param_structure(
22 | params: dict[str, Any], target: str, value: Any, index: int | None = ...
23 | ) -> None: ...
24 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/s3/__init__.pyi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/stubs_static/types-boto3/s3/__init__.pyi
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/s3/constants.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.s3.constants module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | CLASSIC_TRANSFER_CLIENT: str = ...
8 | AUTO_RESOLVE_TRANSFER_CLIENT: str = ...
9 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/stubs_static/types-boto3/utils.pyi:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for boto3.utils module.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from typing import Any
8 |
9 | from botocore.model import ServiceModel
10 | from botocore.session import Session
11 | from botocore.waiter import Waiter, WaiterModel
12 |
13 | class ServiceContext:
14 | def __init__(
15 | self,
16 | service_name: str,
17 | service_model: ServiceModel,
18 | service_waiter_model: WaiterModel | None,
19 | resource_json_definitions: dict[str, Any],
20 | ) -> None: ...
21 |
22 | def import_module(name: str) -> Any: ...
23 | def lazy_call(full_name: str, **kwargs: Any) -> Any: ...
24 | def inject_attribute(class_attributes: dict[str, Any], name: str, value: Any) -> None: ...
25 |
26 | class LazyLoadedWaiterModel:
27 | def __init__(self, bc_session: Session, service_name: str, api_version: str) -> None: ...
28 | def get_waiter(self, waiter_name: str) -> Waiter: ...
29 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/boto34/aioboto3_service.py.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | Wrapper for {{ package.library_name }} {{ package.service_name.class_name }} service.
3 |
4 | [Documentation]({{ package.get_local_doc_link() }})
5 |
6 | {{ copyright }}
7 | """
8 |
9 | from __future__ import annotations
10 |
11 | {% if package.service_resource %}
12 | from {{ main_package.name }}.{{ package.library_name }}.service_factory import ServiceResourceFactory
13 | {% else %}
14 | from {{ main_package.name }}.{{ package.library_name }}.service_factory import ServiceFactory
15 | {% endif %}
16 |
17 | from {{ package.name }}.client import {{ package.client.name }}
18 | {% if package.service_resource %}
19 | from {{ package.name }}.service_resource import {{ package.service_resource.name }}
20 | {% endif %}
21 |
22 | class {{ package.service_name.class_name }}Service(
23 | {% if package.service_resource %}
24 | ServiceResourceFactory[{{ package.client.name }}, {{ package.service_resource.name }}]
25 | {% else %}
26 | ServiceFactory[{{ package.client.name }}]
27 | {% endif %}
28 | ):
29 | """
30 | {{ package.service_name.class_name }} service wrapper.
31 |
32 | [Documentation]({{ package.get_local_doc_link() }})
33 | """
34 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/boto34/aiobotocore_service.py.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | Wrapper for {{ package.library_name }} {{ package.service_name.class_name }} service.
3 |
4 | [Documentation]({{ package.get_local_doc_link() }})
5 |
6 | {{ copyright }}
7 | """
8 |
9 | from __future__ import annotations
10 |
11 | from {{ main_package.name }}.{{ package.library_name }}.service_factory import ServiceFactory
12 | from {{ package.name }}.client import {{ package.client.name }}
13 |
14 | class {{ package.service_name.class_name }}Service(
15 | ServiceFactory[{{ package.client.name }}]
16 | ):
17 | """
18 | {{ package.service_name.class_name }} service wrapper.
19 |
20 | [Documentation]({{ package.get_local_doc_link() }})
21 | """
22 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/boto34/boto3_service.py.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | Wrapper for {{ package.library_name }} {{ package.service_name.class_name }} service.
3 |
4 | [Documentation]({{ package.get_local_doc_link() }})
5 |
6 | {{ copyright }}
7 | """
8 |
9 | from __future__ import annotations
10 |
11 | {% if package.service_resource %}
12 | from {{ main_package.name }}.{{ package.library_name }}.service_factory import ServiceResourceFactory
13 | {% else %}
14 | from {{ main_package.name }}.{{ package.library_name }}.service_factory import ServiceFactory
15 | {% endif %}
16 |
17 | from {{ package.name }}.client import {{ package.client.name }}
18 | {% if package.service_resource %}
19 | from {{ package.name }}.service_resource import {{ package.service_resource.name }}
20 | {% endif %}
21 |
22 | class {{ package.service_name.class_name }}Service(
23 | {% if package.service_resource %}
24 | ServiceResourceFactory[{{ package.client.name }}, {{ package.service_resource.name }}]
25 | {% else %}
26 | ServiceFactory[{{ package.client.name }}]
27 | {% endif %}
28 | ):
29 | """
30 | {{ package.service_name.class_name }} service wrapper.
31 |
32 | [Documentation]({{ package.get_local_doc_link() }})
33 | """
34 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/boto34/services.md.jinja2:
--------------------------------------------------------------------------------
1 | # Supported AWS services
2 |
3 | ## What is session
4 |
5 | Session is `boto34.boto3.Session` for [boto3](https://pypi.org/project/boto3/),
6 | `boto34.aioboto3.Session` for [aioboto3](https://pypi.org/project/aioboto3/),
7 | or `boto34.aiobotocore.Session` for [aiobotocore](https://pypi.org/project/aiobotocore/).
8 |
9 | You can use any service with any backend. Service availability depends on your [botocore](https://pypi.org/project/botocore/) version.
10 |
11 | Currently there are {{ len(package.service_packages) }} supported services.
12 |
13 | ## List of supported AWS services
14 |
15 | | Service name | Type annotated | Usage | boto3 equivalent |
16 | |-|-|-|-|
17 | {% for service_package in package.service_packages -%}
18 | | [{{ service_package.service_name.class_name }}]({{ service_package.service_name.boto3_doc_link }}) | ✓ | `session.{{ package.get_property_name(service_package.service_name) }}.client(...)`{% if service_package.service_resource %}
`session.{{ package.get_property_name(service_package.service_name) }}.resource(...)`{% endif %} | `boto3.client("{{ service_package.service_name.boto3_name }}", ...)`{% if service_package.service_resource %}
`boto3.resource("{{ service_package.service_name.boto3_name }}", ...)`{% endif %} |{{ "\n" -}}
19 | {% endfor -%}
20 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/LICENSE.jinja2:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) {{ current_year }} Vlad Emelianov
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/argument.py.jinja2:
--------------------------------------------------------------------------------
1 | {{ argument.prefix -}}
2 | {{ argument.name -}}
3 | {% if argument.type_annotation -%}
4 | {{ ': ' -}}
5 | {{ argument.type_annotation.render() -}}
6 | {% if not argument.required -%}
7 | {{ ' = ' -}}
8 | {{ argument.default.render() -}}
9 | {% endif -%}
10 | {% else -%}
11 | {% if not argument.required -%}
12 | {{ '=' -}}
13 | {{ argument.default.render() -}}
14 | {% endif -%}
15 | {% endif -%}
16 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/arguments_list.md.jinja2:
--------------------------------------------------------------------------------
1 | {% for argument in arguments -%}
2 | {% if not argument.is_kwflag() -%}
3 | {% with type_annotation=argument.type_annotation -%}
4 | - `{{ argument.name }}`{% if type_annotation %}: {% include "common/type_annotation.md.jinja2" with context -%}{% endif %}{{ ' *(required)*' if argument.required else '' -}}{{ '\n' -}}
5 | {% endwith -%}
6 | {% endif -%}
7 | {% endfor -%}
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/arguments_list_code.md.jinja2:
--------------------------------------------------------------------------------
1 | {% for argument in method.arguments -%}
2 | {{ ' ' -}}
3 | {{ argument.name -}}
4 | {% if argument.type_annotation -%}{{ ': ' -}}
5 | {% with type_annotation=argument.type_annotation -%}
6 | {% include "common/type_annotation_code.md.jinja2" with context -%}
7 | {% endwith -%}
8 | {% endif -%}
9 | {% if not argument.required -%}
10 | {{ ' = ' -}}
11 | {{ argument.default.render() -}}
12 | {% endif -%}
13 | {{ ',' -}}
14 | {% if argument.type_annotation and argument.type_annotation in method.type_hint_annotations -%}
15 | {{ ' # (' -}}{{ method.type_hint_annotations.index(argument.type_annotation) + 1 -}}{{ ')' -}}
16 | {% endif -%}
17 | {{ '\n' -}}
18 | {% endfor -%}
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/class.py.jinja2:
--------------------------------------------------------------------------------
1 | {% for base in class.bases -%}{{ base.render_definition() -}}{% endfor -%}
2 |
3 | class {{ class.name }}{% if class.bases %}({% for base in class.bases %}{{ base.render() }}{{ ", " if not loop.last else "" -}}{% endfor %}){% endif %}:
4 | {% filter indent(4, True) -%}
5 | {{ "pass" if not class.attributes and not class.methods and not class.docstring else "" -}}
6 | {% if class.docstring -%}
7 | {{ '"""\n' -}}
8 | {{ class.docstring -}}
9 | {{ '\n' -}}
10 | {{ '"""\n' -}}
11 | {% endif -%}
12 | {% if class.attributes -%}
13 | {% for attribute in class.attributes -%}
14 | {{ attribute.render() -}}{{ "\n" -}}
15 | {% endfor -%}
16 | {{ "\n" -}}
17 | {% endif -%}
18 | {% for method in class.methods -%}
19 | {% include "common/method.py.jinja2" with context -%}
20 | {{ "\n\n" if not loop.last else "" -}}
21 | {% endfor -%}
22 | {% endfilter -%}
23 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/function.py.jinja2:
--------------------------------------------------------------------------------
1 | {% for decorator in function.decorators -%}
2 | {{ '@' -}}{{ decorator -}}
3 | {% if loop.first and function.type_ignore -%}
4 | {{ ' # type: ignore[' -}}{{ function.type_ignore -}}{{ ']' -}}
5 | {% endif -%}
6 | {{ '\n' -}}
7 | {% endfor -%}
8 | {% if function.is_async -%}{{ 'async ' -}}{% endif -%}{{ 'def ' -}}{{ function.name -}}{{ '(' -}}
9 | {% if function.type_ignore -%}{{ ' # type: ignore[' -}}{{ function.type_ignore -}}{{ ']' -}}{% endif -%}
10 | {{ '\n' -}}
11 | {% filter indent(4, True) -%}
12 | {% for argument in function.iterate_packed_arguments() -%}
13 | {% include "common/argument.py.jinja2" with context -%}
14 | {{ ",\n" if not loop.last else "\n" -}}
15 | {% endfor -%}
16 | {% endfilter -%}
17 | {{ ') -> ' -}}{{ function.return_type.render() -}}{{ ':\n' -}}
18 | {% filter indent(4, True) -%}
19 | {% if not function.docstring and not function.body -%}
20 | {{ 'pass' -}}
21 | {% endif -%}
22 | {% if function.docstring -%}
23 | {{ '"""\n' -}}
24 | {{ function.docstring -}}
25 | {{ '\n' -}}
26 | {{ '"""\n' -}}
27 | {% endif -%}
28 | {% if function.body -%}
29 | {{ function.body -}}
30 | {{ '\n' -}}
31 | {% endif -%}
32 | {% endfilter -%}
33 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/header_note.md.jinja2:
--------------------------------------------------------------------------------
1 | !!! note ""
2 |
3 | Auto-generated documentation for [{{ package.service_name.class_name }}]({{ package.service_name.boto3_doc_link }})
4 | type annotations stubs module [{{ package.pypi_name }}]({{ package.url.pypi }}).
5 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/import_record_string.py.jinja2:
--------------------------------------------------------------------------------
1 | {% if import_record.name -%}
2 | {% if import_record.alias -%}
3 | {{ 'from ' -}}{{ import_record.source -}}{{ ' import ' -}}{{ import_record.name -}}{{ ' as ' -}}{{ import_record.alias -}}
4 | {% else -%}
5 | {{ 'from ' -}}{{ import_record.source -}}{{ ' import ' -}}{{ import_record.name -}}
6 | {% endif -%}
7 | {% else -%}
8 | {% if import_record.alias -%}
9 | {{ 'import ' -}}{{ import_record.source -}}{{ ' as ' -}}{{ import_record.alias -}}
10 | {% else -%}
11 | {{ 'import ' -}}{{ import_record.source -}}
12 | {% endif -%}
13 | {% endif -%}
14 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/literal.py.jinja2:
--------------------------------------------------------------------------------
1 | {{ literal.name -}}
2 | {{ ' = Literal[' -}}
3 | {% for child in sorted(literal.children) -%}
4 | {{ repr(child) -}}
5 | {{ ", " if not loop.last -}}
6 | {% endfor -%}
7 | {{ ']' -}}
8 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/method.md.jinja2:
--------------------------------------------------------------------------------
1 | {% if method.is_async %}
2 | Asynchronous method. Use `await {{ method.name }}(...)` for a synchronous call.
3 | {% endif %}
4 |
5 | {% if method.has_arguments() %}
6 | {% if method.has_request_type_annotation() %}
7 | Arguments mapping described in {% with type_annotation=method.request_type_annotation %}{% include "common/type_annotation.md.jinja2" with context -%}{% endwith -%}.
8 | {% endif %}
9 | {% if method.is_kw_only() %}Keyword-only arguments:{% else %}Arguments:{% endif %}
10 | {% with arguments=method.iterate_call_arguments() -%}
11 | {% include "common/arguments_list.md.jinja2" with context -%}
12 | {% endwith %}
13 | {% endif %}
14 |
15 | {% if not method.returns_none %}
16 | Returns{% if method.is_async %} a `Coroutine` for{%endif%} {% with type_annotation=method.return_type -%}{% include "common/type_annotation.md.jinja2" with context -%}{% endwith -%}.
17 | {% endif %}
18 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/method.py.jinja2:
--------------------------------------------------------------------------------
1 | {% set function = method -%}
2 | {% include "common/function.py.jinja2" with context -%}
3 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/named_union.py.jinja2:
--------------------------------------------------------------------------------
1 | {{ type_def.name }} = {{ type_def.parent.render() }}{{ "[" -}}
2 | {% for child in type_def.iterate_children() -%}
3 | {{ child.render() -}}
4 | {{ ", " if not loop.last -}}
5 | {% endfor -%}
6 | {{ "]" -}}
7 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/readme/literals.md.jinja2:
--------------------------------------------------------------------------------
1 |
2 | {% if package.literals %}
3 | ### Literals
4 |
5 | `{{ package.name }}.literals` module contains literals extracted from shapes
6 | that can be used in user code for type checking.
7 |
8 | Full list of `{{ service_name.class_name }}` Literals can be found in [docs]({{ package.get_doc_link('literals') }}).
9 |
10 | ```python
11 | from {{ package.name }}.literals import {{ package.literals[0].name }}
12 |
13 | def check_value(value: {{ package.literals[0].name }}) -> bool:
14 | ...
15 | ```
16 | {% endif -%}
17 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/readme/type_defs.md.jinja2:
--------------------------------------------------------------------------------
1 | {% if package.type_defs %}
2 | ### Type definitions
3 |
4 | `{{ package.name }}.type_defs` module contains structures and shapes assembled
5 | to typed dictionaries and unions for additional type checking.
6 |
7 | Full list of `{{ service_name.class_name }}` TypeDefs can be found in [docs]({{ package.get_doc_link('type_defs') }}).
8 |
9 | {% for typed_dict in package.iterate_typed_dicts(limit=1) -%}
10 | ```python
11 | # TypedDict usage example
12 | from {{ package.name }}.type_defs import {{ typed_dict.name }}
13 |
14 | def get_value() -> {{ typed_dict.name }}:
15 | return {
16 | "{{ typed_dict.children[0].name -}}": ...,
17 | }
18 | ```
19 | {% endfor %}
20 |
21 | {% endif -%}
22 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/service/literals.pyi.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for {{ package.service_name.boto3_name }} service literal definitions.
3 |
4 | [Documentation]({{ package.get_doc_link("literals") }})
5 |
6 | {{ copyright }}
7 |
8 | Usage::
9 |
10 | ```python
11 | from {{ package.name }}.literals import {{ package.literals[0].name }}
12 |
13 | data: {{ package.literals[0].name }} = "{{ package.literals[0].children|min }}"
14 | ```
15 | """
16 | {% for import_record in package.get_literals_required_import_records() -%}
17 | {{ import_record -}}{{ "\n" -}}
18 | {% endfor -%}
19 |
20 | {{ "\n\n" -}}
21 |
22 | __all__ = (
23 | {% for literal_name in package.get_literals_all_names() -%}
24 | {{ '"' -}}
25 | {{ literal_name -}}
26 | {{ '"' -}}
27 | {{ ",\n" if not loop.last or loop.first else "\n" }}
28 | {% endfor -%}
29 | )
30 |
31 |
32 | {% for literal in package.literals -%}
33 | {{ literal.render_definition() -}}
34 | {{ "\n" -}}
35 | {% endfor -%}
36 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/service/type_defs.pyi.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for {{ package.service_name.boto3_name }} service type definitions.
3 |
4 | [Documentation]({{ package.get_doc_link("type_defs") }})
5 |
6 | {{ copyright }}
7 |
8 | Usage::
9 |
10 | ```python
11 | from {{ package.name }}.type_defs import {{ package.type_defs[0].name }}
12 |
13 | data: {{ package.type_defs[0].name }} = ...
14 | ```
15 | """
16 | {% for import_record in package.get_type_defs_required_import_records() -%}
17 | {{ import_record -}}{{ "\n" -}}
18 | {% endfor -%}
19 |
20 | {{ "\n\n" -}}
21 |
22 | __all__ = (
23 | {% for type_def_name in package.get_type_defs_all_names() -%}
24 | {{ '"' -}}
25 | {{ type_def_name -}}
26 | {{ '"' -}}
27 | {{ ",\n" if not loop.last or loop.first else "\n" }}
28 | {% endfor -%}
29 | )
30 |
31 | {% for type_def in package.type_defs -%}
32 | {{ type_def.render_definition() -}}
33 | {{ "\n" -}}
34 | {% endfor -%}
35 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/service/version.py.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | Source of truth for version.
3 |
4 | {{ copyright }}
5 | """
6 | __version__ = "{{ package.version }}"
7 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/service_docs/literals.md.jinja2:
--------------------------------------------------------------------------------
1 | # Literals
2 |
3 | > [Index](../README.md) > [{{ service_name.class_name }}](./README.md) > Literals
4 |
5 | {% include "common/header_note.md.jinja2" with context %}
6 |
7 | {% for literal in package.literals -%}
8 | ## {{ literal.name }}
9 |
10 | ```python
11 | # {{ literal.name }} usage example
12 | from {{ package.name }}.literals import {{ literal.name }}
13 |
14 | def get_value() -> {{ literal.name }}:
15 | return "{{ sorted(literal.children)[0] }}"
16 | ```
17 |
18 | ```python
19 | # {{ literal.name }} definition
20 | {{ literal.name }} = Literal[
21 | {% for child in literal.children|sort -%}
22 | {{ ' "' -}}{{ child }}{{ '",' -}}{{ '\n' -}}
23 | {% endfor -%}
24 | ]
25 | ```
26 | {% endfor %}
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/service_docs/readme_literals.md.jinja2:
--------------------------------------------------------------------------------
1 | {% if package.literals %}
2 | ## Literals
3 |
4 | Type annotations for [literals]({{ get_md_doc_link('literals') }}) used in methods and schema.
5 |
6 | ```python
7 | # {{ package.literals[0].name }} usage example
8 |
9 | from {{ package.name }}.literals import {{ package.literals[0].name }}
10 |
11 | def get_value() -> {{ package.literals[0].name }}:
12 | return "{{ sorted(package.literals[0].children)[0] }}"
13 | ```
14 |
15 | {% for literal in package.literals -%}
16 | - [{{ literal.name }}]({{ get_md_doc_link('literals', literal.name) }}){{ '\n' -}}
17 | {% endfor %}
18 | {% endif %}
19 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/service_docs/readme_resources.md.jinja2:
--------------------------------------------------------------------------------
1 |
2 | {% if package.service_resource.sub_resources %}
3 | ### Resources
4 |
5 | Type annotations and code completion for additional resources
6 | from `#!python session.resource("{{ package.service_name.boto3_name }}").*`.
7 |
8 | ```python
9 | # {{ package.service_resource.sub_resources[0].name }} usage example
10 |
11 | from {{ package.name }}.service_resource import {{ package.service_resource.sub_resources[0].name }}
12 |
13 | def get_resource() -> {{ package.service_resource.sub_resources[0].name }}:
14 | return resource.{{ package.service_resource.sub_resources[0].name }}(...)
15 | ```
16 |
17 | {% for sub_resource in package.service_resource.sub_resources -%}
18 | - [{{ sub_resource.name }}]({{ get_md_doc_link('service_resource', sub_resource.name) }}){{ '\n' -}}
19 | {% endfor %}
20 | {% endif %}
21 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/service_docs/readme_type_defs.md.jinja2:
--------------------------------------------------------------------------------
1 | {% if package.type_defs %}
2 | ## Type definitions
3 |
4 | Type annotations for [type definitions]({{ get_md_doc_link('type_defs') }}) used in methods and schema.
5 |
6 | {% for type_def in package.type_defs -%}
7 | - [{{ type_def.name }}]({{ get_md_doc_link('type_defs', type_def.name) }}){{ '\n' -}}
8 | {% endfor %}
9 | {% endif %}
10 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/type_annotation_code.md.jinja2:
--------------------------------------------------------------------------------
1 | {% if is_typed_dict(type_annotation) -%}
2 | {{ type_annotation.name -}}
3 | {% elif is_literal(type_annotation) -%}
4 | {{ type_annotation.name -}}
5 | {% elif is_type_def(type_annotation) -%}
6 | {{ type_annotation.name -}}
7 | {% elif is_external_import(type_annotation) -%}
8 | {{ type_annotation.render_top_level() -}}
9 | {% elif is_union(type_annotation) -%}
10 | {% for child in type_annotation.children -%}
11 | {% with type_annotation=child -%}
12 | {% include "common/type_annotation_code.md.jinja2" with context -%}
13 | {% endwith -%}
14 | {{ "" if loop.last else " | " -}}
15 | {% endfor -%}
16 | {% elif is_type_parent(type_annotation) -%}
17 | {% with type_annotation=type_annotation.parent -%}
18 | {% include "common/type_annotation_code.md.jinja2" with context -%}
19 | {% endwith -%}
20 | {{ '[' -}}
21 | {% for child in type_annotation.children -%}
22 | {% with type_annotation=child -%}
23 | {% include "common/type_annotation_code.md.jinja2" with context -%}
24 | {% endwith -%}
25 | {{ "" if loop.last else ", " -}}
26 | {% endfor -%}
27 | {{ ']' -}}
28 | {% else -%}
29 | {{ type_annotation.render() -}}
30 | {% endif -%}
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/type_hint.md.jinja2:
--------------------------------------------------------------------------------
1 | {% if is_typed_dict(type_annotation) -%}
2 | [:material-code-braces: {{ type_annotation.name }}]({{ get_md_doc_link("type_defs", type_annotation.name) }}{{ ')' -}}
3 | {% elif is_literal(type_annotation) -%}
4 | [:material-code-brackets: {{ type_annotation.name }}]({{ get_md_doc_link("literals", type_annotation.name) }}{{ ')' -}}
5 | {% elif is_type_def(type_annotation) -%}
6 | [:material-code-braces: {{ type_annotation.name }}{{ '](#' }}{{ get_anchor_link(type_annotation.name) }}{{ ')' -}}
7 | {% elif is_internal_import(type_annotation) -%}
8 | [{{ type_annotation.name }}]({{ get_md_doc_link(type_annotation.module_name.value, type_annotation.name) }}{{ ')' -}}
9 | {% elif is_external_import(type_annotation) -%}
10 | {{ '`' -}}{{ type_annotation.render_top_level() }}{{ '`' -}}
11 | {% else -%}
12 | {{ '`' -}}{{ type_annotation.render() }}{{ '`' -}}
13 | {% endif -%}
14 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/typed_dict.py.jinja2:
--------------------------------------------------------------------------------
1 | {{ type_def.name -}}
2 | {{ ' = TypedDict("' -}}
3 | {{ type_def.name -}}
4 | {{ '", {' -}}
5 | {% for child in type_def.iterate_children() -%}
6 | {{ child.render() -}}
7 | {{ ", " -}}
8 | {% endfor -%}
9 | {{ "}" -}}
10 | {{ ")" -}}
11 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/typed_dict_class.py.jinja2:
--------------------------------------------------------------------------------
1 | class {{ type_def.name -}}(TypedDict):
2 | {% for child in type_def.iterate_children() -%}
3 | {{ ' ' -}}{{ child.render_attribute() -}}{{ '\n' -}}
4 | {% endfor -%}
5 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/common/wrapper/README.md.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/header.md.jinja2" with context %}
2 |
3 | {% include "common/how_to_install.md.jinja2" with context %}
4 |
5 | {% with extras_name="essential" %}
6 | {% include "common/usage.md.jinja2" with context %}
7 | {% endwith %}
8 |
9 | {% include "common/footer.md.jinja2" with context %}
10 |
11 | {% include "common/submodules.md.jinja2" with context %}
12 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/mypy-boto3/mypy_boto3/__init__.py.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | mypy-boto3 main entrypoint.
3 |
4 | {{ copyright }}
5 | """
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/mypy-boto3/mypy_boto3/__main__.py.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | mypy-boto3 module entrypoint.
3 |
4 | {{ copyright }}
5 | """
6 | from {{ package.name }}.main import main
7 |
8 | main()
9 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/mypy-boto3/mypy_boto3/boto3_init.py.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | boto3.__init__ stub.
3 |
4 | {{ copyright }}
5 | """
6 | try:
7 | from {{ package.name }}.boto3_init_gen import *
8 | except ImportError:
9 | pass
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/mypy-boto3/mypy_boto3/boto3_init_stub.py.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | boto3.__init__ stub.
3 |
4 | {{ copyright }}
5 | """
6 | from typing import Any, Union
7 |
8 | from botocore.config import Config
9 | from botocore.client import BaseClient
10 |
11 | def client(
12 | service_name: str,
13 | region_name: str = None,
14 | api_version: str = None,
15 | use_ssl: bool = None,
16 | verify: Union[str, bool] = None,
17 | endpoint_url: str = None,
18 | aws_access_key_id: str = None,
19 | aws_secret_access_key: str = None,
20 | aws_session_token: str = None,
21 | config: Config = None,
22 | ) -> BaseClient:
23 | pass
24 |
25 | def resource(
26 | service_name: str,
27 | region_name: str = None,
28 | api_version: str = None,
29 | use_ssl: bool = None,
30 | verify: Union[str, bool] = None,
31 | endpoint_url: str = None,
32 | aws_access_key_id: str = None,
33 | aws_secret_access_key: str = None,
34 | aws_session_token: str = None,
35 | config: Config = None,
36 | ) -> Any:
37 | pass
38 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/mypy-boto3/mypy_boto3/boto3_session.py.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | boto3.session stub.
3 |
4 | {{ copyright }}
5 | """
6 | try:
7 | from mypy_boto3.boto3_session_gen import *
8 | except ImportError:
9 | pass
10 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/mypy-boto3/mypy_boto3/boto3_session_stub.py.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | boto3.session stub.
3 |
4 | {{ copyright }}
5 | """
6 | from typing import Any, Union, Optional
7 |
8 | from botocore.config import Config
9 | from botocore.client import BaseClient
10 |
11 | class Session:
12 | def client(
13 | self,
14 | service_name: str,
15 | region_name: Optional[str] = None,
16 | api_version: Optional[str] = None,
17 | use_ssl: Optional[bool] = None,
18 | verify: Optional[Union[str, bool]] = None,
19 | endpoint_url: Optional[str] = None,
20 | aws_access_key_id: Optional[str] = None,
21 | aws_secret_access_key: Optional[str] = None,
22 | aws_session_token: Optional[str] = None,
23 | config: Optional[Config] = None,
24 | ) -> BaseClient:
25 | pass
26 |
27 | def resource(
28 | self,
29 | service_name: str,
30 | region_name: Optional[str] = None,
31 | api_version: Optional[str] = None,
32 | use_ssl: Optional[bool] = None,
33 | verify: Optional[Union[str, bool]] = None,
34 | endpoint_url: Optional[str] = None,
35 | aws_access_key_id: Optional[str] = None,
36 | aws_secret_access_key: Optional[str] = None,
37 | aws_session_token: Optional[str] = None,
38 | config: Optional[Config] = None,
39 | ) -> Any:
40 | pass
41 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/mypy-boto3/mypy_boto3/literals.py.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | Literals for boto3 services.
3 |
4 | {{ copyright }}
5 | """
6 |
7 | try:
8 | from typing_extensions import Literal
9 | except ImportError:
10 | from typing import Literal
11 |
12 | __all__ = (
13 | {% for literal in package.literals -%}
14 | {{ '"' -}}
15 | {{ literal.name -}}
16 | {{ '"' -}}
17 | {{ ",\n" if not loop.last or loop.first else "\n" }}
18 | {% endfor -%}
19 | )
20 |
21 | {% for literal in package.literals -%}
22 | {{ literal.render_definition() -}}
23 | {{ "\n" -}}
24 | {% endfor -%}
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/mypy-boto3/mypy_boto3/py.typed.jinja2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/templates/mypy-boto3/mypy_boto3/py.typed.jinja2
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/mypy-boto3/mypy_boto3/version.py.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | Source of truth for version.
3 |
4 | {{ copyright }}
5 | """
6 | __version__ = "{{ package.version }}"
7 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aioboto3-custom/README.md.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/wrapper/README.md.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aioboto3-custom/aioboto3-stubs/py.typed.jinja2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/templates/types-aioboto3-custom/aioboto3-stubs/py.typed.jinja2
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aioboto3-custom/aioboto3-stubs/session.pyi.jinja2:
--------------------------------------------------------------------------------
1 | {% include "types-aioboto3/aioboto3-stubs/session.pyi.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aioboto3-custom/setup.py.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/wrapper/setup.py.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aioboto3-docs/README.md.jinja2:
--------------------------------------------------------------------------------
1 | # Type annotations for {{ package.library_name }}
2 |
3 | Auto-generated documentation for [{{ package.library_name }}]({{ package.url.library_pypi }})
4 | type annotations package [{{ package.pypi_name }}]({{ package.url.pypi }}).
5 |
6 | Generated with [{{ builder_package_name }} {{ builder_version }}]({{ builder_repo_url }}).
7 |
8 | {% include "common/how_to_install.md.jinja2" with context %}
9 |
10 | ## Packages
11 | - [{{ package.data.pypi_stubs_name }}]({{ package.url.stubs_pypi }}) - [{{ package.library_name }}]({{ package.url.library_pypi }}) type annotations with `session.resource` overloads
12 | - [{{ package.data.pypi_lite_name }}]({{ package.url.stubs_lite_pypi }}) - [{{ package.library_name }}]({{ package.url.library_pypi }}) type annotations with `session.resource` overloads
13 | - [{{ package.data.pypi_full_name }}]({{ package.url.stubs_full_pypi }}) - type annotations for all services below in one package
14 | {% for service_name in package.service_names %}
15 | - [{{ package.get_service_pypi_name(service_name) }}](./{{ package.get_module_name(service_name) }}/README.md) - type annotations for [{{ service_name.class_name }}]({{ service_name.boto3_doc_link }}) service
16 | {% endfor %}
17 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aioboto3-service-docs/literals.md.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/service_docs/literals.md.jinja2" with context -%}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aioboto3-service-docs/type_defs.md.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/service_docs/type_defs.md.jinja2" with context -%}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aioboto3-service-docs/waiters.md.jinja2:
--------------------------------------------------------------------------------
1 | # Waiters
2 |
3 | > [Index](../README.md) > [{{ service_name.class_name }}](./README.md) > Waiters
4 |
5 | {% include "common/header_note.md.jinja2" with context %}
6 |
7 | {% for waiter in package.waiters -%}
8 | ## {{ waiter.name }}
9 |
10 | Type annotations and code completion for `#!python session.client("{{ service_name.boto3_name }}").get_waiter("{{ waiter.attribute_name }}")`.
11 | [:material-aws: boto3 documentation]({{ waiter.boto3_doc_link }})
12 |
13 | ```python
14 | # {{ waiter.name }} usage example
15 |
16 | from {{ package.library_name }}.session import Session
17 |
18 | from {{ package.name }}.waiter import {{ waiter.name }}
19 |
20 | session = get_session()
21 | async with session.client("{{ service_name.boto3_name }}") as client: # (1)
22 | waiter: {{ waiter.name }} = client.get_waiter("{{ waiter.attribute_name }}") # (2)
23 | await waiter.wait(...)
24 | ```
25 |
26 | 1. client: [{{ package.client.name }}]({{ get_md_doc_link('client') }})
27 | 2. waiter: [{{ waiter.name }}]({{ get_md_doc_link('waiters', waiter.name) }})
28 |
29 | {% for method in waiter.methods %}
30 | ### {{ method.name|escape_md }}
31 |
32 | Type annotations and code completion for `#!python {{ waiter.name }}.{{ method.name }}` method.
33 |
34 | {% include "common/method_code.md.jinja2" with context -%}
35 |
36 | {% endfor -%}
37 | {% endfor %}
38 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aioboto3/README.md.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/wrapper/README.md.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aioboto3/aioboto3-stubs/py.typed.jinja2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/templates/types-aioboto3/aioboto3-stubs/py.typed.jinja2
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aioboto3/setup.py.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/wrapper/setup.py.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore-custom/README.md.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/wrapper/README.md.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore-custom/aiobotocore-stubs/py.typed.jinja2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/templates/types-aiobotocore-custom/aiobotocore-stubs/py.typed.jinja2
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore-custom/aiobotocore-stubs/session.pyi.jinja2:
--------------------------------------------------------------------------------
1 | {% include "types-aiobotocore/aiobotocore-stubs/session.pyi.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore-custom/setup.py.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/wrapper/setup.py.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore-docs/README.md.jinja2:
--------------------------------------------------------------------------------
1 | # Type annotations for {{ package.library_name }}
2 |
3 | Auto-generated documentation for [{{ package.library_name }}]({{ package.url.library_pypi }})
4 | type annotations package [{{ package.pypi_name }}]({{ package.url.pypi }}).
5 |
6 | Generated with [{{ builder_package_name }} {{ builder_version }}]({{ builder_repo_url }}).
7 |
8 | {% include "common/how_to_install.md.jinja2" with context %}
9 |
10 | ## Packages
11 | - [{{ package.data.pypi_stubs_name }}]({{ package.url.stubs_pypi }}) - [{{ package.library_name }}]({{ package.url.library_pypi }}) type annotations with `session.create_client` overloads
12 | - [{{ package.data.pypi_lite_name }}]({{ package.url.stubs_lite_pypi }}) - [{{ package.library_name }}]({{ package.url.library_pypi }}) type annotations with `session.create_client` overloads
13 | - [{{ package.data.pypi_full_name }}]({{ package.url.stubs_full_pypi }}) - type annotations for all services below in one package
14 | {% for service_name in package.service_names %}
15 | - [{{ package.get_service_pypi_name(service_name) }}](./{{ package.get_module_name(service_name) }}/README.md) - type annotations for [{{ service_name.class_name }}]({{ service_name.boto3_doc_link }}) service
16 | {% endfor %}
17 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore-full/README.md.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/header.md.jinja2" with context %}
2 |
3 | {% include "common/how_to_install_full.md.jinja2" with context %}
4 |
5 | {% include "common/usage_full.md.jinja2" with context %}
6 |
7 | {% include "common/footer.md.jinja2" with context %}
8 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore-full/setup.py.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/wrapper/setup.py.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore-service-docs/literals.md.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/service_docs/literals.md.jinja2" with context -%}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore-service-docs/type_defs.md.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/service_docs/type_defs.md.jinja2" with context -%}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore-service-docs/waiters.md.jinja2:
--------------------------------------------------------------------------------
1 | # Waiters
2 |
3 | > [Index](../README.md) > [{{ service_name.class_name }}](./README.md) > Waiters
4 |
5 | {% include "common/header_note.md.jinja2" with context %}
6 |
7 | {% for waiter in package.waiters -%}
8 | ## {{ waiter.name }}
9 |
10 | Type annotations and code completion for `#!python session.create_client("{{ service_name.boto3_name }}").get_waiter("{{ waiter.attribute_name }}")`.
11 | [:material-aws: boto3 documentation]({{ waiter.boto3_doc_link }})
12 |
13 | ```python
14 | # {{ waiter.name }} usage example
15 |
16 | from {{ package.library_name }}.session import Session
17 |
18 | from {{ package.name }}.waiter import {{ waiter.name }}
19 |
20 | session = get_session()
21 | async with session.create_client("{{ service_name.boto3_name }}") as client: # (1)
22 | waiter: {{ waiter.name }} = client.get_waiter("{{ waiter.attribute_name }}") # (2)
23 | await waiter.wait(...)
24 | ```
25 |
26 | 1. client: [{{ package.client.name }}]({{ get_md_doc_link('client') }})
27 | 2. waiter: [{{ waiter.name }}]({{ get_md_doc_link('waiters', waiter.name) }})
28 |
29 | {% for method in waiter.methods %}
30 | ### {{ method.name|escape_md }}
31 |
32 | Type annotations and code completion for `#!python {{ waiter.name }}.{{ method.name }}` method.
33 |
34 | {% include "common/method_code.md.jinja2" with context -%}
35 |
36 | {% endfor -%}
37 | {% endfor %}
38 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore-service/service/__main__.py.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | Main CLI entrypoint.
3 |
4 | {{ copyright }}
5 | """
6 | import sys
7 |
8 |
9 | def print_info() -> None:
10 | """
11 | Print package info to stdout.
12 | """
13 | sys.stdout.write(
14 | "Type annotations for {{ package.library_name }} {{ service_name.class_name }} {{ package.library_version }}\n"
15 | "Version: {{ package.version }}\n"
16 | "Builder version: {{ builder_version }}\n"
17 | "Docs: {{ package.get_local_doc_link() }}/\n"
18 | "Boto3 docs: {{ service_name.boto3_doc_link }}\n"
19 | "Other services: https://pypi.org/project/boto3-stubs/\n"
20 | "Changelog: {{ builder_repo_url }}/releases\n"
21 | )
22 |
23 |
24 | def print_version() -> None:
25 | """
26 | Print package version to stdout.
27 | """
28 | sys.stdout.write("{{ package.version }}\n")
29 |
30 |
31 | def main() -> None:
32 | """
33 | Main CLI entrypoint.
34 | """
35 | if "--version" in sys.argv:
36 | print_version()
37 | return
38 | print_info()
39 |
40 |
41 | if __name__ == "__main__":
42 | main()
43 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore-service/service/client.pyi.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for {{ package.service_name.boto3_name }} service Client.
3 |
4 | [Documentation]({{ package.get_doc_link("client") }})
5 |
6 | {{ copyright }}
7 |
8 | Usage::
9 |
10 | ```python
11 | from {{ package.library_name }}.session import get_session
12 | from {{ package.name }}.client import {{ package.client.name }}
13 |
14 | session = get_session()
15 | async with session.create_client("{{ package.service_name.boto3_name }}") as client:
16 | client: {{ package.client.name }}
17 | ```
18 | """
19 | {% for import_record in package.get_client_required_import_records() -%}
20 | {{ import_record -}}{{ "\n" -}}
21 | {% endfor -%}
22 |
23 | {{ "\n\n" -}}
24 |
25 | __all__ = (
26 | {% for name in package.client.get_all_names() -%}
27 | {{ '"' -}}
28 | {{ name -}}
29 | {{ '"' -}}
30 | {{ ",\n" if not loop.last or loop.first else "\n" }}
31 | {% endfor -%}
32 | )
33 |
34 | {% with class=package.client.exceptions_class -%}
35 | {% include "common/class.py.jinja2" with context -%}
36 | {% endwith -%}
37 |
38 | {{ "\n\n" -}}
39 |
40 | {% with class=package.client -%}
41 | {% include "common/class.py.jinja2" with context -%}
42 | {% endwith -%}
43 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore-service/service/literals.pyi.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/service/literals.pyi.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore-service/service/py.typed.jinja2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/templates/types-aiobotocore-service/service/py.typed.jinja2
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore-service/service/type_defs.pyi.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/service/type_defs.pyi.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore-service/service/version.py.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/service/version.py.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore-service/setup.py.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/service/setup.py.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore/README.md.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/wrapper/README.md.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore/aiobotocore-stubs/py.typed.jinja2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/templates/types-aiobotocore/aiobotocore-stubs/py.typed.jinja2
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-aiobotocore/setup.py.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/wrapper/setup.py.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-custom/README.md.jinja2:
--------------------------------------------------------------------------------
1 | {% include "types-boto3/README.md.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-custom/boto3-stubs/__init__.pyi.jinja2:
--------------------------------------------------------------------------------
1 | {% include "types-boto3/boto3-stubs/__init__.pyi.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-custom/boto3-stubs/py.typed.jinja2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/templates/types-boto3-custom/boto3-stubs/py.typed.jinja2
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-custom/boto3-stubs/session.pyi.jinja2:
--------------------------------------------------------------------------------
1 | {% include "types-boto3/boto3-stubs/session.pyi.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-custom/setup.py.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/wrapper/setup.py.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-docs/README.md.jinja2:
--------------------------------------------------------------------------------
1 | # Type annotations for {{ package.library_name }}
2 |
3 | Auto-generated documentation for [{{ package.library_name }}]({{ package.url.library_pypi }})
4 | type annotations package [{{ package.pypi_name }}]({{ package.url.pypi }}).
5 |
6 | Generated with [{{ builder_package_name }} {{ builder_version }}]({{ builder_repo_url }}).
7 |
8 | {% include "common/how_to_install.md.jinja2" with context %}
9 |
10 | ## Packages
11 | - [{{ package.data.pypi_stubs_name }}]({{ package.url.stubs_pypi }}) - [{{ package.library_name }}]({{ package.url.library_pypi }}) type annotations with `session.client/resource` overloads
12 | - [{{ package.data.pypi_lite_name }}]({{ package.url.stubs_lite_pypi }}) - [{{ package.library_name }}]({{ package.url.library_pypi }}) type annotations without `session.client/resource` overloads
13 | - [{{ package.data.pypi_full_name }}]({{ package.url.stubs_full_pypi }}) - type annotations for all services below in one package
14 | {% for service_name in package.service_names %}
15 | - [{{ package.get_service_pypi_name(service_name) }}](./{{ package.get_module_name(service_name) }}/README.md) - type annotations for [{{ service_name.class_name }}]({{ service_name.boto3_doc_link }}) service
16 | {% endfor %}
17 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-full/README.md.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/header.md.jinja2" with context %}
2 |
3 | {% include "common/how_to_install_full.md.jinja2" with context %}
4 |
5 | {% include "common/usage_full.md.jinja2" with context %}
6 |
7 | ### Explicit type annotations
8 |
9 | To speed up type checking and code completion, you can set types explicitly.
10 |
11 | ```python
12 | import boto3
13 | from boto3.session import Session
14 |
15 | from {{ package.data.service_prefix }}_ec2.client import EC2Client
16 | from {{ package.data.service_prefix }}_ec2.service_resource import EC2ServiceResource
17 | from {{ package.data.service_prefix }}_ec2.waiter import BundleTaskCompleteWaiter
18 | from {{ package.data.service_prefix }}_ec2.paginator import DescribeVolumesPaginator
19 |
20 | session = Session(region_name="us-west-1")
21 |
22 | ec2_client: EC2Client = boto3.client("ec2", region_name="us-west-1")
23 | ec2_resource: EC2ServiceResource = session.resource("ec2")
24 |
25 | bundle_task_complete_waiter: BundleTaskCompleteWaiter = ec2_client.get_waiter("bundle_task_complete")
26 | describe_volumes_paginator: DescribeVolumesPaginator = ec2_client.get_paginator("describe_volumes")
27 | ```
28 |
29 | {% include "common/footer.md.jinja2" with context %}
30 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-full/setup.py.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/wrapper/setup.py.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-service-docs/literals.md.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/service_docs/literals.md.jinja2" with context -%}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-service-docs/type_defs.md.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/service_docs/type_defs.md.jinja2" with context -%}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-service-docs/waiters.md.jinja2:
--------------------------------------------------------------------------------
1 | # Waiters
2 |
3 | > [Index](../README.md) > [{{ service_name.class_name }}](./README.md) > Waiters
4 |
5 | {% include "common/header_note.md.jinja2" with context %}
6 |
7 | {% for waiter in package.waiters -%}
8 | ## {{ waiter.name }}
9 |
10 | Type annotations and code completion for `#!python {{ package.library_name }}.client("{{ service_name.boto3_name }}").get_waiter("{{ waiter.attribute_name }}")`.
11 | [:material-aws: boto3 documentation]({{ waiter.boto3_doc_link }})
12 |
13 | ```python
14 | # {{ waiter.name }} usage example
15 |
16 | from {{ package.library_name }}.session import Session
17 |
18 | from {{ package.name }}.waiter import {{ waiter.name }}
19 |
20 |
21 | session = Session()
22 |
23 | client = session.client("{{ service_name.boto3_name }}") # (1)
24 | waiter: {{ waiter.name }} = client.get_waiter("{{ waiter.attribute_name }}") # (2)
25 | await waiter.wait(...)
26 | ```
27 |
28 | 1. client: [{{ package.client.name }}]({{ get_md_doc_link('client') }})
29 | 2. waiter: [{{ waiter.name }}]({{ get_md_doc_link('waiters', waiter.name) }})
30 |
31 | {% for method in waiter.methods %}
32 | ### {{ method.name|escape_md }}
33 |
34 | Type annotations and code completion for `#!python {{ waiter.name }}.{{ method.name }}` method.
35 |
36 | {% include "common/method_code.md.jinja2" with context -%}
37 |
38 | {% endfor -%}
39 | {% endfor %}
40 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-service/service/__main__.py.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | Main CLI entrypoint.
3 |
4 | {{ copyright }}
5 | """
6 | import sys
7 |
8 |
9 | def print_info() -> None:
10 | """
11 | Print package info to stdout.
12 | """
13 | sys.stdout.write(
14 | "Type annotations for {{ package.library_name }} {{ service_name.class_name }} {{ package.library_version }}\n"
15 | "Version: {{ package.version }}\n"
16 | "Builder version: {{ builder_version }}\n"
17 | "Docs: {{ package.get_local_doc_link() }}/\n"
18 | "Boto3 docs: {{ service_name.boto3_doc_link }}\n"
19 | "Other services: https://pypi.org/project/boto3-stubs/\n"
20 | "Changelog: {{ builder_repo_url }}/releases\n"
21 | )
22 |
23 |
24 | def print_version() -> None:
25 | """
26 | Print package version to stdout.
27 | """
28 | sys.stdout.write("{{ package.version }}\n")
29 |
30 |
31 | def main() -> None:
32 | """
33 | Main CLI entrypoint.
34 | """
35 | if "--version" in sys.argv:
36 | print_version()
37 | return
38 | print_info()
39 |
40 |
41 | if __name__ == "__main__":
42 | main()
43 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-service/service/client.pyi.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for {{ package.service_name.boto3_name }} service Client.
3 |
4 | [Documentation]({{ package.get_doc_link("client") }})
5 |
6 | {{ copyright }}
7 |
8 | Usage::
9 |
10 | ```python
11 | from {{ package.library_name }}.session import Session
12 | from {{ package.name }}.client import {{ package.client.name }}
13 |
14 | session = Session()
15 | client: {{ package.client.name }} = session.client("{{ package.service_name.boto3_name }}")
16 | ```
17 | """
18 | {% for import_record in package.get_client_required_import_records() -%}
19 | {{ import_record -}}{{ "\n" -}}
20 | {% endfor -%}
21 |
22 | {{ "\n\n" -}}
23 |
24 | __all__ = (
25 | {% for name in package.client.get_all_names() -%}
26 | {{ '"' -}}
27 | {{ name -}}
28 | {{ '"' -}}
29 | {{ ",\n" if not loop.last or loop.first else "\n" }}
30 | {% endfor -%}
31 | )
32 |
33 | {% with class=package.client.exceptions_class -%}
34 | {% include "common/class.py.jinja2" with context -%}
35 | {% endwith -%}
36 |
37 | {{ "\n\n" -}}
38 |
39 | {% with class=package.client -%}
40 | {% include "common/class.py.jinja2" with context -%}
41 | {% endwith -%}
42 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-service/service/literals.pyi.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/service/literals.pyi.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-service/service/py.typed.jinja2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/templates/types-boto3-service/service/py.typed.jinja2
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-service/service/type_defs.pyi.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/service/type_defs.pyi.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-service/service/version.py.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/service/version.py.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3-service/setup.py.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/service/setup.py.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3/README.md.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/header.md.jinja2" with context %}
2 |
3 | {% include "common/how_to_install.md.jinja2" with context %}
4 |
5 | {% with extras_name="essential" %}
6 | {% include "common/usage.md.jinja2" with context %}
7 | {% endwith %}
8 |
9 | ### Explicit type annotations
10 |
11 | To speed up type checking and code completion, you can set types explicitly.
12 |
13 | ```python
14 | import boto3
15 | from boto3.session import Session
16 |
17 | from {{ package.data.service_prefix }}_ec2.client import EC2Client
18 | from {{ package.data.service_prefix }}_ec2.service_resource import EC2ServiceResource
19 | from {{ package.data.service_prefix }}_ec2.waiter import BundleTaskCompleteWaiter
20 | from {{ package.data.service_prefix }}_ec2.paginator import DescribeVolumesPaginator
21 |
22 | session = Session(region_name="us-west-1")
23 |
24 | ec2_client: EC2Client = boto3.client("ec2", region_name="us-west-1")
25 | ec2_resource: EC2ServiceResource = session.resource("ec2")
26 |
27 | bundle_task_complete_waiter: BundleTaskCompleteWaiter = ec2_client.get_waiter("bundle_task_complete")
28 | describe_volumes_paginator: DescribeVolumesPaginator = ec2_client.get_paginator("describe_volumes")
29 | ```
30 |
31 | {% include "common/footer.md.jinja2" with context %}
32 |
33 | {% include "common/submodules.md.jinja2" with context %}
34 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3/boto3-stubs/__init__.pyi.jinja2:
--------------------------------------------------------------------------------
1 | """
2 | Type annotations for {{ package.library_name }}.__init__ module.
3 |
4 | {{ copyright }}
5 | """
6 | import logging
7 | from typing import Any
8 | from boto3 import session as session
9 | from boto3.session import Session as Session
10 | from botocore.session import Session as BotocoreSession
11 |
12 | {% for import_record in package.get_init_required_import_records() -%}
13 | {{ import_record -}}{{ "\n" -}}
14 | {% endfor -%}
15 |
16 | __author__: str = ...
17 | __version__: str = ...
18 |
19 | DEFAULT_SESSION: Session | None = ...
20 |
21 | def setup_default_session(
22 | *,
23 | aws_access_key_id: str | None = ...,
24 | aws_secret_access_key: str | None = ...,
25 | aws_session_token: str | None = ...,
26 | region_name: str | None = ...,
27 | botocore_session: BotocoreSession | None = ...,
28 | profile_name: str | None = ...,
29 | ) -> None: ...
30 | def set_stream_logger(
31 | name: str = ...,
32 | level: int = ...,
33 | format_string: str | None = ...,
34 | ) -> None: ...
35 | def _get_default_session() -> Session: ...
36 |
37 | class NullHandler(logging.Handler): ...
38 |
39 | {% for function in package.init_functions -%}
40 | {% include "common/function.py.jinja2" with context -%}
41 | {{ '\n' -}}
42 | {% endfor -%}
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3/boto3-stubs/py.typed.jinja2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youtype/mypy_boto3_builder/d373917162a7e6f9559d651b02d7f4a347509293/mypy_boto3_builder/templates/types-boto3/boto3-stubs/py.typed.jinja2
--------------------------------------------------------------------------------
/mypy_boto3_builder/templates/types-boto3/setup.py.jinja2:
--------------------------------------------------------------------------------
1 | {% include "common/wrapper/setup.py.jinja2" with context %}
2 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/type_annotations/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Collection of type annotation wrappers.
3 |
4 | Wrappers handle imports and can be rendered back to a valid Python code.
5 | """
6 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/type_annotations/type_constant.py:
--------------------------------------------------------------------------------
1 | """
2 | Wrapper for constant like `False` or `"test"`.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from typing import Final, Self
8 |
9 | from mypy_boto3_builder.type_annotations.fake_annotation import FakeAnnotation
10 |
11 |
12 | class EllipsisType:
13 | """
14 | Placeholder for `...`.
15 | """
16 |
17 |
18 | ValueType = str | int | float | EllipsisType | None
19 |
20 |
21 | class TypeConstant(FakeAnnotation):
22 | """
23 | Wrapper for constant like `False` or `"test"`.
24 |
25 | Arguments:
26 | value -- Constant value.
27 | """
28 |
29 | Ellipsis: Final[EllipsisType] = EllipsisType()
30 |
31 | def __init__(self, value: ValueType) -> None:
32 | self.value: ValueType = value
33 |
34 | def render(self) -> str:
35 | """
36 | Render type annotation to a valid Python code for local usage.
37 |
38 | Returns:
39 | A string with a valid type annotation.
40 | """
41 | if self.value is self.Ellipsis:
42 | return "..."
43 |
44 | return repr(self.value)
45 |
46 | def __copy__(self) -> Self:
47 | """
48 | Create a copy of type annotation wrapper.
49 | """
50 | return self.__class__(self.value)
51 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/type_defs.py:
--------------------------------------------------------------------------------
1 | """
2 | Type definitions for builder.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from collections.abc import Sequence
8 | from typing import TypedDict
9 |
10 | from mypy_boto3_builder.cli_parser import CLINamespace
11 | from mypy_boto3_builder.enums.product import Product
12 | from mypy_boto3_builder.service_name import ServiceName
13 |
14 |
15 | class GeneratorKwargs(TypedDict):
16 | """
17 | Generator keyword arguments.
18 | """
19 |
20 | product: Product
21 | service_names: Sequence[ServiceName]
22 | main_service_names: Sequence[ServiceName]
23 | config: CLINamespace
24 | version: str
25 | cleanup: bool
26 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/type_maps/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Collections of stubs to replace after botocore shapes parsing.
3 | """
4 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/type_maps/literals.py:
--------------------------------------------------------------------------------
1 | """
2 | Collection of Literals added by boto3.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from mypy_boto3_builder.type_annotations.type_literal import TypeLiteral
8 |
9 | QueueAttributeFilterType = TypeLiteral(
10 | "QueueAttributeFilterType",
11 | (
12 | "All",
13 | "AWSTraceHeader",
14 | "ApproximateFirstReceiveTimestamp",
15 | "ApproximateReceiveCount",
16 | "MessageDeduplicationId",
17 | "MessageGroupId",
18 | "SenderId",
19 | "SentTimestamp",
20 | "SequenceNumber",
21 | "Policy",
22 | "VisibilityTimeout",
23 | "MaximumMessageSize",
24 | "MessageRetentionPeriod",
25 | "ApproximateNumberOfMessages",
26 | "ApproximateNumberOfMessagesNotVisible",
27 | "CreatedTimestamp",
28 | "LastModifiedTimestamp",
29 | "QueueArn",
30 | "ApproximateNumberOfMessagesDelayed",
31 | "DelaySeconds",
32 | "ReceiveMessageWaitTimeSeconds",
33 | "RedrivePolicy",
34 | "FifoQueue",
35 | "ContentBasedDeduplication",
36 | "KmsMasterKeyId",
37 | "KmsDataKeyReusePeriodSeconds",
38 | "DeduplicationScope",
39 | "FifoThroughputLimit",
40 | "RedriveAllowPolicy",
41 | "SqsManagedSseEnabled",
42 | ),
43 | )
44 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/type_maps/service_stub_map/dynamodb.py:
--------------------------------------------------------------------------------
1 | """
2 | DynamoDB service injected methods.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from mypy_boto3_builder.import_helpers.import_helper import Import
8 | from mypy_boto3_builder.structures.argument import Argument
9 | from mypy_boto3_builder.structures.method import Method
10 | from mypy_boto3_builder.type_annotations.external_import import ExternalImport
11 | from mypy_boto3_builder.type_annotations.type import Type
12 |
13 | batch_writer_method = Method(
14 | name="batch_writer",
15 | arguments=(
16 | Argument.self(),
17 | Argument(
18 | "overwrite_by_pkeys",
19 | Type.wrap_list(Type.str),
20 | Type.Ellipsis,
21 | ),
22 | ),
23 | return_type=ExternalImport(Import.boto3 + "dynamodb" + "table", "BatchWriter"),
24 | docstring="Create a batch writer object.",
25 | )
26 |
27 | TABLE_METHODS = (batch_writer_method,)
28 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/type_maps/service_stub_map/rds.py:
--------------------------------------------------------------------------------
1 | """
2 | RDS service injected methods.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from mypy_boto3_builder.structures.argument import Argument
8 | from mypy_boto3_builder.structures.method import Method
9 | from mypy_boto3_builder.type_annotations.type import Type
10 | from mypy_boto3_builder.utils.type_checks import get_optional
11 |
12 | generate_db_auth_token_method = Method(
13 | name="generate_db_auth_token",
14 | arguments=(
15 | Argument.self(),
16 | Argument("DBHostname", Type.str),
17 | Argument("Port", Type.int),
18 | Argument("DBUsername", Type.str),
19 | Argument("Region", get_optional(Type.str), Type.Ellipsis),
20 | ),
21 | return_type=Type.str,
22 | docstring="Generates an auth token used to connect to a db with IAM credentials.",
23 | )
24 |
25 | CLIENT_METHODS = (generate_db_auth_token_method.copy(),)
26 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/utils/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Collection of simple utils functions.
3 | """
4 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/utils/github.py:
--------------------------------------------------------------------------------
1 | """
2 | GitHub-related utils.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from io import BytesIO
8 | from pathlib import Path
9 | from zipfile import ZipFile
10 |
11 | import requests
12 |
13 | from mypy_boto3_builder.exceptions import BuildEnvError
14 |
15 |
16 | def download_and_extract(url: str, output_path: Path) -> Path:
17 | """
18 | Download and extract zip file with stubs from GitHub URL.
19 | """
20 | response = requests.get(url, timeout=60)
21 | zipfile = ZipFile(BytesIO(response.content))
22 |
23 | if not response.ok:
24 | raise BuildEnvError(f"Failed to download URL {url}: {response.status_code} {response.text}")
25 |
26 | project_roots = [
27 | Path(i).parent.as_posix() for i in zipfile.namelist() if Path(i).name == "py.typed"
28 | ]
29 | if len(project_roots) != 1:
30 | raise BuildEnvError(f"Failed to detect project root: {project_roots}")
31 |
32 | project_root = project_roots[0]
33 |
34 | for member in zipfile.namelist():
35 | if not member.startswith(project_root):
36 | continue
37 | zipfile.extract(member, output_path)
38 |
39 | return output_path / project_root
40 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/utils/jinja2.py:
--------------------------------------------------------------------------------
1 | """
2 | Jinja2-related utils.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from collections.abc import Mapping
8 | from pathlib import Path
9 | from typing import Any
10 |
11 | from mypy_boto3_builder.jinja_manager import JinjaManager
12 |
13 |
14 | def render_jinja2_template(template_path: Path, context: Mapping[str, Any]) -> str:
15 | """
16 | Render Jinja2 template to a string.
17 |
18 | Arguments:
19 | template_path -- Relative path to template in `TEMPLATES_PATH`
20 | kwargs -- Render arguments
21 |
22 | Returns:
23 | A rendered template.
24 | """
25 | template = JinjaManager().get_template(template_path)
26 | return template.render(context)
27 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/utils/path.py:
--------------------------------------------------------------------------------
1 | """
2 | Path utils.
3 |
4 | Copyright 2024 Vlad Emelianov
5 | """
6 |
7 | from collections.abc import Generator, Iterable
8 | from pathlib import Path
9 |
10 |
11 | def print_path(path: Path) -> str:
12 | """
13 | Get path as a string relative to current workdir.
14 | """
15 | if path.is_absolute():
16 | cwd = Path.cwd()
17 | if path == cwd or path.parts <= cwd.parts:
18 | return path.as_posix()
19 |
20 | try:
21 | path = path.relative_to(cwd)
22 | except ValueError:
23 | return str(path)
24 |
25 | if len(path.parts) == 1:
26 | return f"./{path.as_posix()}"
27 |
28 | return path.as_posix()
29 |
30 |
31 | def walk_path(
32 | parent: Path,
33 | exclude: Iterable[Path] = (),
34 | glob_pattern: str = "**/*",
35 | ) -> Generator[Path, None, None]:
36 | """
37 | Walk files except for `exclude`.
38 |
39 | Yields:
40 | Existing Path.
41 | """
42 | exclude_strs = {Path(i).as_posix() for i in exclude}
43 | for path in parent.glob(glob_pattern):
44 | if not path.is_file():
45 | continue
46 |
47 | if path.as_posix() in exclude_strs:
48 | continue
49 |
50 | yield path
51 |
--------------------------------------------------------------------------------
/mypy_boto3_builder/writers/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Renderers of parsed info produced by parsers.
3 | """
4 |
--------------------------------------------------------------------------------
/requirements.mkdocs.txt:
--------------------------------------------------------------------------------
1 | mkdocs
2 | mkdocs-material
3 |
--------------------------------------------------------------------------------
/scripts/before_commit.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | ROOT_PATH=$(dirname $(dirname $0))
5 | cd $ROOT_PATH
6 |
7 | # uvx vulture mypy_boto3_builder --make-whitelist > vulture_whitelist.txt
8 | uvx pre-commit run --all-files
9 |
10 | # uvx pytest --cov-report html --cov mypy_boto3_builder
11 |
12 | # ./scripts/docs.sh
13 |
--------------------------------------------------------------------------------
/scripts/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | ROOT_PATH=$(dirname $(dirname $0))
5 | cd ${ROOT_PATH}
6 |
7 | python -m mypy_boto3_builder --no-smart-version mypy_boto3_output $@
8 |
--------------------------------------------------------------------------------
/scripts/build_aiobotocore_docs.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | ROOT_PATH=$(dirname $(dirname $0))
5 | cd ${ROOT_PATH}
6 |
7 | python -m mypy_boto3_builder ../types_aiobotocore_docs/docsmd --product aiobotocore-docs $@
8 |
--------------------------------------------------------------------------------
/scripts/build_docs.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | ROOT_PATH=$(dirname $(dirname $0))
5 | cd ${ROOT_PATH}
6 |
7 | python -m mypy_boto3_builder ../boto3_stubs_docs/docsmd --product boto3-docs $@
8 |
9 | cd ../boto3_stubs_docs/
10 | uvx --with mkdocs-material mkdocs build
11 | cd -
--------------------------------------------------------------------------------
/scripts/build_main.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | # types-boto3
5 | uv run --with ruff --with boto3 mypy_boto3_builder mypy_boto3_output --product types-boto3 types-boto3-lite
6 |
7 | # types-aiobotocore
8 | uv run --with ruff --with aiobotocore mypy_boto3_builder mypy_boto3_output --product aiobotocore aiobotocore-lite
9 |
10 | # types-aioboto3
11 | uv run --with ruff --with aioboto3 mypy_boto3_builder mypy_boto3_output --product aioboto3 aioboto3-lite
12 |
13 | # boto3-stubs
14 | uv run --with ruff --with boto3 mypy_boto3_builder mypy_boto3_output --product boto3 boto3-lite
15 |
--------------------------------------------------------------------------------
/scripts/coverage.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | ROOT_PATH=$(dirname $(dirname $0))
5 |
6 | coverage run mypy_boto3_builder/__main__.py mypy_boto3_output -s ec2 rds s3 lambda sqs cloudformation dynamodb --product boto3 boto3-services aioboto3 aiobotocore aiobotocore-services boto3-docs aioboto3-docs aiobotocore-docs
7 | coverage xml
8 | coverage html
9 | python -m http.server --directory htmlcov 9000
10 |
--------------------------------------------------------------------------------
/scripts/docker.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 | set -e
3 |
4 | if [[ "$BOTO3_VERSION" != "" ]]; then
5 | python -m pip install boto3==${BOTO3_VERSION}
6 | fi
7 |
8 | if [[ "$BOTOCORE_VERSION" != "" ]]; then
9 | python -m pip install botocore==${BOTOCORE_VERSION}
10 | fi
11 |
12 | python -m mypy_boto3_builder /output $@
13 |
--------------------------------------------------------------------------------
/scripts/dockerize.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | ROOT_PATH=$(dirname $(dirname $0))
5 | cd ${ROOT_PATH}
6 |
7 | VERSION=`uv run mypy_boto3_builder --version | head -1`
8 | echo "Dockerizing mypy_boto3_builder ${VERSION}"
9 | docker build . --tag mypy_boto3_builder
10 | docker tag mypy_boto3_builder docker.pkg.github.com/youtype/mypy_boto3_builder/mypy_boto3_builder_stable:${VERSION}
11 | docker login docker.pkg.github.com --username vemel -p ${GITHUB_TOKEN}
12 | docker push docker.pkg.github.com/youtype/mypy_boto3_builder/mypy_boto3_builder_stable:${VERSION}
13 |
--------------------------------------------------------------------------------
/scripts/get_services.js:
--------------------------------------------------------------------------------
1 | // https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/index.html
2 | (() => {
3 | const els = [...document.querySelectorAll('.document .toctree-l1 > .reference[href]')]
4 | els.sort((a, b) => a.href.localeCompare(b.href))
5 | const lines = els.map(el => ` ServiceName("${el.getAttribute('href').split(".")[0]}", "${el.innerText}"),`)
6 | console.log(lines.join('\n'))
7 | })()
8 |
--------------------------------------------------------------------------------
/scripts/install.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | ROOT_PATH=$(dirname $(dirname $0))
5 | OUTPUT_PATH=${ROOT_PATH}/mypy_boto3_output
6 | PACKAGES=${OUTPUT_PATH}/mypy_boto3_$1_package
7 | if [[ "$1" == "" ]]; then
8 | PACKAGES=${OUTPUT_PATH}/*_package
9 | fi
10 |
11 | if [[ "$1" == "main" ]]; then
12 | echo Installing boto3-stubs package
13 | uv pip install ${OUTPUT_PATH}/boto3_stubs_package
14 | exit
15 | fi
16 |
17 | if [[ "$1" == "full" ]]; then
18 | echo Installing boto3-stubs-full package
19 | uv pip install ${OUTPUT_PATH}/boto3_stubs_full_package
20 | exit
21 | fi
22 |
23 | for package in $PACKAGES
24 | do
25 | echo Installing $(basename ${package})
26 | uv pip install ${package}
27 | done
28 |
--------------------------------------------------------------------------------
/scripts/install_aiobotocore.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | ROOT_PATH=$(dirname $(dirname $0))
5 | OUTPUT_PATH=${ROOT_PATH}/mypy_boto3_output
6 | PACKAGES=${OUTPUT_PATH}/types_aiobotocore_$1_package
7 | if [[ "$1" == "" ]]; then
8 | PACKAGES=${OUTPUT_PATH}/*_package
9 | fi
10 |
11 | if [[ "$1" == "main" ]]; then
12 | echo Installing types-aiobotocore package
13 | uv pip install ${OUTPUT_PATH}/types_aiobotocore_package
14 |
15 | echo Installing types-aioboto3 package
16 | uv pip install ${OUTPUT_PATH}/types_aioboto3_package
17 |
18 | exit
19 | fi
20 |
21 | if [[ "$1" == "full" ]]; then
22 | echo Installing types-aiobotocore-full package
23 | uv pip install ${OUTPUT_PATH}/types_aiobotocore_full_package
24 |
25 | exit
26 | fi
27 |
28 | for package in $PACKAGES
29 | do
30 | echo Installing $(basename ${package})
31 | uv pip install ${package}
32 | done
33 |
--------------------------------------------------------------------------------
/scripts/open.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | NAME="${1:-boto3}"
5 | echo "Opening $NAME"
6 |
7 | SITE_PACKAGES=`uv run python -c "import sys; import os; paths = filter(lambda x: x.startswith(os.getcwd()), sys.path); print(list(paths)[0])"`
8 | echo "Site packages:" ${SITE_PACKAGES}
9 | code ${SITE_PACKAGES}/${NAME}
10 |
--------------------------------------------------------------------------------
/scripts/publish_types.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | ROOT_PATH=$(dirname $(dirname $(realpath $0)))
5 |
6 | cd $ROOT_PATH/types_boto3
7 | rm -rf dist/* && python setup.py build sdist bdist_wheel
8 | uvx twine upload dist/* || true
9 |
10 | cd $ROOT_PATH/types_botocore
11 | rm -rf dist/* && python setup.py build sdist bdist_wheel
12 | uvx twine upload dist/* || true
13 |
--------------------------------------------------------------------------------
/scripts/pyproject.toml:
--------------------------------------------------------------------------------
1 | [tool.ruff]
2 | extend = "../pyproject.toml"
3 | target-version = "py39"
4 |
5 | [tool.pyright]
6 | extend = "../pyproject.toml"
7 | pythonVersion = "3.9"
8 |
--------------------------------------------------------------------------------
/scripts/pyrightconfig_output.json:
--------------------------------------------------------------------------------
1 | {
2 | "exclude": [
3 | "**/__pycache__",
4 | "tests",
5 | "**/build",
6 | "typestubs"
7 | ],
8 | "typeCheckingMode": "basic",
9 | "reportMissingImports": "error",
10 | "reportMissingTypeStubs": "error",
11 | "reportMissingTypeArgument": "error",
12 | "reportIncompatibleMethodOverride": "error",
13 | "reportIncompatibleVariableOverride": "error",
14 | "reportUnknownParameterType": "error",
15 | "reportReturnType": "none",
16 | "pythonVersion": "3.9"
17 | }
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Tests for writers.
3 | """
4 |
--------------------------------------------------------------------------------
/tests/enums/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Tests for enums.
3 | """
4 |
--------------------------------------------------------------------------------
/tests/enums/test_service_module_name.py:
--------------------------------------------------------------------------------
1 | from mypy_boto3_builder.enums.service_module_name import ServiceModuleName
2 |
3 |
4 | class TestServiceModuleName:
5 | def test_properties(self) -> None:
6 | assert ServiceModuleName.paginator.stub_file_name == "paginator.pyi"
7 | assert ServiceModuleName.paginator.file_name == "paginator.py"
8 | assert ServiceModuleName.paginator.template_name == "paginator.pyi.jinja2"
9 |
--------------------------------------------------------------------------------
/tests/import_helpers/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Tests for import helpers.
3 | """
4 |
--------------------------------------------------------------------------------
/tests/import_helpers/test_import_helper.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | from mypy_boto3_builder.exceptions import StructureError
4 | from mypy_boto3_builder.import_helpers.import_helper import Import
5 | from mypy_boto3_builder.import_helpers.import_string import ImportString
6 |
7 |
8 | class TestImport:
9 | def test_local(self) -> None:
10 | assert Import.local("my_package") == ImportString("", "my_package")
11 | with pytest.raises(StructureError):
12 | Import.local("")
13 |
14 | def test_from_str(self) -> None:
15 | assert Import.from_str("my.module.path").render() == "my.module.path"
16 | assert Import.from_str("test").render() == "test"
17 | with pytest.raises(StructureError):
18 | Import.from_str(".test")
19 | with pytest.raises(StructureError):
20 | assert Import.from_str("").render()
21 |
22 | def test_from_parts(self) -> None:
23 | assert Import.from_parts("parent").render() == "parent"
24 | assert Import.from_parts("my", "module", "path").render() == "my.module.path"
25 | with pytest.raises(StructureError):
26 | assert Import.from_parts("", "test")
27 | with pytest.raises(StructureError):
28 | assert Import.from_parts("")
29 |
--------------------------------------------------------------------------------
/tests/import_helpers/test_internal_import_record.py:
--------------------------------------------------------------------------------
1 | from unittest.mock import MagicMock
2 |
3 | from mypy_boto3_builder.import_helpers.internal_import_record import InternalImportRecord
4 |
5 |
6 | class TestImportRecord:
7 | def test_init(self) -> None:
8 | service_name_mock = MagicMock()
9 | service_name_mock.name = "service_name"
10 | result = InternalImportRecord(service_name_mock, "name", "alias")
11 | assert result.source.render() == ".service_name"
12 | assert result.name == "name"
13 | assert result.alias == "alias"
14 |
--------------------------------------------------------------------------------
/tests/parsers/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Tests for parsers.
3 | """
4 |
--------------------------------------------------------------------------------
/tests/parsers/test_parse_wrapper_package.py:
--------------------------------------------------------------------------------
1 | from unittest.mock import MagicMock
2 |
3 | from mypy_boto3_builder.package_data import Boto3StubsPackageData
4 | from mypy_boto3_builder.parsers.parse_wrapper_package import parse_types_boto3_package
5 |
6 |
7 | class TestParseWrapperPackage:
8 | def test_parse_types_boto3_package(self, botocore_session_mock: MagicMock) -> None:
9 | service_name_mock = MagicMock()
10 | service_name_mock.underscore_name = "service_name"
11 | service_name2_mock = MagicMock()
12 | service_name2_mock.underscore_name = "service_name2"
13 | botocore_session_mock().resource.return_value = None
14 |
15 | result = parse_types_boto3_package(
16 | [service_name_mock, service_name2_mock],
17 | package_data=Boto3StubsPackageData(),
18 | version="1.2.3",
19 | )
20 | assert len(result.session_class.methods) == 2
21 |
--------------------------------------------------------------------------------
/tests/postprocessors/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Tests for postprocessors.
3 | """
4 |
--------------------------------------------------------------------------------
/tests/structures/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Tests for structures.
3 | """
4 |
--------------------------------------------------------------------------------
/tests/structures/pacakges/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Tests for packages.
3 | """
4 |
--------------------------------------------------------------------------------
/tests/structures/pacakges/test_mypy_boto3_package.py:
--------------------------------------------------------------------------------
1 | from mypy_boto3_builder.service_name import ServiceNameCatalog
2 | from mypy_boto3_builder.structures.packages.mypy_boto3_package import MypyBoto3Package
3 |
4 |
5 | class TestMypyBoto3Package:
6 | def test_init(self) -> None:
7 | package = MypyBoto3Package([ServiceNameCatalog.ec2, ServiceNameCatalog.logs], [], "1.2.3")
8 | assert package
9 | assert package.essential_service_names == [ServiceNameCatalog.ec2]
10 | assert package.literals == []
11 |
--------------------------------------------------------------------------------
/tests/structures/test_collection.py:
--------------------------------------------------------------------------------
1 | from mypy_boto3_builder.service_name import ServiceName
2 | from mypy_boto3_builder.structures.collection import Collection
3 | from mypy_boto3_builder.type_annotations.external_import import ExternalImport
4 |
5 |
6 | class TestPaginator:
7 | @property
8 | def collection(self) -> Collection:
9 | return Collection(
10 | name="name",
11 | attribute_name="attribute",
12 | parent_name="Parent",
13 | service_name=ServiceName("s3", "S3"),
14 | type_annotation=ExternalImport.from_class(ServiceName),
15 | object_class_name="object",
16 | )
17 |
18 | def test_init(self) -> None:
19 | collection = self.collection
20 | assert collection.name == "name"
21 | assert collection.bases
22 | assert collection.boto3_doc_link
23 |
24 | def test_get_types(self) -> None:
25 | assert len(set(self.collection.iterate_types())) == 2
26 |
--------------------------------------------------------------------------------
/tests/structures/test_paginator.py:
--------------------------------------------------------------------------------
1 | from mypy_boto3_builder.service_name import ServiceNameCatalog
2 | from mypy_boto3_builder.structures.paginator import Paginator
3 |
4 |
5 | class TestPaginator:
6 | paginator: Paginator
7 |
8 | def setup_method(self) -> None:
9 | self.paginator = Paginator(
10 | name="name",
11 | operation_name="my_operation_name",
12 | service_name=ServiceNameCatalog.s3,
13 | paginator_name="paginator_name",
14 | )
15 |
16 | def test_init(self) -> None:
17 | assert self.paginator.name == "name"
18 | assert self.paginator.operation_name == "my_operation_name"
19 | assert self.paginator.service_name == ServiceNameCatalog.s3
20 |
21 | def test_boto3_doc_link(self) -> None:
22 | assert (
23 | self.paginator.boto3_doc_link
24 | == "https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3/paginator/paginator_name.html#S3.Paginator.paginator_name"
25 | )
26 |
27 | def test_get_client_method(self) -> None:
28 | result = self.paginator.get_client_method()
29 | assert result.name == "get_paginator"
30 | assert result.return_type.name == "name"
31 | assert result.arguments[1].type_annotation.children == {"my_operation_name"}
32 |
--------------------------------------------------------------------------------
/tests/test_cli_parser.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Iterator
2 | from unittest.mock import MagicMock, patch
3 |
4 | import pytest
5 |
6 | from mypy_boto3_builder.cli_parser import get_absolute_path, parse_args
7 |
8 |
9 | class TestCLIParser:
10 | @pytest.fixture(autouse=True)
11 | def _patch_argparse(self) -> Iterator[None]:
12 | with patch("mypy_boto3_builder.cli_parser.argparse"):
13 | yield
14 |
15 | def test_parse_args(self) -> None:
16 | result = parse_args([])
17 | assert result
18 |
19 | @patch("mypy_boto3_builder.cli_parser.Path")
20 | def test_get_absolute_path(self, PathMock: MagicMock) -> None:
21 | result = get_absolute_path("test/output")
22 | PathMock.assert_called_with("test/output")
23 | assert result == PathMock().absolute()
24 |
--------------------------------------------------------------------------------
/tests/test_constants.py:
--------------------------------------------------------------------------------
1 | from typing import TYPE_CHECKING
2 |
3 | from mypy_boto3_builder.constants import TEMPLATES_PATH, StaticStubsPath, TemplatePath
4 |
5 | if TYPE_CHECKING:
6 | from pathlib import Path
7 |
8 |
9 | class TestConstants:
10 | def test_template_path(self) -> None:
11 | for key in dir(TemplatePath):
12 | if key.startswith("_"):
13 | continue
14 |
15 | path: Path = getattr(TemplatePath, key)
16 | assert path.is_absolute()
17 | assert path.exists()
18 | assert path.relative_to(TEMPLATES_PATH)
19 |
20 | def test_static_stubs_path(self) -> None:
21 | for key in dir(StaticStubsPath):
22 | if key.startswith("_"):
23 | continue
24 | path: Path = getattr(StaticStubsPath, key)
25 | assert path.is_absolute()
26 | assert path.exists()
27 |
--------------------------------------------------------------------------------
/tests/test_jinja_manager.py:
--------------------------------------------------------------------------------
1 | from pathlib import Path
2 |
3 | import pytest
4 |
5 | from mypy_boto3_builder.exceptions import JinjaManagerError
6 | from mypy_boto3_builder.jinja_manager import JinjaManager
7 |
8 |
9 | class TestJinjaManager:
10 | def test_init(self) -> None:
11 | assert JinjaManager()
12 |
13 | def test_get_template(self) -> None:
14 | manager = JinjaManager()
15 | assert manager.get_template(Path("common/named_union.py.jinja2"))
16 | assert manager.get_template(Path("common/named_union.py.jinja2"))
17 | with pytest.raises(JinjaManagerError):
18 | manager.get_template(Path("common/unknown.jinja2"))
19 |
--------------------------------------------------------------------------------
/tests/type_annotations/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Tests for type annotations.
3 | """
4 |
--------------------------------------------------------------------------------
/tests/type_annotations/test_internal_import.py:
--------------------------------------------------------------------------------
1 | from mypy_boto3_builder.type_annotations.internal_import import InternalImport
2 |
3 |
4 | class TestInternalImport:
5 | def setup_method(self) -> None:
6 | self.result = InternalImport("MyClass")
7 |
8 | def test_init(self) -> None:
9 | assert self.result.name == "MyClass"
10 |
11 | def test_render(self) -> None:
12 | assert self.result.render() == "MyClass"
13 | self.result.use_alias = True
14 | assert self.result.render() == "_MyClass"
15 |
16 | def test_get_import_records(self) -> None:
17 | assert len(self.result.get_import_records()) == 0
18 |
19 | def test_copy(self) -> None:
20 | assert self.result.copy().name == "MyClass"
21 |
--------------------------------------------------------------------------------
/tests/type_annotations/test_type_constant.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | from mypy_boto3_builder.exceptions import BuildInternalError
4 | from mypy_boto3_builder.type_annotations.type_constant import TypeConstant
5 |
6 |
7 | class TestTypeConstant:
8 | def setup_method(self) -> None:
9 | self.result = TypeConstant("value")
10 |
11 | def test_init(self) -> None:
12 | assert self.result.value == "value"
13 | assert hash(self.result)
14 |
15 | def test_render(self) -> None:
16 | assert self.result.render() == "'value'"
17 | assert TypeConstant(TypeConstant.Ellipsis).render() == "..."
18 |
19 | def test_get_import_record(self) -> None:
20 | assert len(self.result.get_import_records()) == 0
21 |
22 | def test_copy(self) -> None:
23 | assert self.result.copy().value == "value"
24 |
25 | def test_is_type(self) -> None:
26 | assert not self.result.is_dict()
27 | assert not self.result.is_list()
28 |
29 | def test_compare(self) -> None:
30 | assert self.result == TypeConstant("value")
31 | assert self.result != TypeConstant("other")
32 | assert self.result > TypeConstant("aaa")
33 |
34 | with pytest.raises(BuildInternalError):
35 | assert self.result == "value"
36 |
--------------------------------------------------------------------------------
/tests/type_maps/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Tests for type maps.
3 | """
4 |
--------------------------------------------------------------------------------
/tests/type_maps/test_argument_alias_type_map.py:
--------------------------------------------------------------------------------
1 | from mypy_boto3_builder.service_name import ServiceNameCatalog
2 | from mypy_boto3_builder.type_maps.argument_alias_map import get_argument_alias
3 |
4 |
5 | class TestArgumentAliasTypeMap:
6 | def test_get_argument_alias(self) -> None:
7 | assert (
8 | get_argument_alias(ServiceNameCatalog.cloudsearchdomain, "Search", "return")
9 | == "returnFields"
10 | )
11 | assert (
12 | get_argument_alias(ServiceNameCatalog.cloudsearchdomain, "NoSearch", "return")
13 | == "return"
14 | )
15 | assert (
16 | get_argument_alias(ServiceNameCatalog.cloudsearchdomain, "Search", "other") == "other"
17 | )
18 |
19 | assert get_argument_alias(ServiceNameCatalog.ec2, "MyOperation", "Filter") == "Filters"
20 | assert get_argument_alias(ServiceNameCatalog.ec2, "MyOperation", "Other") == "Other"
21 |
22 | assert (
23 | get_argument_alias(ServiceNameCatalog.s3, "PutBucketCors", "ContentSHA256")
24 | == "ContentSHA256"
25 | )
26 |
--------------------------------------------------------------------------------
/tests/type_maps/test_literal_type_map.py:
--------------------------------------------------------------------------------
1 | from mypy_boto3_builder.service_name import ServiceNameCatalog
2 | from mypy_boto3_builder.type_maps.literal_type_map import get_type_literal_stub
3 |
4 |
5 | def test_get_type_literal_stub() -> None:
6 | type_literal = get_type_literal_stub(ServiceNameCatalog.ec2, "PlatformValuesType")
7 | assert type_literal
8 | assert type_literal.children == {"windows"}
9 | assert get_type_literal_stub(ServiceNameCatalog.s3, "BucketLocationConstraintType") is None
10 | assert (
11 | get_type_literal_stub(ServiceNameCatalog.cloudformation, "NoneResourceStatusType") is None
12 | )
13 |
--------------------------------------------------------------------------------
/tests/type_maps/test_required_attribute_map.py:
--------------------------------------------------------------------------------
1 | from mypy_boto3_builder.service_name import ServiceNameCatalog
2 | from mypy_boto3_builder.type_maps.required_attribute_map import is_required
3 |
4 |
5 | def test_is_required() -> None:
6 | assert is_required(ServiceNameCatalog.ec2, "RandomTypeDef", "PaginationToken") is False
7 | assert is_required(ServiceNameCatalog.dynamodb, "RandomTypeDef", "Key") is True
8 | assert is_required(ServiceNameCatalog.dynamodb, "RandomTypeDef", "LastEvaluatedKey") is False
9 | assert is_required(ServiceNameCatalog.stepfunctions, "RandomTypeDef", "stopDate") is True
10 | assert (
11 | is_required(ServiceNameCatalog.stepfunctions, "DescribeExecutionOutputTypeDef", "stopDate")
12 | is False
13 | )
14 | assert (
15 | is_required(ServiceNameCatalog.stepfunctions, "DescribeExecutionOutputTypeDef", "Date")
16 | is True
17 | )
18 |
--------------------------------------------------------------------------------
/tests/utils/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Tests for utils.
3 | """
4 |
--------------------------------------------------------------------------------
/tests/utils/test_boto3_utils.py:
--------------------------------------------------------------------------------
1 | from unittest.mock import MagicMock
2 |
3 | from mypy_boto3_builder.utils.boto3_utils import get_available_service_names
4 |
5 |
6 | class TestBoto3Utils:
7 | def test_get_available_service_names(self, botocore_session_mock: MagicMock) -> None:
8 | botocore_session_mock.get_available_services.return_value = ["s3", "ec2", "unsupported"]
9 | botocore_session_mock.get_service_data.return_value = {
10 | "metadata": {"serviceAbbreviation": "Amazon S3", "serviceId": "s3"},
11 | }
12 | assert len(get_available_service_names()) == 3
13 |
--------------------------------------------------------------------------------
/tests/utils/test_jinja2.py:
--------------------------------------------------------------------------------
1 | from pathlib import Path
2 | from unittest.mock import MagicMock, patch
3 |
4 | from mypy_boto3_builder.utils.jinja2 import render_jinja2_template
5 |
6 |
7 | class TestJinja2:
8 | @patch("mypy_boto3_builder.utils.jinja2.JinjaManager")
9 | def test_render_jinja2_template(self, JinjaManagerMock: MagicMock) -> None:
10 | template_path = Path("template.jinja2")
11 | result = render_jinja2_template(template_path, {"key": "Value"})
12 | JinjaManagerMock().get_template.assert_called_once_with(template_path)
13 | JinjaManagerMock().get_template().render.assert_called_once_with({"key": "Value"})
14 | assert result == JinjaManagerMock().get_template().render()
15 |
--------------------------------------------------------------------------------
/tests/utils/test_lookup_dict.py:
--------------------------------------------------------------------------------
1 | from mypy_boto3_builder.constants import ALL
2 | from mypy_boto3_builder.utils.lookup_dict import LookupDict
3 |
4 |
5 | class TestLookupDict:
6 | def test_get(self) -> None:
7 | lookup_dict: LookupDict[int] = LookupDict(
8 | {"test": {"one": {"child1": 1}, ALL: {"child2": 10}}, ALL: {"two": {"child3": 12}}},
9 | )
10 | assert lookup_dict.get("test", "one", "child1") == 1
11 | assert lookup_dict.get("test", "one", "child2") == 10
12 | assert lookup_dict.get("test", "one", "child3") is None
13 | assert lookup_dict.get("test", "two", "child1") is None
14 | assert lookup_dict.get("test", "two", "child2") == 10
15 | assert lookup_dict.get("test2", "two", "child2") is None
16 | assert lookup_dict.get("test2", "two", "child3") == 12
17 |
18 | def test_static(self) -> None:
19 | lookup_dict: LookupDict[int] = LookupDict(
20 | {"test": {"one": {"child1": 1}, "two": {"child2": 10}}},
21 | )
22 | assert lookup_dict.get("test", "one", "child1") == 1
23 | assert lookup_dict.get("test", "one", "child2") is None
24 | assert lookup_dict.get("test", "two", "child1") is None
25 | assert lookup_dict.get("test", "two", "child2") == 10
26 |
--------------------------------------------------------------------------------
/tests/utils/test_markdown.py:
--------------------------------------------------------------------------------
1 | from mypy_boto3_builder.utils.markdown import Header, TableOfContents, fix_pypi_headers
2 |
3 |
4 | class TestTableOfContents:
5 | def test_render(self) -> None:
6 | toc = TableOfContents(
7 | [
8 | Header("a", 1),
9 | Header("b", 3),
10 | Header("c", 6),
11 | ],
12 | )
13 | assert toc.render() == "- [a](#a)\n - [b](#b)"
14 |
15 |
16 | class TestMarkdown:
17 | def test_fix_pypi_headers(self) -> None:
18 | assert (
19 | fix_pypi_headers("# a\ntest\n## b\n## c\ntest2")
20 | == '\n\n# a\ntest\n\n\n## b\n\n\n## c\ntest2'
21 | )
22 | assert fix_pypi_headers("# a\n```## b```") == '\n\n# a\n```## b```'
23 |
--------------------------------------------------------------------------------
/tests/utils/test_path.py:
--------------------------------------------------------------------------------
1 | import tempfile
2 | from pathlib import Path
3 | from unittest.mock import patch
4 |
5 | from mypy_boto3_builder.utils.path import print_path, walk_path
6 |
7 |
8 | class TestPath:
9 | def test_print_path(self) -> None:
10 | with patch.object(Path, "cwd") as cwd_mock:
11 | cwd_mock.return_value = Path("/absolute/")
12 | assert print_path(Path("./relative")) == "./relative"
13 | assert print_path(Path("/absolute/path/test")) == "path/test"
14 | assert print_path(Path("/absolute/path")) == "./path"
15 | assert print_path(Path("/absolute")) == "/absolute"
16 | assert print_path(Path("/")) == "/"
17 | assert print_path(Path(".")) == "." # noqa: PTH201
18 |
19 | def test_walk_path(self) -> None:
20 | with tempfile.TemporaryDirectory() as output_dir:
21 | output_path = Path(output_dir)
22 | (output_path / "one.txt").touch()
23 | (output_path / "two.txt").touch()
24 | result = sorted(walk_path(output_path))
25 | assert result == [output_path / "one.txt", output_path / "two.txt"]
26 | result = list(walk_path(output_path, [output_path / "one.txt"]))
27 | assert result == [output_path / "two.txt"]
28 |
--------------------------------------------------------------------------------
/tests/writers/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Tests for the writers module.
3 | """
4 |
--------------------------------------------------------------------------------