crossplane-function-sdk-python 0.13.0__tar.gz → 0.14.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 (44) hide show
  1. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/PKG-INFO +1 -1
  2. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/crossplane/function/__version__.py +1 -1
  3. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/crossplane/function/response.py +6 -3
  4. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/crossplane/function/runtime.py +5 -5
  5. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/tests/test_response.py +15 -11
  6. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  7. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  8. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  9. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/.github/workflows/ci.yml +0 -0
  10. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/.gitignore +0 -0
  11. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/CODEOWNERS +0 -0
  12. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/LICENSE +0 -0
  13. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/OWNERS.md +0 -0
  14. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/README.md +0 -0
  15. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/crossplane/function/logging.py +0 -0
  16. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/crossplane/function/proto/v1/run_function.proto +0 -0
  17. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/crossplane/function/proto/v1/run_function_pb2.py +0 -0
  18. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/crossplane/function/proto/v1/run_function_pb2.pyi +0 -0
  19. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/crossplane/function/proto/v1/run_function_pb2_grpc.py +0 -0
  20. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/crossplane/function/proto/v1beta1/run_function.proto +0 -0
  21. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/crossplane/function/proto/v1beta1/run_function_pb2.py +0 -0
  22. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/crossplane/function/proto/v1beta1/run_function_pb2.pyi +0 -0
  23. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/crossplane/function/proto/v1beta1/run_function_pb2_grpc.py +0 -0
  24. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/crossplane/function/py.typed +0 -0
  25. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/crossplane/function/request.py +0 -0
  26. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/crossplane/function/resource.py +0 -0
  27. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/pyproject.toml +0 -0
  28. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/renovate.json +0 -0
  29. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/tests/test_request.py +0 -0
  30. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/tests/test_resource.py +0 -0
  31. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/tests/test_runtime.py +0 -0
  32. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/tests/testdata/models/io/k8s/api/__init__.py +0 -0
  33. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/tests/testdata/models/io/k8s/api/resource/__init__.py +0 -0
  34. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/tests/testdata/models/io/k8s/api/resource/v1.py +0 -0
  35. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/tests/testdata/models/io/k8s/apimachinery/pkg/apis/__init__.py +0 -0
  36. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/tests/testdata/models/io/k8s/apimachinery/pkg/apis/meta/__init__.py +0 -0
  37. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/tests/testdata/models/io/k8s/apimachinery/pkg/apis/meta/v1.py +0 -0
  38. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/tests/testdata/models/io/upbound/aws/s3/__init__.py +0 -0
  39. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/tests/testdata/models/io/upbound/aws/s3/v1beta2.py +0 -0
  40. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/tests/testdata/models/io/upbound/m/__init__.py +0 -0
  41. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/tests/testdata/models/io/upbound/m/aws/__init__.py +0 -0
  42. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/tests/testdata/models/io/upbound/m/aws/iam/__init__.py +0 -0
  43. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/tests/testdata/models/io/upbound/m/aws/iam/accountalias/__init__.py +0 -0
  44. {crossplane_function_sdk_python-0.13.0 → crossplane_function_sdk_python-0.14.0}/tests/testdata/models/io/upbound/m/aws/iam/accountalias/v1beta1.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crossplane-function-sdk-python
3
- Version: 0.13.0
3
+ Version: 0.14.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
@@ -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.13.0"
18
+ __version__ = "0.14.0"
@@ -163,13 +163,16 @@ def require_resources( # noqa: PLR0913
163
163
  namespace: The namespace to search in (optional).
164
164
 
165
165
  Raises:
166
- ValueError: If both match_name and match_labels are provided, or neither.
166
+ ValueError: If both match_name and match_labels are provided.
167
167
 
168
168
  This tells Crossplane to fetch the specified resources and include them
169
169
  in the next call to the function in req.required_resources[name].
170
+
171
+ If neither match_name nor match_labels is provided, all resources of the
172
+ given api_version and kind are matched.
170
173
  """
171
- if (match_name is None) == (match_labels is None):
172
- msg = "Exactly one of match_name or match_labels must be provided"
174
+ if match_name is not None and match_labels is not None:
175
+ msg = "match_name and match_labels are mutually exclusive"
173
176
  raise ValueError(msg)
174
177
 
175
178
  selector = fnv1.ResourceSelector(
@@ -70,7 +70,7 @@ def load_credentials(tls_certs_dir: str) -> grpc.ServerCredentials:
70
70
 
71
71
 
72
72
  def serve(
73
- function: grpcv1.FunctionRunnerService,
73
+ function: grpcv1.FunctionRunnerServiceServicer,
74
74
  address: str,
75
75
  *,
76
76
  creds: grpc.ServerCredentials,
@@ -134,20 +134,20 @@ def serve(
134
134
  loop.close()
135
135
 
136
136
 
137
- class BetaFunctionRunner(grpcv1beta1.FunctionRunnerService):
137
+ class BetaFunctionRunner(grpcv1beta1.FunctionRunnerServiceServicer):
138
138
  """A BetaFunctionRunner handles beta gRPC RunFunctionRequests.
139
139
 
140
- It handles requests by passing them to a wrapped v1.FunctionRunnerService.
140
+ It handles requests by passing them to a wrapped v1.FunctionRunnerServiceServicer.
141
141
  Incoming v1beta1 requests are converted to v1 by round-tripping them through
142
142
  serialization. Outgoing requests are converted from v1 to v1beta1 the same
143
143
  way.
144
144
  """
145
145
 
146
- def __init__(self, wrapped: grpcv1.FunctionRunnerService):
146
+ def __init__(self, wrapped: grpcv1.FunctionRunnerServiceServicer):
147
147
  """Create a new BetaFunctionRunner."""
148
148
  self.wrapped = wrapped
149
149
 
150
- async def RunFunction( # noqa: N802 # gRPC requires this name.
150
+ async def RunFunction( # noqa: N802 # gRPC requires this name. # pyright: ignore[reportIncompatibleMethodOverride]
151
151
  self, req: fnv1beta1.RunFunctionRequest, context: grpc.aio.ServicerContext
152
152
  ) -> fnv1beta1.RunFunctionResponse:
153
153
  """Run the underlying function."""
@@ -233,6 +233,21 @@ class TestResponse(unittest.TestCase):
233
233
  match_name="worker-1",
234
234
  ),
235
235
  ),
236
+ TestCase(
237
+ reason="Should match all resources of a kind with no match field.",
238
+ rsp=fnv1.RunFunctionResponse(),
239
+ name="all-pods",
240
+ api_version="v1",
241
+ kind="Pod",
242
+ match_name=None,
243
+ match_labels=None,
244
+ namespace="default",
245
+ want_selector=fnv1.ResourceSelector(
246
+ api_version="v1",
247
+ kind="Pod",
248
+ namespace="default",
249
+ ),
250
+ ),
236
251
  ]
237
252
 
238
253
  for case in cases:
@@ -270,17 +285,6 @@ class TestResponse(unittest.TestCase):
270
285
  match_labels={"app": "test"},
271
286
  )
272
287
 
273
- # Should raise ValueError if neither match_name nor match_labels are provided
274
- with self.assertRaises(ValueError):
275
- response.require_resources(
276
- rsp,
277
- "test",
278
- "v1",
279
- "Pod",
280
- match_name=None,
281
- match_labels=None,
282
- )
283
-
284
288
  def test_require_schema(self) -> None:
285
289
  @dataclasses.dataclass
286
290
  class TestCase: