Package: autoboto
InstallationpipinstallautobotoIntroductionProject Status:Alpha. You should use this only for ad-hoc queries when exploring
the AWS. It’s for people who roughly know what they want from AWS, but don’t want to
scroll up and down the long (and good) boto3 documentation pages to find out the
right method and parameter names. We are in the 21st century and for user-facing code,
the auto-complete should work.All response objects are dataclasses.All response objects have aresponse_metadatawhich is an unmodified dictionary
normally returned under theResponseMetadatakey of the response dictionary.Passing nested objects isn’t as easy as passing nested dictionaries, but it has benefits.The method names are as in boto3, but parameter names have been changed fromCamelCasetosnake_case.Custom methods that boto3 does not generate from botocore (for example,s3.upload_fileare simply delegated to the boto3 client and have no documentation available (for now).
The parameter names are as in the original methods.fromautoboto.servicesimports3s3_client=s3.Client()forbucketins3_client.list_buckets().buckets:print(bucket.name)forobjins3_client.list_objects_v2(bucket_name=bucket.name).contents:print(f" -{obj.key}")You can also paginate:forpageins3_client.list_objects_v2(bucket_name=bucket.name).paginate():forobjinpage.contents:print(f" -{obj.key}")Code GenerationYou don’t need to read this section. It’s about how to generate the autoboto code.When you installautobotofrom pypi.org, the package already contains the generated code for all the services
that boto3 supports.If you want to re-generate the code, you can do so with the includedbotogen.Code generation includes importing the generated modules and instantiating the generated client classes.
For this to work you will need to haveAWS_PROFILEenvironment variable pointing too an AWS profile which
hasregionset.python-mbotogen--servicess3,cloudformation,lambdaComponentsautoboto- package where the generated code is put just before release. Do not add anything there manually.
All files in this directory may be overwritten.botogen- the code responsible for autoboto generationbotogen.autoboto_template- contents of this package end up in the generatedautobotopackage..gitignorefile underbotogen/autoboto_templateinstructs git to ignore all files in the directory.
This is so that the generated code inautobotopackage is never added to version control.
Therefore, during autoboto development, when you are adding new files to thebotogen/autoboto_template,
you need to add-fflag to force-add them to git.botogen.indentist- generic Python code generatorDirectory Structurebuild/                                  All build artifacts are put here

    release/                            Release builds happen here

        20180909_135602/                individual release build directory; Added to sys.path
            autoboto/                   generated autoboto package; an augmented copy of botogen/autoboto_complete
                core/
                examples/
                services/
                __init__.py

    test/                               Test builds happen here

        20180909_135330/                individual test build directory; Added to sys.path
            autoboto_20180909_135330/   generated autoboto package; an augmented copy of botogen/autoboto_complete
                core/
                examples/
                services/
                __init__.py

    test-packages/                      Target directory for test builds -- where the generated
                                        packages are put after successful completion of a build
                                        and tests passing on the generated code.build_dir– a temporary directory in which all the build artifacts are generated. In the example above,build/test/20180909_135330andbuild/release/20180909_135602are build directories.target_package– name of the generated target package; used in import statements in the generated code.autobotowhen generating the release;autoboto_{timestamp}in tests.target_dir– the directory in which to put the target package.
By default it’s the current directory, but in tests it isbuild/test-packages.NotesDo not use any imports frombotogen.autoboto_templatein tests of the generated code
because the generated code does not import from there. Instead, use the dedicated fixtures
(for which, ironically, the auto-complete won’t work).Teststestsdirectory contains both unit tests and integration tests. For unit tests you don’t need an AWS account.pytesttests/unitTo run tests across multiple Python versions, use tox. To runtox, you need to first generate
the autoboto package or it will fail.If you’re usingpyenvand virtualenvs, don’t runtoxfrom within a virtualenv.