From 6a256486e23c9e38215ca712d870de2acdadc0b7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 16 Oct 2024 08:53:28 +0000 Subject: [PATCH 01/16] chore(deps): update dependency grpcio-tools to v1.67.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 40c2cb9..c75aa8c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ dependencies = ["ipython==8.28.0"] type = "virtual" detached = true path = ".venv-generate" -dependencies = ["grpcio-tools==1.66.2"] +dependencies = ["grpcio-tools==1.67.0"] [tool.hatch.envs.generate.scripts] protoc = "python -m grpc_tools.protoc --proto_path=. --python_out=. --pyi_out=. --grpc_python_out=. crossplane/function/proto/v1beta1/run_function.proto crossplane/function/proto/v1/run_function.proto" From 5a3e1536eecd2231bd964d421ae51651d12fbaa5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2024 17:25:30 +0000 Subject: [PATCH 02/16] chore(deps): update dependency ruff to v0.7.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 40c2cb9..ef0276e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ packages = ["crossplane"] # This special environment is used by hatch fmt. [tool.hatch.envs.hatch-static-analysis] -dependencies = ["ruff==0.6.9"] +dependencies = ["ruff==0.7.0"] config-path = "none" # Disable Hatch's default Ruff config. [tool.ruff] From 41eca588a1f438548e37fe712232ab7d748acf3c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:33:59 +0000 Subject: [PATCH 03/16] chore(deps): update dependency ruff to v0.7.1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 93ee613..d115778 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ packages = ["crossplane"] # This special environment is used by hatch fmt. [tool.hatch.envs.hatch-static-analysis] -dependencies = ["ruff==0.7.0"] +dependencies = ["ruff==0.7.1"] config-path = "none" # Disable Hatch's default Ruff config. [tool.ruff] From 569af1d6d33465114cb65d482b60c16869d4e83e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 25 Oct 2024 10:48:41 +0000 Subject: [PATCH 04/16] chore(deps): update dependency ipython to v8.29.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 93ee613..64986cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ validate-bump = false # Allow going from 0.0.0.dev0+x to 0 [tool.hatch.envs.default] type = "virtual" path = ".venv-default" -dependencies = ["ipython==8.28.0"] +dependencies = ["ipython==8.29.0"] [tool.hatch.envs.generate] type = "virtual" From 7452119ba8b001e30333dc1721fb8b8b34839f94 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 7 Nov 2024 01:51:37 +0000 Subject: [PATCH 05/16] chore(deps): update pypa/gh-action-pypi-publish action to v1.12.2 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bfbcc5d..c664053 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,7 +120,7 @@ jobs: path: "dist" - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@v1.10.3 + uses: pypa/gh-action-pypi-publish@v1.12.2 with: # Note that this is currently being pushed to the 'crossplane' PyPI # user (not org). See @negz if you need access - PyPI requires 2FA to From 685918f02d764bea56e2aafb432a5b6501354d5d Mon Sep 17 00:00:00 2001 From: Bob Haddleton Date: Wed, 18 Dec 2024 14:27:11 -0600 Subject: [PATCH 06/16] Bump protobuf and add defensive checks to get_* helpers Signed-off-by: Bob Haddleton --- crossplane/function/resource.py | 8 ++++---- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crossplane/function/resource.py b/crossplane/function/resource.py index 322a482..ac08c0e 100644 --- a/crossplane/function/resource.py +++ b/crossplane/function/resource.py @@ -110,10 +110,10 @@ def get_condition(resource: structpb.Struct, typ: str) -> Condition: """ unknown = Condition(typ=typ, status="Unknown") - if "status" not in resource: + if not resource or "status" not in resource: return unknown - if "conditions" not in resource["status"]: + if not resource["status"] or "conditions" not in resource["status"]: return unknown for c in resource["status"]["conditions"]: @@ -149,9 +149,9 @@ class Credentials: def get_credentials(req: structpb.Struct, name: str) -> Credentials: """Get the supplied credentials.""" empty = Credentials(type="data", data={}) - if "credentials" not in req: + if not req or "credentials" not in req: return empty - if name not in req["credentials"]: + if not req["credentials"] or name not in req["credentials"]: return empty return Credentials( type=req["credentials"][name]["type"], diff --git a/pyproject.toml b/pyproject.toml index 13b418d..1025850 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ classifiers = [ dependencies = [ "grpcio==1.*", "grpcio-reflection==1.*", - "protobuf==5.27.2", + "protobuf==5.28.1", "pydantic==2.*", "structlog==24.*", ] From 70e86c0d30a93a64750d29f0b3f1b04543439eee Mon Sep 17 00:00:00 2001 From: Christopher Haar Date: Mon, 6 Jan 2025 17:10:32 +0100 Subject: [PATCH 07/16] fix(defaults): add apiVersion and kind Signed-off-by: Christopher Haar --- crossplane/function/resource.py | 10 +++++++++- tests/test_resource.py | 6 +++++- tests/testdata/models/io/upbound/aws/s3/v1beta2.py | 4 ++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/crossplane/function/resource.py b/crossplane/function/resource.py index 322a482..3cc79a9 100644 --- a/crossplane/function/resource.py +++ b/crossplane/function/resource.py @@ -38,7 +38,15 @@ def update(r: fnv1.Resource, source: dict | structpb.Struct | pydantic.BaseModel """ match source: case pydantic.BaseModel(): - r.resource.update(source.model_dump(exclude_defaults=True, warnings=False)) + data = source.model_dump(exclude_defaults=True, warnings=False) + # In Pydantic, exclude_defaults=True in model_dump excludes fields + # that have their value equal to the default. If a field like + # apiVersion is set to its default value 's3.aws.upbound.io/v1beta2' + # (and not explicitly provided during initialization), it will be + # excluded from the serialized output. + data['apiVersion'] = source.apiVersion + data['kind'] = source.kind + r.resource.update(data) case structpb.Struct(): # TODO(negz): Use struct_to_dict and update to match other semantics? r.resource.MergeFrom(source) diff --git a/tests/test_resource.py b/tests/test_resource.py index e9c818f..2f9523b 100644 --- a/tests/test_resource.py +++ b/tests/test_resource.py @@ -90,7 +90,11 @@ class TestCase: ), want=fnv1.Resource( resource=resource.dict_to_struct( - {"spec": {"forProvider": {"region": "us-west-2"}}} + { + "apiVersion": "s3.aws.upbound.io/v1beta1", + "kind": "Bucket", + "spec": {"forProvider": {"region": "us-west-2"}}, + } ), ), ), diff --git a/tests/testdata/models/io/upbound/aws/s3/v1beta2.py b/tests/testdata/models/io/upbound/aws/s3/v1beta2.py index 0a678e0..d6253ff 100644 --- a/tests/testdata/models/io/upbound/aws/s3/v1beta2.py +++ b/tests/testdata/models/io/upbound/aws/s3/v1beta2.py @@ -759,11 +759,11 @@ class Status(BaseModel): class Bucket(BaseModel): - apiVersion: Optional[str] = None + apiVersion: Optional[str] = 's3.aws.upbound.io/v1beta2' """ APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources """ - kind: Optional[str] = None + kind: Optional[str] = 'Bucket' """ Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds """ From 9ef55d251c28455044abb686d6f3774a46c8ad5c Mon Sep 17 00:00:00 2001 From: Bob Haddleton Date: Wed, 8 Jan 2025 13:33:33 -0600 Subject: [PATCH 08/16] fix(unittests): fix bucket api version --- tests/test_resource.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_resource.py b/tests/test_resource.py index 2f9523b..5952279 100644 --- a/tests/test_resource.py +++ b/tests/test_resource.py @@ -91,7 +91,7 @@ class TestCase: want=fnv1.Resource( resource=resource.dict_to_struct( { - "apiVersion": "s3.aws.upbound.io/v1beta1", + "apiVersion": "s3.aws.upbound.io/v1beta2", "kind": "Bucket", "spec": {"forProvider": {"region": "us-west-2"}}, } From 5139481ee57466fd22b46844f3d715f63de13cd9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 19:48:30 +0000 Subject: [PATCH 09/16] fix(deps): update dependency protobuf to v5.29.2 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1025850..cc80033 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ classifiers = [ dependencies = [ "grpcio==1.*", "grpcio-reflection==1.*", - "protobuf==5.28.1", + "protobuf==5.29.2", "pydantic==2.*", "structlog==24.*", ] From 6b3e0cbcc46bda1bb54986830a9d85315cb9c6ef Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 19:50:30 +0000 Subject: [PATCH 10/16] chore(deps): update pypa/gh-action-pypi-publish action to v1.12.3 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c664053..e27307f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,7 +120,7 @@ jobs: path: "dist" - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@v1.12.2 + uses: pypa/gh-action-pypi-publish@v1.12.3 with: # Note that this is currently being pushed to the 'crossplane' PyPI # user (not org). See @negz if you need access - PyPI requires 2FA to From b8dd9ec25661c297201a3ad35cfe79a15b54fc49 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 19:50:52 +0000 Subject: [PATCH 11/16] chore(deps): update dependency grpcio-tools to v1.69.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index cc80033..7d2476b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ dependencies = ["ipython==8.29.0"] type = "virtual" detached = true path = ".venv-generate" -dependencies = ["grpcio-tools==1.67.0"] +dependencies = ["grpcio-tools==1.69.0"] [tool.hatch.envs.generate.scripts] protoc = "python -m grpc_tools.protoc --proto_path=. --python_out=. --pyi_out=. --grpc_python_out=. crossplane/function/proto/v1beta1/run_function.proto crossplane/function/proto/v1/run_function.proto" From 773346f3f8f73fd1e0bdd4ee7859e540333c0697 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 19:52:55 +0000 Subject: [PATCH 12/16] chore(deps): update dependency ruff to v0.8.6 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7d2476b..ac2edcc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ packages = ["crossplane"] # This special environment is used by hatch fmt. [tool.hatch.envs.hatch-static-analysis] -dependencies = ["ruff==0.7.1"] +dependencies = ["ruff==0.8.6"] config-path = "none" # Disable Hatch's default Ruff config. [tool.ruff] From 479335d1e337e82908de7afeaeb8dcbfc6be8c88 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 20:16:39 +0000 Subject: [PATCH 13/16] chore(deps): update dependency ipython to v8.31.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ac2edcc..33318e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ validate-bump = false # Allow going from 0.0.0.dev0+x to 0 [tool.hatch.envs.default] type = "virtual" path = ".venv-default" -dependencies = ["ipython==8.29.0"] +dependencies = ["ipython==8.31.0"] [tool.hatch.envs.generate] type = "virtual" From 8f57f81ea1d5c5a44b4fa672b522b7ad726750ee Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 01:22:39 +0000 Subject: [PATCH 14/16] fix(deps): update dependency protobuf to v5.29.3 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 33318e5..c90eb26 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ classifiers = [ dependencies = [ "grpcio==1.*", "grpcio-reflection==1.*", - "protobuf==5.29.2", + "protobuf==5.29.3", "pydantic==2.*", "structlog==24.*", ] From a82962a952bbf2c5d8074e3daa6f4c474a6cfa99 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 17:42:43 +0000 Subject: [PATCH 15/16] chore(deps): update dependency ruff to v0.9.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c90eb26..c054cf7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ packages = ["crossplane"] # This special environment is used by hatch fmt. [tool.hatch.envs.hatch-static-analysis] -dependencies = ["ruff==0.8.6"] +dependencies = ["ruff==0.9.0"] config-path = "none" # Disable Hatch's default Ruff config. [tool.ruff] From f1ae43e72548150b6ee1ee080430cfb94e495cae Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 21:12:29 +0000 Subject: [PATCH 16/16] chore(deps): update dependency ruff to v0.9.1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c054cf7..b58b8e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ packages = ["crossplane"] # This special environment is used by hatch fmt. [tool.hatch.envs.hatch-static-analysis] -dependencies = ["ruff==0.9.0"] +dependencies = ["ruff==0.9.1"] config-path = "none" # Disable Hatch's default Ruff config. [tool.ruff]