toml-combine 0.6.0__py3-none-any.whl → 1.0.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.
toml_combine/combiner.py CHANGED
@@ -97,7 +97,7 @@ def are_conditions_compatible(
97
97
  ) -> bool:
98
98
  """
99
99
  `a` and `b` are dictionaries representing override conditions (`when`). Return
100
- `True` if the conditions represented by `a` are compatible. Conditions are
100
+ `True` if the conditions represented by `a` are compatible with `b`. Conditions are
101
101
  compatible if one is stricly more specific than the other or if they're mutually
102
102
  exclusive.
103
103
  """
@@ -166,7 +166,7 @@ def generate_for_mapping(
166
166
  mapping: Mapping[str, str],
167
167
  ) -> Mapping[str, Any]:
168
168
  result = copy.deepcopy(config.default)
169
- keys_to_conditions: dict[tuple[str, ...], list[dict[str, list[str]]]] = {}
169
+ keys_to_conditions: dict[tuple[str, ...], list[Mapping[str, list[str]]]] = {}
170
170
  # Apply each matching override
171
171
  for override in config.overrides:
172
172
  # Check if all dimension values in the override match
@@ -180,7 +180,7 @@ def generate_for_mapping(
180
180
 
181
181
  for previous_condition in previous_conditions:
182
182
  if not are_conditions_compatible(previous_condition, override.when):
183
- raise exceptions.DuplicateError(
183
+ raise exceptions.IncompatibleOverrides(
184
184
  id=override.when,
185
185
  key=".".join(key),
186
186
  other_override=previous_condition,
@@ -19,7 +19,7 @@ class TomlEncodeError(TomlCombineError):
19
19
  """Error while encoding configuration file."""
20
20
 
21
21
 
22
- class DuplicateError(TomlCombineError):
22
+ class IncompatibleOverrides(TomlCombineError):
23
23
  """In override {id}: Overrides defining the same configuration keys must be included in one another or mutually exclusive.\nKey defined multiple times: {key}\nOther override: {other_override}"""
24
24
 
25
25
 
@@ -1,9 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: toml-combine
3
- Version: 0.6.0
3
+ Version: 1.0.0
4
4
  Summary: A tool for combining complex configurations in TOML format.
5
5
  Author-email: Joachim Jablon <ewjoachim@gmail.com>
6
6
  License-Expression: MIT
7
+ License-File: LICENSE
7
8
  Classifier: Development Status :: 4 - Beta
8
9
  Classifier: Intended Audience :: Developers
9
10
  Classifier: License :: OSI Approved :: MIT License
@@ -19,6 +20,12 @@ Description-Content-Type: text/markdown
19
20
 
20
21
  # Toml-combine
21
22
 
23
+ [![Deployed to PyPI](https://img.shields.io/pypi/v/toml-combine?logo=pypi&logoColor=white)](https://pypi.org/pypi/toml-combine)
24
+ [![Deployed to PyPI](https://img.shields.io/pypi/pyversions/toml-combine?logo=pypi&logoColor=white)](https://pypi.org/pypi/toml-combine)
25
+ [![GitHub Repository](https://img.shields.io/github/stars/ewjoachim/toml-combine?style=flat&logo=github&color=brightgreen)](https://github.com/ewjoachim/toml-combine/)
26
+ [![Continuous Integration](https://img.shields.io/github/actions/workflow/status/ewjoachim/toml-combine/ci.yml?logo=github&branch=main)](https://github.com/ewjoachim/toml-combine/actions?workflow=CI)
27
+ [![MIT License](https://img.shields.io/github/license/ewjoachim/toml-combine?logo=open-source-initiative&logoColor=white)](https://github.com/ewjoachim/toml-combine/blob/main/LICENSE)
28
+
22
29
  `toml-combine` is a Python lib and CLI-tool that reads a TOML configuration file
23
30
  defining a default configuration alongside with overrides, and merges everything
24
31
  following rules you define to get final configurations. Let's say: you have multiple
@@ -62,7 +69,7 @@ The common configuration to start from, before we start overlaying overrides on
62
69
  ### Overrides
63
70
 
64
71
  Overrides define a set of condition where they apply (`when.<dimension> =
65
- "<value>"`) and the values that are overridden when they're applicable.
72
+ "<value>"`) and the values that are overridgden when they're applicable.
66
73
 
67
74
  - In case 2 overrides are applicable and define a value for the same key, if one is more
68
75
  specific than the other (e.g. env=prod,region=us is more specific than env=prod) then
@@ -0,0 +1,12 @@
1
+ toml_combine/__init__.py,sha256=TDkOwwEM-nS6hOh79u9Qae6g2Q6VfANpPpnKGfSgu80,84
2
+ toml_combine/__main__.py,sha256=hmF8N8xX6UEApzbKTVZ-4E1HU5-rjgUkdXNLO-mF6vo,100
3
+ toml_combine/cli.py,sha256=hG03eDKz7xU-ydJIa1kDuu6WlFzNS3GTMJ6zals9M9c,2843
4
+ toml_combine/combiner.py,sha256=HG7KV3EGwmcHOMruhp7sMkH-uXqWKpsO7_BvhNQ2KQY,5668
5
+ toml_combine/exceptions.py,sha256=cRAZhxg3OHgzp5hJzyxNGG_jvGUm8gG8XzndQXBhvo8,1116
6
+ toml_combine/lib.py,sha256=jh6OG57JefpGa-WE-mLSIK6KjyJ0-1yGBynr_kiVTww,1634
7
+ toml_combine/toml.py,sha256=iBV8xj0qWcvGp2AZaML8FCT3i2X9DL7iA6jd-wcP5Bc,814
8
+ toml_combine-1.0.0.dist-info/METADATA,sha256=JxCXUhIW1v3MyM1ut0ZXbE6B6IuiXj4bf0YpwvlxGCw,8466
9
+ toml_combine-1.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
+ toml_combine-1.0.0.dist-info/entry_points.txt,sha256=dXUQNom54uZt_7ylEG81iNYMamYpaFo9-ItcZJU6Uzc,58
11
+ toml_combine-1.0.0.dist-info/licenses/LICENSE,sha256=tA7wpipzIPGl7xL5xzMMg0RhhXz9CKOa-ZnlYzgiTKg,1059
12
+ toml_combine-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2025- Joachim Jablon
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,11 +0,0 @@
1
- toml_combine/__init__.py,sha256=TDkOwwEM-nS6hOh79u9Qae6g2Q6VfANpPpnKGfSgu80,84
2
- toml_combine/__main__.py,sha256=hmF8N8xX6UEApzbKTVZ-4E1HU5-rjgUkdXNLO-mF6vo,100
3
- toml_combine/cli.py,sha256=hG03eDKz7xU-ydJIa1kDuu6WlFzNS3GTMJ6zals9M9c,2843
4
- toml_combine/combiner.py,sha256=nwq3q06UhXZkM2Nch_gEnn7K8WUlKbbYxFk1myH63CE,5649
5
- toml_combine/exceptions.py,sha256=2b-EkmSoe6bbuE7txDVjEDuix_9bfLQrapkNhy8i-lU,1109
6
- toml_combine/lib.py,sha256=jh6OG57JefpGa-WE-mLSIK6KjyJ0-1yGBynr_kiVTww,1634
7
- toml_combine/toml.py,sha256=iBV8xj0qWcvGp2AZaML8FCT3i2X9DL7iA6jd-wcP5Bc,814
8
- toml_combine-0.6.0.dist-info/METADATA,sha256=1TbVtui8W4B4zumo-rCpPnnuxx83GD5Xkyk-rRqCE5E,7625
9
- toml_combine-0.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
- toml_combine-0.6.0.dist-info/entry_points.txt,sha256=dXUQNom54uZt_7ylEG81iNYMamYpaFo9-ItcZJU6Uzc,58
11
- toml_combine-0.6.0.dist-info/RECORD,,