crossplane-function-sdk-python 0.5.0__tar.gz → 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/.github/workflows/ci.yml +1 -1
  2. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/PKG-INFO +3 -3
  3. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/crossplane/function/__version__.py +1 -1
  4. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/crossplane/function/resource.py +13 -5
  5. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/pyproject.toml +4 -4
  6. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/tests/test_resource.py +5 -1
  7. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/tests/testdata/models/io/upbound/aws/s3/v1beta2.py +2 -2
  8. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  9. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  10. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  11. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/.gitignore +0 -0
  12. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/LICENSE +0 -0
  13. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/README.md +0 -0
  14. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/crossplane/function/logging.py +0 -0
  15. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/crossplane/function/proto/v1/run_function.proto +0 -0
  16. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/crossplane/function/proto/v1/run_function_pb2.py +0 -0
  17. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/crossplane/function/proto/v1/run_function_pb2.pyi +0 -0
  18. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/crossplane/function/proto/v1/run_function_pb2_grpc.py +0 -0
  19. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/crossplane/function/proto/v1beta1/run_function.proto +0 -0
  20. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/crossplane/function/proto/v1beta1/run_function_pb2.py +0 -0
  21. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/crossplane/function/proto/v1beta1/run_function_pb2.pyi +0 -0
  22. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/crossplane/function/proto/v1beta1/run_function_pb2_grpc.py +0 -0
  23. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/crossplane/function/response.py +0 -0
  24. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/crossplane/function/runtime.py +0 -0
  25. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/renovate.json +0 -0
  26. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/tests/test_response.py +0 -0
  27. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/tests/test_runtime.py +0 -0
  28. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/tests/testdata/models/io/k8s/apimachinery/pkg/apis/__init__.py +0 -0
  29. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/tests/testdata/models/io/k8s/apimachinery/pkg/apis/meta/__init__.py +0 -0
  30. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/tests/testdata/models/io/k8s/apimachinery/pkg/apis/meta/v1.py +0 -0
  31. {crossplane_function_sdk_python-0.5.0 → crossplane_function_sdk_python-0.6.0}/tests/testdata/models/io/upbound/aws/s3/__init__.py +0 -0
@@ -120,7 +120,7 @@ jobs:
120
120
  path: "dist"
121
121
 
122
122
  - name: Publish to PyPI
123
- uses: pypa/gh-action-pypi-publish@v1.10.3
123
+ uses: pypa/gh-action-pypi-publish@v1.12.3
124
124
  with:
125
125
  # Note that this is currently being pushed to the 'crossplane' PyPI
126
126
  # user (not org). See @negz if you need access - PyPI requires 2FA to
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: crossplane-function-sdk-python
3
- Version: 0.5.0
3
+ Version: 0.6.0
4
4
  Summary: The Python SDK for Crossplane composition functions
5
5
  Project-URL: Documentation, https://github.com/crossplane/function-sdk-python#readme
6
6
  Project-URL: Issues, https://github.com/crossplane/function-sdk-python/issues
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.11
14
14
  Requires-Python: >=3.11
15
15
  Requires-Dist: grpcio-reflection==1.*
16
16
  Requires-Dist: grpcio==1.*
17
- Requires-Dist: protobuf==5.27.2
17
+ Requires-Dist: protobuf==5.29.3
18
18
  Requires-Dist: pydantic==2.*
19
19
  Requires-Dist: structlog==24.*
20
20
  Description-Content-Type: text/markdown
@@ -15,4 +15,4 @@
15
15
  """The version of function-sdk-python."""
16
16
 
17
17
  # This is set at build time, using "hatch version"
18
- __version__ = "0.5.0"
18
+ __version__ = "0.6.0"
@@ -38,7 +38,15 @@ def update(r: fnv1.Resource, source: dict | structpb.Struct | pydantic.BaseModel
38
38
  """
39
39
  match source:
40
40
  case pydantic.BaseModel():
41
- r.resource.update(source.model_dump(exclude_defaults=True, warnings=False))
41
+ data = source.model_dump(exclude_defaults=True, warnings=False)
42
+ # In Pydantic, exclude_defaults=True in model_dump excludes fields
43
+ # that have their value equal to the default. If a field like
44
+ # apiVersion is set to its default value 's3.aws.upbound.io/v1beta2'
45
+ # (and not explicitly provided during initialization), it will be
46
+ # excluded from the serialized output.
47
+ data['apiVersion'] = source.apiVersion
48
+ data['kind'] = source.kind
49
+ r.resource.update(data)
42
50
  case structpb.Struct():
43
51
  # TODO(negz): Use struct_to_dict and update to match other semantics?
44
52
  r.resource.MergeFrom(source)
@@ -110,10 +118,10 @@ def get_condition(resource: structpb.Struct, typ: str) -> Condition:
110
118
  """
111
119
  unknown = Condition(typ=typ, status="Unknown")
112
120
 
113
- if "status" not in resource:
121
+ if not resource or "status" not in resource:
114
122
  return unknown
115
123
 
116
- if "conditions" not in resource["status"]:
124
+ if not resource["status"] or "conditions" not in resource["status"]:
117
125
  return unknown
118
126
 
119
127
  for c in resource["status"]["conditions"]:
@@ -149,9 +157,9 @@ class Credentials:
149
157
  def get_credentials(req: structpb.Struct, name: str) -> Credentials:
150
158
  """Get the supplied credentials."""
151
159
  empty = Credentials(type="data", data={})
152
- if "credentials" not in req:
160
+ if not req or "credentials" not in req:
153
161
  return empty
154
- if name not in req["credentials"]:
162
+ if not req["credentials"] or name not in req["credentials"]:
155
163
  return empty
156
164
  return Credentials(
157
165
  type=req["credentials"][name]["type"],
@@ -19,7 +19,7 @@ classifiers = [
19
19
  dependencies = [
20
20
  "grpcio==1.*",
21
21
  "grpcio-reflection==1.*",
22
- "protobuf==5.27.2",
22
+ "protobuf==5.29.3",
23
23
  "pydantic==2.*",
24
24
  "structlog==24.*",
25
25
  ]
@@ -38,13 +38,13 @@ validate-bump = false # Allow going from 0.0.0.dev0+x to 0
38
38
  [tool.hatch.envs.default]
39
39
  type = "virtual"
40
40
  path = ".venv-default"
41
- dependencies = ["ipython==8.28.0"]
41
+ dependencies = ["ipython==8.31.0"]
42
42
 
43
43
  [tool.hatch.envs.generate]
44
44
  type = "virtual"
45
45
  detached = true
46
46
  path = ".venv-generate"
47
- dependencies = ["grpcio-tools==1.66.2"]
47
+ dependencies = ["grpcio-tools==1.69.0"]
48
48
 
49
49
  [tool.hatch.envs.generate.scripts]
50
50
  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"
@@ -62,7 +62,7 @@ packages = ["crossplane"]
62
62
 
63
63
  # This special environment is used by hatch fmt.
64
64
  [tool.hatch.envs.hatch-static-analysis]
65
- dependencies = ["ruff==0.6.9"]
65
+ dependencies = ["ruff==0.9.0"]
66
66
  config-path = "none" # Disable Hatch's default Ruff config.
67
67
 
68
68
  [tool.ruff]
@@ -90,7 +90,11 @@ class TestResource(unittest.TestCase):
90
90
  ),
91
91
  want=fnv1.Resource(
92
92
  resource=resource.dict_to_struct(
93
- {"spec": {"forProvider": {"region": "us-west-2"}}}
93
+ {
94
+ "apiVersion": "s3.aws.upbound.io/v1beta2",
95
+ "kind": "Bucket",
96
+ "spec": {"forProvider": {"region": "us-west-2"}},
97
+ }
94
98
  ),
95
99
  ),
96
100
  ),
@@ -759,11 +759,11 @@ class Status(BaseModel):
759
759
 
760
760
 
761
761
  class Bucket(BaseModel):
762
- apiVersion: Optional[str] = None
762
+ apiVersion: Optional[str] = 's3.aws.upbound.io/v1beta2'
763
763
  """
764
764
  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
765
765
  """
766
- kind: Optional[str] = None
766
+ kind: Optional[str] = 'Bucket'
767
767
  """
768
768
  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
769
769
  """