From 6ef230018a73178b3a9e188f832edf8a27fee716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Schmitz=20von=20H=C3=BClst?= Date: Sun, 5 Jul 2026 01:25:00 +0200 Subject: [PATCH] docs: add package docstring for SDK landing page (#36) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Moritz Schmitz von Hülst --- crossplane/function/__init__.py | 63 +++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 crossplane/function/__init__.py diff --git a/crossplane/function/__init__.py b/crossplane/function/__init__.py new file mode 100644 index 0000000..6b11404 --- /dev/null +++ b/crossplane/function/__init__.py @@ -0,0 +1,63 @@ +# Copyright 2025 The Crossplane Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Python SDK for writing Crossplane composition functions. + +This SDK provides the building blocks for implementing [Crossplane composition +functions](https://docs.crossplane.io/latest/concepts/composition-functions) in +Python. Composition functions are serverless components that extend Crossplane's +composition capability, allowing you to programmatically control how infrastructure +is composed and managed. + +## Quick Start + +Install the SDK: + +```shell +pip install crossplane-function-sdk-python +``` + +Create a composition function by subclassing `Runtime`: + +```python +from crossplane.function.runtime import Runtime +from crossplane.function.request import RunFunctionRequest +from crossplane.function.response import RunFunctionResponse + + +class MyFunction(Runtime): + def Run(self, request: RunFunctionRequest) -> RunFunctionResponse: + # Your composition logic here + return response.to(request) +``` + +## Modules + +- **runtime** — Base class for implementing the function runtime and gRPC server. +- **request** — Types and utilities for parsing `RunFunctionRequest` messages. +- **response** — Types and utilities for building `RunFunctionResponse` messages. +- **resource** — Kubernetes resource types used in function pipelines. +- **logging** — Structured logging utilities for function output. + +## Protobuf Types + +The `RunFunctionRequest` and `RunFunctionResponse` types are generated from +proto3 schema definitions. See the proto modules for API reference: + +- [`proto.v1.run_function_pb2`][crossplane.function.proto.v1.run_function_pb2] — Current API +- [`proto.v1beta1.run_function_pb2`][crossplane.function.proto.v1beta1.run_function_pb2] — Legacy API + +Proto-generated fields behave like standard Python types but follow +[protobuf Python conventions](https://protobuf.dev/reference/python/python-generated/). +"""