publish_boto3_dataclass_service¶

Boto3 Dataclass Service Package Builder.

This module provides functionality for building and publishing boto3 dataclass service packages. It generates Python packages that provide dataclass wrappers for AWS services, making it easier to work with boto3 responses in a type-safe manner.

The main components include:

  • Parse type definitions from mypy-boto3 stubs

  • Creating caster utilities for converting boto3 responses to dataclasses

  • Generating package configuration files (pyproject.toml, README, LICENSE)

  • Parallel processing for bulk package building and uploading

class boto3_dataclass.builders.publish_boto3_dataclass_service.Boto3DataclassServiceBuilder(version: str, structure: Boto3DataclassServiceStructure)[source]¶

Builder for boto3 dataclass service packages.

This class handles the complete build process for boto3 dataclass service packages, including parsing mypy-boto3 stubs, generating dataclass wrappers, creating package configuration files, and managing parallel builds/uploads.

The builder transforms mypy-boto3 type stubs into usable dataclass packages that provide type-safe wrappers around boto3 service responses.

Parameters:
  • version – Package version (inherited from PyProjectBuilder)

  • structure – The service structure containing paths and metadata for the package

Example:
>>> structure = Boto3DataclassServiceStructure.new("s3")
>>> builder = Boto3DataclassServiceBuilder(version="1.0.0", structure=structure)
>>> builder.build_all() # Build all package components at build/repos/boto3_dataclass_s3-project
>>> builder.structure.poetry_build()  # Build the package
>>> builder.structure.twine_upload()  # Upload to PyPI

Example package structure:

build
|-- repos
    |-- boto3_dataclass_{service_name}-project
        |-- boto3_dataclass_{service_name}
            |-- __init__.py
            |-- caster.py
            |-- type_defs.py
        |-- LICENSE.txt
        |-- README.rst
        |-- pyproject.toml
log(ith: int | None = None)[source]¶

Log the current service being worked on with its repository path.

Args:

ith: Optional sequence number for parallel processing identification

build_all()[source]¶

Build all components of the boto3 dataclass service package.

This method orchestrates the complete build process:

  1. Cleans the output directory

  2. Creates boto3_dataclass_{service}/type_defs.py,

    type definitions from mypy-boto3 stubs

  3. Creates boto3_dataclass_{service}/caster.py,

    caster utilities for type conversion

4. Creates boto3_dataclass_{service}/__init__.py, 6. Creates pyproject.toml 7. Creates README.rst 8. Creates LICENSE.txt

build_type_defs_py()[source]¶

Build type definitions module by parsing mypy-boto3 type stubs.

This method:

  1. Parses the mypy-boto3 type_defs.pyi stub file

  2. Generates corresponding dataclass definitions

  3. Formats the code with black

  4. Writes the final type_defs.py file

build_caster_py()[source]¶

Build caster utilities for converting boto3 responses to dataclasses.

This method:

  1. Parses the mypy-boto3 client.pyi stub file

  2. Generates caster functions for each service operation

  3. Formats and writes the caster.py module

build_init_py()[source]¶

Build the package __init__.py file from template.

Creates the main package initialization file that exports the public API for the dataclass service package.

build_pyproject_toml()[source]¶

Build the pyproject.toml configuration file from template.

Creates the Poetry/PEP 518 project configuration file with package metadata, dependencies, and build system configuration.

build_README_rst()[source]¶

Build the README.rst documentation file from template.

Creates the package documentation with usage examples, installation instructions, and API reference.

build_LICENSE_txt()[source]¶

Build the LICENSE.txt file from template.

Creates the software license file for the package distribution.

classmethod list_all(version: str = '1.40.0') list[Boto3DataclassServiceBuilder][source]¶

Create builder instances for all available AWS services.

Parameters:

version – Package version to assign to all builders

Returns:

List of Boto3DataclassServiceBuilder instances, one for each AWS service

classmethod list_filtered_sorted_all(version: str = '1.40.0', package_status_info: T_PACKAGE_STATUS_INFO | None = None, limit: int | None = None) list[Boto3DataclassServiceBuilder][source]¶

List, filter, and sort all available service packages.

Parameters:
  • version – Package version for builders

  • package_status_info – Dict of package statuses to filter completed packages

  • limit – Maximum number of packages to process

classmethod parallel_build_all(version: str = '1.40.0', n_workers: int | None = None, package_status_info: T_PACKAGE_STATUS_INFO | None = None, limit: int | None = None)[source]¶

Build all boto3 dataclass service packages in parallel.

This method orchestrates parallel building of multiple AWS service packages, using multiprocessing to speed up the build process.

Parameters:
  • version – Package version for all built packages

  • n_workers – Number of worker processes (None for auto-detection)

  • package_status_info – Dict tracking package completion status

  • limit – Maximum number of packages to build

classmethod parallel_poetry_build_all(version: str = '1.40.0', n_workers: int | None = None, package_status_info: T_PACKAGE_STATUS_INFO | None = None, limit: int | None = None)[source]¶

Build all boto3 dataclass service packages with Poetry in parallel.

Parameters:
  • version – Package version for all built packages

  • n_workers – Number of worker threads (None for auto-detection)

  • package_status_info – Dict tracking package upload status

  • limit – Maximum number of packages to upload

classmethod sequence_upload_all(version: str = '1.40.0', package_status_info: T_PACKAGE_STATUS_INFO | None = None, limit: int | None = None)[source]¶

Build and upload all boto3 dataclass service packages to PyPI in sequence. We don’t do parallel upload to avoid hitting PyPI rate limits.

Parameters:
  • version – Package version for all built packages

  • n_workers – Number of worker threads (None for auto-detection)

  • package_status_info – Dict tracking package upload status

  • limit – Maximum number of packages to upload