tinyfan 0.1.2__tar.gz → 0.1.3__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 (54) hide show
  1. {tinyfan-0.1.2 → tinyfan-0.1.3}/PKG-INFO +1 -1
  2. {tinyfan-0.1.2 → tinyfan-0.1.3}/pyproject.toml +1 -1
  3. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/codegen.py +12 -4
  4. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/flow.py +4 -0
  5. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/utils/merge.py +10 -0
  6. {tinyfan-0.1.2 → tinyfan-0.1.3}/uv.lock +1 -1
  7. {tinyfan-0.1.2 → tinyfan-0.1.3}/.github/workflows/publish.yml +0 -0
  8. {tinyfan-0.1.2 → tinyfan-0.1.3}/.gitignore +0 -0
  9. {tinyfan-0.1.2 → tinyfan-0.1.3}/.python-version +0 -0
  10. {tinyfan-0.1.2 → tinyfan-0.1.3}/README.md +0 -0
  11. {tinyfan-0.1.2 → tinyfan-0.1.3}/examples/configmap.yaml +0 -0
  12. {tinyfan-0.1.2 → tinyfan-0.1.3}/examples/configs.py +0 -0
  13. {tinyfan-0.1.2 → tinyfan-0.1.3}/examples/getting-started.py +0 -0
  14. {tinyfan-0.1.2 → tinyfan-0.1.3}/examples/packaged/.python-version +0 -0
  15. {tinyfan-0.1.2 → tinyfan-0.1.3}/examples/packaged/Dockerfile +0 -0
  16. {tinyfan-0.1.2 → tinyfan-0.1.3}/examples/packaged/README.md +0 -0
  17. {tinyfan-0.1.2 → tinyfan-0.1.3}/examples/packaged/pyproject.toml +0 -0
  18. {tinyfan-0.1.2 → tinyfan-0.1.3}/examples/packaged/src/tinyfan_examples_packaged/__init__.py +0 -0
  19. {tinyfan-0.1.2 → tinyfan-0.1.3}/examples/packaged/src/tinyfan_examples_packaged/asset.py +0 -0
  20. {tinyfan-0.1.2 → tinyfan-0.1.3}/examples/resource.py +0 -0
  21. {tinyfan-0.1.2 → tinyfan-0.1.3}/examples/secret.yaml +0 -0
  22. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/__init__.py +0 -0
  23. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/argo_typing.py +0 -0
  24. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/cli.py +0 -0
  25. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/config.py +0 -0
  26. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/flowrundata.py +0 -0
  27. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/resources/__init__.py +0 -0
  28. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/resources/base.py +0 -0
  29. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/stores/__init__.py +0 -0
  30. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/stores/base.py +0 -0
  31. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/stores/bigquery.py +0 -0
  32. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/stores/gcs_pickle.py +0 -0
  33. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/stores/naive.py +0 -0
  34. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/utils/__init__.py +0 -0
  35. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/utils/embed.py +0 -0
  36. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/utils/exjson.py +0 -0
  37. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/utils/typing.py +0 -0
  38. {tinyfan-0.1.2 → tinyfan-0.1.3}/src/tinyfan/utils/yaml.py +0 -0
  39. {tinyfan-0.1.2 → tinyfan-0.1.3}/tests/__init__.py +0 -0
  40. {tinyfan-0.1.2 → tinyfan-0.1.3}/tests/codegen_samples/directory/__init__.py +0 -0
  41. {tinyfan-0.1.2 → tinyfan-0.1.3}/tests/codegen_samples/directory/asset.py +0 -0
  42. {tinyfan-0.1.2 → tinyfan-0.1.3}/tests/codegen_samples/directory/asset2.py +0 -0
  43. {tinyfan-0.1.2 → tinyfan-0.1.3}/tests/codegen_samples/singlefile.py +0 -0
  44. {tinyfan-0.1.2 → tinyfan-0.1.3}/tests/conftest.py +0 -0
  45. {tinyfan-0.1.2 → tinyfan-0.1.3}/tests/helpers.py +0 -0
  46. {tinyfan-0.1.2 → tinyfan-0.1.3}/tests/openapi2jsonschema.py +0 -0
  47. {tinyfan-0.1.2 → tinyfan-0.1.3}/tests/test_codegen.py +0 -0
  48. {tinyfan-0.1.2 → tinyfan-0.1.3}/tests/test_decorators.py +0 -0
  49. {tinyfan-0.1.2 → tinyfan-0.1.3}/tests/utils/__init__.py +0 -0
  50. {tinyfan-0.1.2 → tinyfan-0.1.3}/tests/utils/embed_samples/directory/__init__.py +0 -0
  51. {tinyfan-0.1.2 → tinyfan-0.1.3}/tests/utils/embed_samples/directory/dep.py +0 -0
  52. {tinyfan-0.1.2 → tinyfan-0.1.3}/tests/utils/embed_samples/singlefile.py +0 -0
  53. {tinyfan-0.1.2 → tinyfan-0.1.3}/tests/utils/test_embed.py +0 -0
  54. {tinyfan-0.1.2 → tinyfan-0.1.3}/tests/utils/test_exjson.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tinyfan
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Tiny Argo Workflows python devkit
5
5
  Project-URL: Documentation, https://github.com/eunchuldev/tinyfan#readme
6
6
  Project-URL: Issues, https://github.com/eunchuldev/tinyfan/issues
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tinyfan"
3
- version = "0.1.2"
3
+ version = "0.1.3"
4
4
  description = 'Tiny Argo Workflows python devkit'
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -13,7 +13,7 @@ import datetime
13
13
  import croniter
14
14
  from .argo_typing import ScriptTemplate
15
15
  from .utils.embed import embed
16
- from .utils.merge import deepmerge
16
+ from .utils.merge import deepmerge, dropnone
17
17
  from .config import CLI_CONFIG_STATE, Config, ConfigValue, ConfigMapKeyRef, ConfigMapRef, SecretKeyRef, SecretRef
18
18
  from .flowrundata import FlowRunData
19
19
 
@@ -171,6 +171,7 @@ class AssetTree:
171
171
  self,
172
172
  embedded: bool = True,
173
173
  container: ScriptTemplate = {},
174
+ serviceAccountName: str | None = None,
174
175
  ) -> str:
175
176
  if len(self.nodes) == 0:
176
177
  return ""
@@ -227,6 +228,7 @@ class AssetTree:
227
228
  "timezone": tz,
228
229
  "workflowSpec": {
229
230
  "entrypoint": "flow",
231
+ **dropnone({"serviceAccountName": serviceAccountName or self.flow.serviceAccountName}),
230
232
  "podSpecPatch": yaml_dump(
231
233
  {
232
234
  "containers": [
@@ -249,6 +251,7 @@ class AssetTree:
249
251
  "templates": [
250
252
  {
251
253
  "name": node.asset.name.replace("_", "-"),
254
+ **dropnone({"serviceAccountName": node.asset.serviceAccountName}),
252
255
  "script": deepmerge(
253
256
  {
254
257
  "image": DEFAULT_IMAGE,
@@ -391,15 +394,20 @@ def codegen(
391
394
  location: str | None = None,
392
395
  embedded: bool = False,
393
396
  container: ScriptTemplate = {},
397
+ serviceAccountName: str | None = None,
394
398
  ) -> str:
395
399
  """Generate argocd workflow resource as yaml from tinyfan definitions"""
396
400
  CLI_CONFIG_STATE.codegen = True
397
401
  if flow:
398
- result = AssetTree(flow).compile(embedded, container)
402
+ result = AssetTree(flow).compile(embedded, container, serviceAccountName)
399
403
  elif location:
400
404
  import_all_submodules(location)
401
- result = "\n---\n".join(AssetTree(flow).compile(embedded, container) for flow in FLOW_REGISTER.values())
405
+ result = "\n---\n".join(
406
+ AssetTree(flow).compile(embedded, container, serviceAccountName) for flow in FLOW_REGISTER.values()
407
+ )
402
408
  else:
403
- result = "\n---\n".join(AssetTree(flow).compile(embedded, container) for flow in FLOW_REGISTER.values())
409
+ result = "\n---\n".join(
410
+ AssetTree(flow).compile(embedded, container, serviceAccountName) for flow in FLOW_REGISTER.values()
411
+ )
404
412
  CLI_CONFIG_STATE.codegen = False
405
413
  return result
@@ -22,6 +22,7 @@ class Flow:
22
22
  assets: dict[str, "Asset[Any, Any, Any]"] = field(default_factory=dict)
23
23
  resources: dict[str, ResourceBase] | None = None
24
24
  container: ScriptTemplate | None = None
25
+ serviceAccountName: str | None = None
25
26
  store: StoreBase = field(default_factory=NaiveStore)
26
27
  configs: dict[str, Config | ConfigValue | str | None] = field(default_factory=dict)
27
28
 
@@ -48,6 +49,7 @@ class Asset(Generic[Ret, UMeta, StoreIdx]):
48
49
  depends: str | None = None
49
50
  name: str = field(init=False)
50
51
  container: ScriptTemplate | None = None
52
+ serviceAccountName: str | None = None
51
53
 
52
54
  def __post_init__(self):
53
55
  self.name = self.func.__name__
@@ -110,6 +112,7 @@ def asset(
110
112
  tz: str | None = None,
111
113
  metadata: UMeta | None = None,
112
114
  container: ScriptTemplate | None = None,
115
+ serviceAccountName: str | None = None,
113
116
  ) -> Callable[..., AssetFunc[Ret, UMeta, StoreIdx]]:
114
117
  def wrapper(func: Callable[..., Ret]) -> AssetFunc[Ret, UMeta, StoreIdx]:
115
118
  asset = Asset[Ret, UMeta, StoreIdx](
@@ -121,6 +124,7 @@ def asset(
121
124
  tz=tz or flow.tz,
122
125
  metadata=metadata,
123
126
  container=container,
127
+ serviceAccountName=serviceAccountName,
124
128
  )
125
129
  return AssetFunc(func, asset)
126
130
 
@@ -15,3 +15,13 @@ def deepmerge(dict1: T, dict2: T, *args: T) -> T:
15
15
  for arg in args:
16
16
  deepmerge(dict1, arg)
17
17
  return dict1
18
+
19
+
20
+ def dropnone(d: dict) -> dict:
21
+ dropping = []
22
+ for k in d:
23
+ if d[k] is None:
24
+ dropping.append(k)
25
+ for k in dropping:
26
+ del d[k]
27
+ return d
@@ -774,7 +774,7 @@ wheels = [
774
774
 
775
775
  [[package]]
776
776
  name = "tinyfan"
777
- version = "0.1.2"
777
+ version = "0.1.3"
778
778
  source = { editable = "." }
779
779
  dependencies = [
780
780
  { name = "croniter" },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes