A template for writing a composition function in Python.
To learn how to use this template:
- Follow the guide to writing a composition function in Python
- Learn about how composition functions work
- Read the function-sdk-python package documentation
If you just want to jump in and get started:
- Replace
function-template-python
with your function's name inpackage/crossplane.yaml
. - Add your logic to
RunFunction
infunction/fn.py
- Add tests for your logic in
test/test_fn.py
- Update this file,
README.md
, to be about your function!
This template uses Python, Docker, and the Crossplane CLI to build functions.
# Run the code in development mode, for crossplane beta render
hatch run development
# Lint and format the code - see pyproject.toml
hatch fmt
# Run unit tests - see tests/test_fn.py
hatch test
# 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