Smithy Core

0.4.0 · active · verified Thu Apr 16

Smithy-core is a Python library providing foundational SDK interfaces and transport-agnostic core components for implementing Smithy tooling and building service clients in Python. It is currently in a pre-alpha development stage (version 0.4.0) with all interfaces subject to change. The library is released as part of the broader Smithy Python ecosystem and receives updates frequently, as seen in its release history.

Common errors

Warnings

Install

Imports

Quickstart

Smithy-core is a foundational library. A direct quickstart for using `smithy-core` in isolation is not typical, as it's designed to underpin generated clients rather than for direct application development. The common pattern involves defining a Smithy model, using the Smithy CLI to generate a Python client, and then interacting with that generated client. The example above illustrates the conceptual flow, showing how a generated client would be used, implicitly relying on `smithy-core`.

# smithy-core is primarily a foundational library for code generation.
# End-users typically interact with clients generated from Smithy models,
# which then use smithy-core internally.
#
# To get started with a generated client, you would first define a Smithy model (e.g., main.smithy):
#
# # main.smithy
# $version: "2.0"
# namespace com.example
# use aws.protocols#restJson1
#
# service MyService {
#   operations: [SayHello]
# }
#
# operation SayHello {
#   input: SayHelloInput,
#   output: SayHelloOutput
# }
#
# structure SayHelloInput {
#   name: String
# }
#
# structure SayHelloOutput {
#   message: String
# }
#
# Then, use the Smithy CLI to build the Python client:
#
# # Assuming 'smithy-build.json' is configured for Python client generation
# smithy build
#
# After generation, the client would be available in a build directory,
# and you would install and import from that generated client, not directly from smithy-core.
#
# Example of using a *hypothetical generated client* (not direct smithy-core usage):
# import asyncio
# from generated_client import MyServiceServiceClient
#
# async def main():
#     client = MyServiceServiceClient()
#     response = await client.say_hello(name='World')
#     print(response.message)
#
# if __name__ == '__main__':
#     asyncio.run(main())

view raw JSON →