Skip to content

Commit 6ef2300

Browse files
docs: add package docstring for SDK landing page (#36)
Signed-off-by: Moritz Schmitz von Hülst <mschmitzvonhuelst@gmail.com>
1 parent 8d05536 commit 6ef2300

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

crossplane/function/__init__.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Copyright 2025 The Crossplane Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""Python SDK for writing Crossplane composition functions.
16+
17+
This SDK provides the building blocks for implementing [Crossplane composition
18+
functions](https://docs.crossplane.io/latest/concepts/composition-functions) in
19+
Python. Composition functions are serverless components that extend Crossplane's
20+
composition capability, allowing you to programmatically control how infrastructure
21+
is composed and managed.
22+
23+
## Quick Start
24+
25+
Install the SDK:
26+
27+
```shell
28+
pip install crossplane-function-sdk-python
29+
```
30+
31+
Create a composition function by subclassing `Runtime`:
32+
33+
```python
34+
from crossplane.function.runtime import Runtime
35+
from crossplane.function.request import RunFunctionRequest
36+
from crossplane.function.response import RunFunctionResponse
37+
38+
39+
class MyFunction(Runtime):
40+
def Run(self, request: RunFunctionRequest) -> RunFunctionResponse:
41+
# Your composition logic here
42+
return response.to(request)
43+
```
44+
45+
## Modules
46+
47+
- **runtime** — Base class for implementing the function runtime and gRPC server.
48+
- **request** — Types and utilities for parsing `RunFunctionRequest` messages.
49+
- **response** — Types and utilities for building `RunFunctionResponse` messages.
50+
- **resource** — Kubernetes resource types used in function pipelines.
51+
- **logging** — Structured logging utilities for function output.
52+
53+
## Protobuf Types
54+
55+
The `RunFunctionRequest` and `RunFunctionResponse` types are generated from
56+
proto3 schema definitions. See the proto modules for API reference:
57+
58+
- [`proto.v1.run_function_pb2`][crossplane.function.proto.v1.run_function_pb2] — Current API
59+
- [`proto.v1beta1.run_function_pb2`][crossplane.function.proto.v1beta1.run_function_pb2] — Legacy API
60+
61+
Proto-generated fields behave like standard Python types but follow
62+
[protobuf Python conventions](https://protobuf.dev/reference/python/python-generated/).
63+
"""

0 commit comments

Comments
 (0)