A template for writing a composition function in Python
Go to file
Nic Cope f109678951 Add an Input CRD
We don't currently have any conventions for strongly typed inputs in
Python. I expect that Python functions will just use struct_to_dict to
read their inputs as unstructured data. It's useful to demonstrate
having an input schema in the template, though. Places like
https://marketplace.upbound.io use this CRD schema to document a
function's input.

Signed-off-by: Nic Cope <nicc@rk0n.org>
2024-01-09 16:59:18 -08:00
.github Update actions/setup-python action to v5 2023-12-06 13:31:49 +00:00
example Add function-template-python 2023-11-21 18:24:54 -08:00
function Switch to crossplane-function-sdk-python from pip 2024-01-04 16:43:08 -08:00
package Add an Input CRD 2024-01-09 16:59:18 -08:00
tests Add function-template-python 2023-11-21 18:24:54 -08:00
.gitignore Initial commit 2023-11-21 13:48:35 -08:00
Dockerfile Add function-template-python 2023-11-21 18:24:54 -08:00
LICENSE Initial commit 2023-11-21 13:48:35 -08:00
README.md Don't mention renaming the project in pyproject.yaml 2024-01-04 16:43:55 -08:00
pyproject.toml Remove duplicate tool.hatch.build.targets.wheel 2024-01-04 16:49:28 -08:00
renovate.json Add renovate.json 2023-11-21 21:48:54 +00:00

README.md

function-template-python

CI

A template for writing a composition function in Python.

To learn how to use this template:

If you just want to jump in and get started:

  1. Replace function-template-python with your function's name in package/crossplane.yaml.
  2. Add your logic to RunFunction in function/fn.py
  3. Add tests for your logic in test/test_fn.py
  4. Update this file, README.md, to be about your function!

This template uses Python, Docker, and the Crossplane CLI to build functions.

# Lint the code - see pyproject.toml
hatch run lint:check

# Run unit tests - see tests/test_fn.py
hatch run test:unit

# Build the function's runtime image - see Dockerfile
$ docker build . --tag=runtime

# Build a function package - see package/crossplane.yaml
$ crossplane xpkg build -f package --embed-runtime-image=runtime