crossplane-function-pythonic 0.3.0__py3-none-any.whl → 0.4.0__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crossplane-function-pythonic
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: A Python centric Crossplane Function
5
5
  Project-URL: Documentation, https://github.com/crossplane-contrib/function-pythonic#readme
6
6
  Project-URL: Issues, https://github.com/crossplane-contrib/function-pythonic/issues
@@ -14,12 +14,14 @@ Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Programming Language :: Python :: 3.13
15
15
  Classifier: Programming Language :: Python :: 3.14
16
16
  Requires-Python: <3.15,>=3.12
17
- Requires-Dist: crossplane-function-sdk-python==0.10.0
17
+ Requires-Dist: crossplane-function-sdk-python==0.11.0
18
+ Requires-Dist: inflect==7.5.0
19
+ Requires-Dist: kr8s==0.20.15
18
20
  Requires-Dist: pyyaml==6.0.3
19
21
  Provides-Extra: packages
20
- Requires-Dist: kopf==1.40.0; extra == 'packages'
22
+ Requires-Dist: kopf==1.42.5; extra == 'packages'
21
23
  Provides-Extra: pip-install
22
- Requires-Dist: pip==25.3; extra == 'pip-install'
24
+ Requires-Dist: pip==26.0.1; extra == 'pip-install'
23
25
  Description-Content-Type: text/markdown
24
26
 
25
27
  # function-pythonic
@@ -54,7 +56,7 @@ spec:
54
56
  composite: |
55
57
  class VpcComposite(BaseComposite):
56
58
  def compose(self):
57
- vpc = self.resources.vpc('ec2.aws.crossplane.io/v1beta1', 'VPC')
59
+ vpc = self.resources.vpc('VPC', 'ec2.aws.crossplane.io/v1beta1')
58
60
  vpc.spec.forProvider.region = self.spec.region
59
61
  vpc.spec.forProvider.cidrBlock = self.spec.cidr
60
62
  self.status.vpcId = vpc.status.atProvider.vpcId
@@ -81,7 +83,7 @@ kind: Function
81
83
  metadata:
82
84
  name: function-pythonic
83
85
  spec:
84
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.3.0
86
+ package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.4.0
85
87
  ```
86
88
 
87
89
  ### Crossplane V1
@@ -93,7 +95,7 @@ kind: Function
93
95
  metadata:
94
96
  name: function-pythonic
95
97
  spec:
96
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.3.0
98
+ package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.4.0
97
99
  runtimeConfigRef:
98
100
  name: function-pythonic
99
101
  --
@@ -128,12 +130,12 @@ condition, the composition will be terminated or the observed value for that fie
128
130
  be used, depending on the `unknownsFatal` settings.
129
131
 
130
132
  Take the following example:
131
- ```yaml
132
- vpc = self.resources.VPC('ec2.aws.crossplane.io/v1beta1', 'VPC')
133
+ ```python
134
+ vpc = self.resources.VPC('VPC', 'ec2.aws.crossplane.io/v1beta1')
133
135
  vpc.spec.forProvider.region = 'us-east-1
134
136
  vpc.spec.forProvider.cidrBlock = '10.0.0.0/16'
135
137
 
136
- subnet = self.resources.SubnetA('ec2.aws.crossplane.io/v1beta1', 'Subnet')
138
+ subnet = self.resources.SubnetA('Subnet', 'ec2.aws.crossplane.io/v1beta1')
137
139
  subnet.spec.forProvider.region = 'us-east-1'
138
140
  subnet.spec.forProvider.vpcId = vpc.status.atProvider.vpcId
139
141
  subnet.spec.forProvider.availabilityZone = 'us-east-1a'
@@ -150,19 +152,46 @@ overridden for all composed resource by setting the Composite `self.unknownsFata
150
152
  to False, or at the individual composed resource level by setting the
151
153
  `Resource.unknownsFatal` field to False.
152
154
 
155
+ ## Explicit Dependencies
156
+
157
+ At times, the above implicit dependency handling does not account for all cases.
158
+ Explicit dependencies can be configured using the resource `addDependency` method.
159
+ The dependency's "ready" is used to determine when that dependency is available
160
+ for use. The dependency's ready state can either be explictly set, or will be
161
+ defaulted to it's auto-ready calculation.
162
+
163
+ Here is an example of specifying an explicit dependency:
164
+ ```yaml
165
+ crd = self.resources.KarpenterCrdRelease('Release', 'helm.crossplane.io/v1beta1')
166
+ crd.spec.deletionPolicy = 'Orphan'
167
+ crd.spec.forProvider.chart.repository = 'oci://public.ecr.aws/karpenter'
168
+ crd.spec.forProvider.chart.name = 'karpenter-crd'
169
+ crd.spec.forProvider.chart.version = '1.8.6'
170
+ crd.spec.forProvider.namespace = 'karpenter'
171
+ crd.externalName = 'karpenter-crd'
172
+ karpenter = self.resources.KarpenterRelease('Release', 'helm.crossplane.io/v1beta1')
173
+ karpenter.addDependency(crd)
174
+ karpenter.spec.deletionPolicy = 'Orphan'
175
+ karpenter.spec.forProvider.chart.repository = 'oci://public.ecr.aws/karpenter'
176
+ karpenter.spec.forProvider.chart.name = 'karpenter'
177
+ karpenter.spec.forProvider.chart.version = '1.8.6'
178
+ karpenter.spec.forProvider.namespace = 'karpenter'
179
+ karpenter.externalName = 'karpenter'
180
+ ```
181
+
153
182
  ## Usage Dependencies
154
183
 
155
184
  function-pythonic can be configured to automatically create
156
185
  [Crossplane Usages](https://docs.crossplane.io/latest/managed-resources/usages/)
157
186
  dependencies between resources. Modifying the above VPC example with:
158
- ```yaml
187
+ ```python
159
188
  self.usages = True
160
189
 
161
- vpc = self.resources.VPC('ec2.aws.crossplane.io/v1beta1', 'VPC')
190
+ vpc = self.resources.VPC('VPC', 'ec2.aws.crossplane.io/v1beta1')
162
191
  vpc.spec.forProvider.region = 'us-east-1
163
192
  vpc.spec.forProvider.cidrBlock = '10.0.0.0/16'
164
193
 
165
- subnet = self.resources.SubnetA('ec2.aws.crossplane.io/v1beta1', 'Subnet')
194
+ subnet = self.resources.SubnetA('Subnet', 'ec2.aws.crossplane.io/v1beta1')
166
195
  subnet.spec.forProvider.region = 'us-east-1'
167
196
  subnet.spec.forProvider.vpcId = vpc.status.atProvider.vpcId
168
197
  subnet.spec.forProvider.availabilityZone = 'us-east-1a'
@@ -203,7 +232,7 @@ Calling a message or map will clear it and will set any provided key word
203
232
  arguments. For example, this will either create or clear the resource
204
233
  and then set its apiVersion and kind:
205
234
  ```python
206
- response.desired.resources.vpc.resource(apiVersion='ec2.aws.crossplane.io/v1beta1', kind='VPC')
235
+ response.desired.resources.vpc.resource(kind='VPC', apiVersion='ec2.aws.crossplane.io/v1beta1')
207
236
  ```
208
237
  The following functions are provided to create Protobuf structures:
209
238
  | Function | Description |
@@ -260,8 +289,8 @@ The BaseComposite class provides the following fields for manipulating the Compo
260
289
  | self.conditions | Conditions | The composite desired and observed conditions, read from observed if not in desired |
261
290
  | self.results | Results | Returned results applied to the Composite and optionally on the Claim |
262
291
  | self.connectionSecret | Map | The name, namespace, and resourceName to use when generating the connection secret in Crossplane v2 |
263
- | self.connection | Map | The composite desired connection detials |
264
- | self.connection.observed | Map | The composite observed connection detials |
292
+ | self.connection | Map | The composite desired connection details |
293
+ | self.connection.observed | Map | The composite observed connection details |
265
294
  | self.ready | Boolean | The composite desired ready state |
266
295
 
267
296
  The BaseComposite also provides access to the following Crossplane Function level features:
@@ -278,9 +307,9 @@ The BaseComposite also provides access to the following Crossplane Function leve
278
307
  | self.environment | Map | The response environment, initialized from the request context environment |
279
308
  | self.requireds | Requireds | Request and read additional local Kubernetes resources |
280
309
  | self.resources | Resources | Define and process composed resources |
281
- | self.unknownsFatal | Boolean | Terminate the composition if already created resources are assigned unknown values, default True |
282
310
  | self.usages| Boolean | Generate Crossplane Usages for resource dependencies, default False |
283
311
  | self.autoReady | Boolean | Perform auto ready processing on all composed resources, default True |
312
+ | self.unknownsFatal | Boolean | Terminate the composition if already created resources are assigned unknown values, default False |
284
313
 
285
314
  ### Composed Resources
286
315
 
@@ -305,9 +334,11 @@ Resource class:
305
334
  | Resource.conditions | Conditions | The resource conditions |
306
335
  | Resource.connection | Map | The resource observed connection details |
307
336
  | Resource.ready | Boolean | The resource ready state |
308
- | Resource.unknownsFatal | Boolean | Terminate the composition if this resource has been created and is assigned unknown values, default is Composite.unknownsFatal |
337
+ | Resource.addDependency | Method | Add another composed resource as a dependency |
338
+ | Resource.setReadyCondition | Method | Set Resource.ready to the Ready Condition status |
309
339
  | Resource.usages | Boolean | Generate Crossplane Usages for this resource, default is Composite.autoReady |
310
340
  | Resource.autoReady | Boolean | Perform auto ready processing on this resource, default is Composite.autoReady |
341
+ | Resource.unknownsFatal | Boolean | Terminate the composition if this resource has been created and is assigned unknown values, default is Composite.unknownsFatal |
311
342
 
312
343
  ### Required Resources
313
344
 
@@ -406,28 +437,34 @@ $ pip install crossplane-function-pythonic
406
437
  Then to render function-pythonic Compositions, use the `function-pythonic render ...`
407
438
  command.
408
439
  ```shell
409
- $ function-pythonic render -h
410
- usage: Crossplane Function Pythonic render [-h] [--debug] [--log-name-width WIDTH] [--python-path DIRECTORY] [--render-unknowns]
411
- [--allow-oversize-protos] [--context-files KEY=PATH] [--context-values KEY=VALUE]
412
- [--observed-resources PATH] [--required-resources PATH] [--secret-store PATH] [--include-full-xr]
413
- [--include-connection-xr] [--include-function-results] [--include-context]
414
- PATH [PATH/CLASS]
440
+ $ function-pythonic render --help
441
+ usage: Crossplane Function Pythonic render [-h] [--debug] [--log-name-width WIDTH] [--logger-level LOGGER=LEVEL] [--python-path DIRECTORY]
442
+ [--render-unknowns] [--allow-oversize-protos] [--crossplane-v1] [--kube-context CONTEXT]
443
+ [--context-files KEY=PATH] [--context-values KEY=VALUE] [--observed-resources PATH]
444
+ [--required-resources PATH] [--secret-store PATH] [--include-full-xr] [--include-connection-xr]
445
+ [--include-function-results] [--include-context]
446
+ COMPOSITE [COMPOSITION]
415
447
 
416
448
  positional arguments:
417
- PATH A YAML file containing the Composite resource to render.
418
- PATH/CLASS A YAML file containing the Composition resource or the complete path of a function=-pythonic BaseComposite subclass.
449
+ COMPOSITE A YAML file containing the Composite resource to render, or kind:apiVersion:namespace:name of cluster Composite.
450
+ COMPOSITION A YAML file containing the Composition resource, or the complete path of a function-pythonic BaseComposite subclass.
419
451
 
420
452
  options:
421
453
  -h, --help show this help message and exit
422
454
  --debug, -d Emit debug logs.
423
455
  --log-name-width WIDTH
424
456
  Width of the logger name in the log output, default 40.
457
+ --logger-level LOGGER=LEVEL
458
+ Logger level, for example: botocore.hooks=INFO
425
459
  --python-path DIRECTORY
426
460
  Filing system directories to add to the python path.
427
461
  --render-unknowns, -u
428
462
  Render resources with unknowns, useful during local development.
429
463
  --allow-oversize-protos
430
464
  Allow oversized protobuf messages
465
+ --crossplane-v1 Enable Crossplane V1 compatibility mode
466
+ --kube-context, -k CONTEXT
467
+ The kubectl context to use to obtain external resources from, such as required resources, connections, etc.
431
468
  --context-files KEY=PATH
432
469
  Context key-value pairs to pass to the Function pipeline. Values must be files containing YAML/JSON.
433
470
  --context-values KEY=VALUE
@@ -443,7 +480,7 @@ options:
443
480
  --include-connection-xr
444
481
  Include the Composite connection values in the rendered output as a resource of kind: Connection.
445
482
  --include-function-results, -r
446
- Include informational and warning messages from Functions in the rendered output as resources of kind: Result..
483
+ Include informational and warning messages from Functions in the rendered output as resources of kind: Result.
447
484
  --include-context, -c
448
485
  Include the context in the rendered output as a resource of kind: Context.
449
486
  ```
@@ -579,7 +616,7 @@ kind: Function
579
616
  metadata:
580
617
  name: function-pythonic
581
618
  spec:
582
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.3.0
619
+ package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.4.0
583
620
  runtimeConfigRef:
584
621
  name: function-pythonic
585
622
  ---
@@ -663,7 +700,7 @@ data:
663
700
  from crossplane.pythonic import BaseComposite
664
701
  class GreetingComposite(BaseComposite):
665
702
  def compose(self):
666
- cm = self.resources.ConfigMap('v1', 'ConfigMap')
703
+ cm = self.resources.ConfigMap('ConfigMap', 'v1')
667
704
  cm.data.greeting = f"Hello, {self.parameters.who}!"
668
705
  ```
669
706
  ```yaml
@@ -0,0 +1,18 @@
1
+ crossplane/pythonic/__about__.py,sha256=lDX3x8k47nyHPBKNc91376Yj6P16n0uGqBZGVhqsHLY,73
2
+ crossplane/pythonic/__init__.py,sha256=A9U4-azc4DjSsOnOnjQxCkoTzsZMRBb_AvqzR_Bd95A,268
3
+ crossplane/pythonic/__main__.py,sha256=6vYRlYDJtqFgLyiTamnl3htiNOtz8QlDl5WlIP98I8o,31
4
+ crossplane/pythonic/auto_ready.py,sha256=sPetUuJRhwZbg9muaDmbdqmtTIIUDmY4qoadoJA0EtQ,7201
5
+ crossplane/pythonic/command.py,sha256=KZxklRR3Z5iiAPxqUbQgaPgoXOIN5T8bcRev4ZUmrrY,3830
6
+ crossplane/pythonic/composite.py,sha256=ERwcyAkbX2AJi3cB1muyXH0zMrDreZcJBGEqmmsweIE,30408
7
+ crossplane/pythonic/function.py,sha256=BSQmgjGmKM9-2ryu1gLApV0Xf3_VwjmbuAQtjIK-gB0,17961
8
+ crossplane/pythonic/grpc.py,sha256=8hQZZsNrcbiCGfEdPWRrG9SYfTrmuPgMmAIHwWhCdt8,4468
9
+ crossplane/pythonic/main.py,sha256=ujUa_FYElQSGqnhZ-0NJrD3kSyYjfRbIp79FV2Yl7hs,599
10
+ crossplane/pythonic/packages.py,sha256=4TxyT6V79R0m4tJbC8R1gwU_vgHGLXKSBzeTTKd8xGo,5120
11
+ crossplane/pythonic/protobuf.py,sha256=qL3RMsOsuyUaRMHKYOlZEE_5E8BM9wl8K574-cR0agg,52271
12
+ crossplane/pythonic/render.py,sha256=K8pbiFrw76zsJVkwN3lgHcA9P8Mfsmj3jih2LlUinrc,29824
13
+ crossplane/pythonic/version.py,sha256=-RiB0p146ayqJj0SXfYxTNv49u9Fx9pPgm59Ji2blhc,214
14
+ crossplane_function_pythonic-0.4.0.dist-info/METADATA,sha256=I64Dq_5k4brXlGjOtjkswzuNeSlxP2H5Xx_1yn729WE,31501
15
+ crossplane_function_pythonic-0.4.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
16
+ crossplane_function_pythonic-0.4.0.dist-info/entry_points.txt,sha256=jJ4baywFDviB9WyAhyhNYF2VOCb6XtbRSjKf7bnBwhg,68
17
+ crossplane_function_pythonic-0.4.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
18
+ crossplane_function_pythonic-0.4.0.dist-info/RECORD,,
@@ -1,18 +0,0 @@
1
- crossplane/pythonic/__about__.py,sha256=aySM7NSterQ9iNm2zapljwvbJuWDyviv3Ku2kts5ThU,73
2
- crossplane/pythonic/__init__.py,sha256=A9U4-azc4DjSsOnOnjQxCkoTzsZMRBb_AvqzR_Bd95A,268
3
- crossplane/pythonic/__main__.py,sha256=6vYRlYDJtqFgLyiTamnl3htiNOtz8QlDl5WlIP98I8o,31
4
- crossplane/pythonic/auto_ready.py,sha256=FrbIePmj96Jl51fjVt1ctj26jTksimRCXGsNTFaMh9A,5026
5
- crossplane/pythonic/command.py,sha256=QC1Z4j5-MyfH41V7Zc9tJgaTZ7IVR0h8xL4bbXOE9Fg,3309
6
- crossplane/pythonic/composite.py,sha256=WiDV5OCJ8-BDQ_4i-3FYvflpGxLoCLde-fRjDF0ib9w,29377
7
- crossplane/pythonic/function.py,sha256=KYOFzCGp59trKGl5M5JxjnOWWEPDL3hmoXYXC6kGljw,17433
8
- crossplane/pythonic/grpc.py,sha256=8hQZZsNrcbiCGfEdPWRrG9SYfTrmuPgMmAIHwWhCdt8,4468
9
- crossplane/pythonic/main.py,sha256=ujUa_FYElQSGqnhZ-0NJrD3kSyYjfRbIp79FV2Yl7hs,599
10
- crossplane/pythonic/packages.py,sha256=4TxyT6V79R0m4tJbC8R1gwU_vgHGLXKSBzeTTKd8xGo,5120
11
- crossplane/pythonic/protobuf.py,sha256=Dc4gYWPusQYGIR0k0xawkHCV0a-sqX2y7eAAc7whqME,51304
12
- crossplane/pythonic/render.py,sha256=h9S59R_cM1eerOuDL2h6fQ79f-cmaA9OYs8CE2AGj7E,22263
13
- crossplane/pythonic/version.py,sha256=-RiB0p146ayqJj0SXfYxTNv49u9Fx9pPgm59Ji2blhc,214
14
- crossplane_function_pythonic-0.3.0.dist-info/METADATA,sha256=Un9AsXhViJ_1YOx3wxXe1d6BDNzZgcf6_VczndW6OXg,29502
15
- crossplane_function_pythonic-0.3.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
16
- crossplane_function_pythonic-0.3.0.dist-info/entry_points.txt,sha256=jJ4baywFDviB9WyAhyhNYF2VOCb6XtbRSjKf7bnBwhg,68
17
- crossplane_function_pythonic-0.3.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
18
- crossplane_function_pythonic-0.3.0.dist-info/RECORD,,