What problem are you facing?
The Python function template pins an old SDK that has a behaviour bug we've since fixed upstream.
When you scaffold a Python function the generated pyproject.toml depends on crossplane-function-sdk-python==0.11.0 (see pyproject.toml.tmpl). That version serializes composed resources with model_dump(exclude_defaults=True), which doesn't play well with the models crossplane project build now generates.
The background is in #64, where we bumped the pinned datamodel-code-generator image. The newer generator emits a field with an object default as a raw dict plus validate_default=True rather than a default_factory. Under exclude_defaults that means an unset field like spec.providerConfigRef no longer compares equal to its declared default, so it leaks into every composed resource — every Upbound GCP/AWS resource ends up with an explicit spec.providerConfigRef: {kind: ClusterProviderConfig, name: default} it previously omitted. The full analysis is in function-sdk-python#207.
The SDK fix is function-sdk-python#208, which switches to exclude_unset. That serializes only the fields a function actually set, which is the right question to ask for server-side apply intent, and it's immune to however the generator chooses to represent a default. It's merged but not released yet — the latest SDK release is v0.12.0, so the fix will land in the next one, which should be v0.13.0.
How could Crossplane help solve your problem?
Once the SDK release with function-sdk-python#208 is out, bump the pinned version in the Python function template from 0.11.0 to it (v0.13.0, assuming that's the next release). That's the one spot in pyproject.toml.tmpl, so newly scaffolded functions get the corrected serialization behaviour by default.
This is a reminder to come back once the SDK ships; we should confirm the exact version then.
What problem are you facing?
The Python function template pins an old SDK that has a behaviour bug we've since fixed upstream.
When you scaffold a Python function the generated
pyproject.tomldepends oncrossplane-function-sdk-python==0.11.0(seepyproject.toml.tmpl). That version serializes composed resources withmodel_dump(exclude_defaults=True), which doesn't play well with the modelscrossplane project buildnow generates.The background is in #64, where we bumped the pinned
datamodel-code-generatorimage. The newer generator emits a field with an object default as a raw dict plusvalidate_default=Truerather than adefault_factory. Underexclude_defaultsthat means an unset field likespec.providerConfigRefno longer compares equal to its declared default, so it leaks into every composed resource — every Upbound GCP/AWS resource ends up with an explicitspec.providerConfigRef: {kind: ClusterProviderConfig, name: default}it previously omitted. The full analysis is in function-sdk-python#207.The SDK fix is function-sdk-python#208, which switches to
exclude_unset. That serializes only the fields a function actually set, which is the right question to ask for server-side apply intent, and it's immune to however the generator chooses to represent a default. It's merged but not released yet — the latest SDK release is v0.12.0, so the fix will land in the next one, which should be v0.13.0.How could Crossplane help solve your problem?
Once the SDK release with function-sdk-python#208 is out, bump the pinned version in the Python function template from
0.11.0to it (v0.13.0, assuming that's the next release). That's the one spot inpyproject.toml.tmpl, so newly scaffolded functions get the corrected serialization behaviour by default.This is a reminder to come back once the SDK ships; we should confirm the exact version then.