kpops 3.2.1__tar.gz → 3.2.2__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 (70) hide show
  1. {kpops-3.2.1 → kpops-3.2.2}/PKG-INFO +1 -1
  2. {kpops-3.2.1 → kpops-3.2.2}/kpops/__init__.py +1 -1
  3. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/base_defaults_component.py +0 -2
  4. {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/yaml.py +35 -9
  5. {kpops-3.2.1 → kpops-3.2.2}/pyproject.toml +1 -1
  6. {kpops-3.2.1 → kpops-3.2.2}/LICENSE +0 -0
  7. {kpops-3.2.1 → kpops-3.2.2}/README.md +0 -0
  8. {kpops-3.2.1 → kpops-3.2.2}/kpops/cli/__init__.py +0 -0
  9. {kpops-3.2.1 → kpops-3.2.2}/kpops/cli/custom_formatter.py +0 -0
  10. {kpops-3.2.1 → kpops-3.2.2}/kpops/cli/exception.py +0 -0
  11. {kpops-3.2.1 → kpops-3.2.2}/kpops/cli/main.py +0 -0
  12. {kpops-3.2.1 → kpops-3.2.2}/kpops/cli/options.py +0 -0
  13. {kpops-3.2.1 → kpops-3.2.2}/kpops/cli/registry.py +0 -0
  14. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/__init__.py +0 -0
  15. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/helm_wrapper/__init__.py +0 -0
  16. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/helm_wrapper/dry_run_handler.py +0 -0
  17. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/helm_wrapper/exception.py +0 -0
  18. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/helm_wrapper/helm.py +0 -0
  19. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/helm_wrapper/helm_diff.py +0 -0
  20. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/helm_wrapper/model.py +0 -0
  21. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/helm_wrapper/utils.py +0 -0
  22. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/kafka_connect/__init__.py +0 -0
  23. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/kafka_connect/connect_wrapper.py +0 -0
  24. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/kafka_connect/exception.py +0 -0
  25. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/kafka_connect/kafka_connect_handler.py +0 -0
  26. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/kafka_connect/model.py +0 -0
  27. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/kafka_connect/timeout.py +0 -0
  28. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/kubernetes/__init__.py +0 -0
  29. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/kubernetes/model.py +0 -0
  30. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/schema_handler/__init__.py +0 -0
  31. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/schema_handler/schema_handler.py +0 -0
  32. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/schema_handler/schema_provider.py +0 -0
  33. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/topic/__init__.py +0 -0
  34. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/topic/exception.py +0 -0
  35. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/topic/handler.py +0 -0
  36. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/topic/model.py +0 -0
  37. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/topic/proxy_wrapper.py +0 -0
  38. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/topic/utils.py +0 -0
  39. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/utils/__init__.py +0 -0
  40. {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/utils/exception.py +0 -0
  41. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/__init__.py +0 -0
  42. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/__init__.py +0 -0
  43. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/helm_app.py +0 -0
  44. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/kafka_app.py +0 -0
  45. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/kafka_connector.py +0 -0
  46. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/kubernetes_app.py +0 -0
  47. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/models/__init__.py +0 -0
  48. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/models/from_section.py +0 -0
  49. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/models/resource.py +0 -0
  50. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/models/to_section.py +0 -0
  51. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/pipeline_component.py +0 -0
  52. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/streams_bootstrap/__init__.py +0 -0
  53. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/streams_bootstrap/app_type.py +0 -0
  54. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/streams_bootstrap/producer/__init__.py +0 -0
  55. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/streams_bootstrap/producer/model.py +0 -0
  56. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/streams_bootstrap/producer/producer_app.py +0 -0
  57. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/streams_bootstrap/streams/__init__.py +0 -0
  58. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/streams_bootstrap/streams/model.py +0 -0
  59. {kpops-3.2.1 → kpops-3.2.2}/kpops/components/streams_bootstrap/streams/streams_app.py +0 -0
  60. {kpops-3.2.1 → kpops-3.2.2}/kpops/config.py +0 -0
  61. {kpops-3.2.1 → kpops-3.2.2}/kpops/pipeline.py +0 -0
  62. {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/__init__.py +0 -0
  63. {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/colorify.py +0 -0
  64. {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/dict_differ.py +0 -0
  65. {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/dict_ops.py +0 -0
  66. {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/docstring.py +0 -0
  67. {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/environment.py +0 -0
  68. {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/gen_schema.py +0 -0
  69. {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/pydantic.py +0 -0
  70. {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kpops
3
- Version: 3.2.1
3
+ Version: 3.2.2
4
4
  Summary: KPOps is a tool to deploy Kafka pipelines to Kubernetes
5
5
  Home-page: https://github.com/bakdata/kpops
6
6
  License: MIT
@@ -1,4 +1,4 @@
1
- __version__ = "3.2.1"
1
+ __version__ = "3.2.2"
2
2
 
3
3
  # export public API functions
4
4
  from kpops.cli.main import clean, deploy, destroy, generate, manifest, reset
@@ -88,8 +88,6 @@ class BaseDefaultsComponent(DescConfigModel, ABC):
88
88
  tmp_self = cls(**values, enrich=False)
89
89
  values = tmp_self.model_dump(mode="json", by_alias=True)
90
90
  values = cls.substitute_in_component(tmp_self.config, **values)
91
- # HACK: why is double substitution necessary for test_substitute_in_component
92
- values = cls.substitute_in_component(tmp_self.config, **values)
93
91
  self.__init__(
94
92
  enrich=False,
95
93
  validate=True,
@@ -1,3 +1,4 @@
1
+ import json
1
2
  from collections.abc import Mapping
2
3
  from pathlib import Path
3
4
  from typing import Any
@@ -44,14 +45,22 @@ def substitute(input: str, substitution: Mapping[str, Any] | None = None) -> str
44
45
  return ImprovedTemplate(input).safe_substitute(**prepare_substitution(substitution))
45
46
 
46
47
 
48
+ def _diff_substituted_str(s1: str, s2: str):
49
+ """Compare 2 strings, raise exception if not equal.
50
+
51
+ :param s1: String to compare
52
+ :param s2: String to compare
53
+ :raises ValueError: An infinite loop condition detected. Check substitution variables.
54
+ """
55
+ if s1 != s2:
56
+ msg = "An infinite loop condition detected. Check substitution variables."
57
+ raise ValueError(msg)
58
+
59
+
47
60
  def substitute_nested(input: str, **kwargs) -> str:
48
61
  """Allow for multiple substitutions to be passed.
49
62
 
50
63
  Will make as many passes as needed to substitute all possible placeholders.
51
- A ceiling is set to avoid infinite loops.
52
-
53
- HINT: If :param input: is a ``Mapping`` that you converted into ``str``,
54
- You can pass it as a string, and as a ``Mapping`` to enable self-reference.
55
64
 
56
65
  :Example:
57
66
 
@@ -63,26 +72,43 @@ def substitute_nested(input: str, **kwargs) -> str:
63
72
  }
64
73
  >>> input = "${a}, ${b}, ${c}, ${d}"
65
74
  >>> print("Substituted string: " + substitute_nested(input, **substitution))
66
- 0, 0, 0, 0
75
+ "0, 0, 0, 0"
67
76
 
68
77
  :param input: The raw input containing $-placeholders
69
78
  :param **kwargs: Substitutions
70
- :raises Exception: An infinite loop condition detected. Check substitution variables.
79
+ :raises ValueError: An infinite loop condition detected. Check substitution variables.
71
80
  :return: Substituted input string
72
81
  """
73
82
  if not kwargs:
74
83
  return input
84
+ kwargs = substitute_in_self(kwargs)
75
85
  old_str, new_str = "", substitute(input, kwargs)
76
86
  steps = set()
77
87
  while new_str not in steps:
78
88
  steps.add(new_str)
79
89
  old_str, new_str = new_str, substitute(new_str, kwargs)
80
- if new_str != old_str:
81
- msg = "An infinite loop condition detected. Check substitution variables."
82
- raise ValueError(msg)
90
+ _diff_substituted_str(new_str, old_str)
83
91
  return old_str
84
92
 
85
93
 
94
+ def substitute_in_self(input: dict[str, Any]) -> dict[str, Any]:
95
+ """Substitute all self-references in mapping.
96
+
97
+ Will make as many passes as needed to substitute all possible placeholders.
98
+
99
+ :param input: Mapping containing $-placeholders
100
+ :raises ValueError: An infinite loop condition detected. Check substitution variables.
101
+ :return: Substituted input mapping as dict
102
+ """
103
+ old_str, new_str = "", substitute(json.dumps(input), input)
104
+ steps = set()
105
+ while new_str not in steps:
106
+ steps.add(new_str)
107
+ old_str, new_str = new_str, substitute(new_str, json.loads(new_str))
108
+ _diff_substituted_str(new_str, old_str)
109
+ return json.loads(old_str)
110
+
111
+
86
112
  def print_yaml(data: Mapping | str, *, substitution: dict | None = None) -> None:
87
113
  """Print YAML object with syntax highlighting.
88
114
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "kpops"
3
- version = "3.2.1"
3
+ version = "3.2.2"
4
4
  description = "KPOps is a tool to deploy Kafka pipelines to Kubernetes"
5
5
  authors = ["bakdata <opensource@bakdata.com>"]
6
6
  license = "MIT"
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
File without changes
File without changes
File without changes