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> |
||
---|---|---|
.github | ||
example | ||
function | ||
package | ||
tests | ||
.gitignore | ||
Dockerfile | ||
LICENSE | ||
README.md | ||
pyproject.toml | ||
renovate.json |
README.md
function-template-python
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:
- 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.
# 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