foxops 2.5.1__tar.gz → 2.6.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 (57) hide show
  1. {foxops-2.5.1 → foxops-2.6.0}/PKG-INFO +11 -8
  2. {foxops-2.5.1 → foxops-2.6.0}/pyproject.toml +14 -12
  3. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/engine/__main__.py +19 -1
  4. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/engine/models/template_config.py +45 -2
  5. {foxops-2.5.1 → foxops-2.6.0}/LICENSE +0 -0
  6. {foxops-2.5.1 → foxops-2.6.0}/README.md +0 -0
  7. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/__init__.py +0 -0
  8. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/__main__.py +0 -0
  9. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/database/__init__.py +0 -0
  10. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/database/engine.py +0 -0
  11. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/database/repositories/__init__.py +0 -0
  12. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/database/repositories/change/__init__.py +0 -0
  13. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/database/repositories/change/errors.py +0 -0
  14. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/database/repositories/change/model.py +0 -0
  15. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/database/repositories/change/repository.py +0 -0
  16. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/database/repositories/incarnation/__init__.py +0 -0
  17. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/database/repositories/incarnation/errors.py +0 -0
  18. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/database/repositories/incarnation/model.py +0 -0
  19. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/database/repositories/incarnation/repository.py +0 -0
  20. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/database/schema.py +0 -0
  21. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/dependencies.py +0 -0
  22. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/engine/__init__.py +0 -0
  23. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/engine/custom_filters.py +0 -0
  24. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/engine/errors.py +0 -0
  25. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/engine/initialization.py +0 -0
  26. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/engine/models/__init__.py +0 -0
  27. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/engine/models/incarnation_state.py +0 -0
  28. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/engine/patching/__init__.py +0 -0
  29. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/engine/patching/git_diff_patch.py +0 -0
  30. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/engine/rendering.py +0 -0
  31. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/engine/update.py +0 -0
  32. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/error_handlers.py +0 -0
  33. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/errors.py +0 -0
  34. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/external/__init__.py +0 -0
  35. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/external/git.py +0 -0
  36. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/hosters/__init__.py +0 -0
  37. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/hosters/gitlab.py +0 -0
  38. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/hosters/local.py +0 -0
  39. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/hosters/types.py +0 -0
  40. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/logger.py +0 -0
  41. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/middlewares.py +0 -0
  42. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/models/__init__.py +0 -0
  43. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/models/change.py +0 -0
  44. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/models/errors.py +0 -0
  45. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/models/incarnation.py +0 -0
  46. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/openapi.py +0 -0
  47. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/routers/__init__.py +0 -0
  48. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/routers/auth.py +0 -0
  49. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/routers/changes.py +0 -0
  50. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/routers/incarnations.py +0 -0
  51. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/routers/not_found.py +0 -0
  52. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/routers/version.py +0 -0
  53. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/services/__init__.py +0 -0
  54. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/services/change.py +0 -0
  55. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/services/incarnation.py +0 -0
  56. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/settings.py +0 -0
  57. {foxops-2.5.1 → foxops-2.6.0}/src/foxops/utils.py +0 -0
@@ -1,8 +1,9 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: foxops
3
- Version: 2.5.1
3
+ Version: 2.6.0
4
4
  Summary: Foxops 🦊
5
5
  License: Apache-2.0
6
+ License-File: LICENSE
6
7
  Author: Alexander Hungenberg
7
8
  Author-email: alexander.hungenberg@roche.com
8
9
  Requires-Python: >=3.12,<3.13
@@ -15,16 +16,18 @@ Requires-Dist: aiopath (>=0.7.7,<0.8.0)
15
16
  Requires-Dist: aiosqlite (>=0.20.0,<0.21.0)
16
17
  Requires-Dist: alembic[tz] (>=1.8.1,<2.0.0)
17
18
  Requires-Dist: asyncpg (>=0.29.0,<0.30.0)
18
- Requires-Dist: fastapi (>=0.115.0)
19
+ Requires-Dist: fastapi (>=0.120.1)
19
20
  Requires-Dist: greenlet (>=3.1.1,<4.0.0)
20
21
  Requires-Dist: httpx (>=0.27.2,<0.28.0)
21
- Requires-Dist: pydantic (>=2.3.0,<3.0.0)
22
- Requires-Dist: pydantic-settings (>=2.0.3,<3.0.0)
22
+ Requires-Dist: pydantic (>=2.11.7,<3.0.0)
23
+ Requires-Dist: pydantic-settings (==2.10.1)
24
+ Requires-Dist: rich (>=14.1.0,<15.0.0)
23
25
  Requires-Dist: ruamel.yaml (>=0.17.20,<0.18.0)
24
- Requires-Dist: structlog (>=24.4.0,<25.0.0)
26
+ Requires-Dist: starlette (==0.49.3)
27
+ Requires-Dist: structlog (==25.5.0)
25
28
  Requires-Dist: tenacity (>=9.0.0,<10.0.0)
26
- Requires-Dist: typer (>=0.12.5,<0.13.0)
27
- Requires-Dist: uvicorn (>=0.31.0,<0.32.0)
29
+ Requires-Dist: typer (==0.16.0)
30
+ Requires-Dist: uvicorn (==0.38.0)
28
31
  Description-Content-Type: text/markdown
29
32
 
30
33
  # foxops 🦊
@@ -1,7 +1,7 @@
1
1
  [tool.poetry]
2
2
  name = "foxops"
3
3
  # managed by poetry-dynamic-versioning, do not change.
4
- version = "2.5.1"
4
+ version = "2.6.0"
5
5
  description = "Foxops 🦊"
6
6
  license = "Apache-2.0"
7
7
  authors = [
@@ -17,14 +17,15 @@ fengine = 'foxops.engine.__main__:app'
17
17
  python = ">=3.12,<3.13"
18
18
 
19
19
  # Web Framework
20
- uvicorn = "^0.31.0"
21
- fastapi = ">=0.115.0"
20
+ uvicorn = "0.38.0"
21
+ fastapi = ">=0.120.1"
22
+ starlette = "0.49.3"
22
23
 
23
24
  # Auxiliary
24
25
  httpx = "^0.27.2"
25
26
  tenacity = "^9.0.0"
26
- pydantic = "^2.3.0"
27
- structlog = "^24.4.0"
27
+ pydantic = "^2.11.7"
28
+ structlog = "25.5.0"
28
29
  aiopath = "^0.7.7"
29
30
 
30
31
  # Database
@@ -35,27 +36,28 @@ alembic = {extras = ["tz"], version = "^1.8.1"}
35
36
  greenlet = "^3.1.1"
36
37
 
37
38
  # CLI
38
- typer = "^0.12.5"
39
+ typer = "0.16.0"
39
40
 
40
41
  # Business
41
42
  "ruamel.yaml" = "^0.17.20"
42
43
  Jinja2 = "^3.0.3"
43
- pydantic-settings = "^2.0.3"
44
+ pydantic-settings = "2.10.1"
45
+ rich = "^14.1.0"
44
46
 
45
47
  [tool.poetry.dev-dependencies]
46
48
  # Linting
47
49
  flake8 = "^6.0.0"
48
50
  flake8-bugbear = "^23.5.9"
49
- isort = "^5.9.3"
51
+ isort = "5.13.2"
50
52
 
51
53
  # Testing
52
- pytest = "^7.1.3"
53
- pytest-asyncio = "^0.21.0"
54
- pytest-mock = "^3.10.0"
54
+ pytest = "8.4.1"
55
+ pytest-asyncio = "1.1.0"
56
+ pytest-mock = "3.14.1"
55
57
  pytest-randomly = "^3.12.0"
56
58
 
57
59
  # Typing
58
- mypy = "^1.5.1"
60
+ mypy = "1.17.0"
59
61
  SQLAlchemy = {extras = ["mypy"], version = "^2.0.2"}
60
62
 
61
63
  # Docs
@@ -1,6 +1,7 @@
1
1
  import asyncio
2
2
  import copy
3
3
  import logging
4
+ import re
4
5
  from pathlib import Path
5
6
  from subprocess import PIPE, check_output
6
7
  from typing import Annotated, Any, Optional
@@ -67,11 +68,28 @@ def parse_template_data_arguments(raw_template_data: list[str]) -> TemplateData:
67
68
  # descend into the correct sub-dict of the template data object
68
69
  current_level = template_data
69
70
  for key_element in key_elements[:-1]:
70
- current_level = current_level.setdefault(key_element, {})
71
+ if match := re.match(r"(.+)\[(\d+)\]$", key_element):
72
+ list_key = match.group(1)
73
+ index = int(match.group(2))
74
+
75
+ current_level = current_level.setdefault(list_key, [])
76
+ while len(current_level) <= index:
77
+ current_level.append({})
78
+ current_level = current_level[index]
79
+ else:
80
+ current_level = current_level.setdefault(key_element, {})
71
81
 
72
82
  # now we can inject the value to the "current level"
73
83
  if key_elements[-1].endswith("[]"): # in case we need to append to a list
74
84
  current_level.setdefault(key_elements[-1][:-2], []).append(value)
85
+ elif match := re.match(r"(.+)\[(\d+)\]$", key_elements[-1]):
86
+ list_key = match.group(1)
87
+ index = int(match.group(2))
88
+
89
+ current_level = current_level.setdefault(list_key, [])
90
+ while len(current_level) <= index:
91
+ current_level.append(None)
92
+ current_level[index] = value
75
93
  else: # or we just want to add a "flat" value
76
94
  current_level[key_elements[-1]] = value
77
95
 
@@ -13,6 +13,7 @@ from pydantic import (
13
13
  BaseModel,
14
14
  BeforeValidator,
15
15
  Field,
16
+ TypeAdapter,
16
17
  ValidationError,
17
18
  create_model,
18
19
  )
@@ -90,15 +91,33 @@ class StringListVariableDefinition(BaseListVariableDefinition):
90
91
  return list[str]
91
92
 
92
93
 
94
+ ListVariableDefinition = Annotated[
95
+ Union[
96
+ StringListVariableDefinition,
97
+ "ObjectListVariableDefinition",
98
+ ],
99
+ Field(discriminator="element_type"),
100
+ ]
101
+
102
+
103
+ def validate_variable_type(v: Any) -> Any:
104
+ if isinstance(v, dict):
105
+ t = v.get("type")
106
+ allowed_types = {"string", "str", "integer", "int", "boolean", "bool", "list", "object"}
107
+ if t not in allowed_types:
108
+ raise ValueError(f"Invalid variable type: '{t}'. Allowed types are: {', '.join(sorted(allowed_types))}")
109
+ return v
110
+
111
+
93
112
  VariableDefinition = Annotated[
94
113
  Union[
95
114
  StringVariableDefinition,
96
115
  IntegerVariableDefinition,
97
116
  BooleanVariableDefinition,
98
- StringListVariableDefinition,
117
+ ListVariableDefinition,
99
118
  "ObjectVariableDefinition",
100
119
  ],
101
- Field(..., discriminator="type"),
120
+ BeforeValidator(validate_variable_type),
102
121
  ]
103
122
 
104
123
 
@@ -117,6 +136,30 @@ def valid_variable_names(v: dict[str, Any]) -> dict[str, Any]:
117
136
  VariableDefinitions = Annotated[dict[str, VariableDefinition], AfterValidator(valid_variable_names)]
118
137
 
119
138
 
139
+ class ObjectListVariableDefinition(BaseListVariableDefinition):
140
+ element_type: Literal["object"] = "object"
141
+ children: VariableDefinitions
142
+ default: list[dict[str, Any]] | None = None
143
+
144
+ def pydantic_field_default(self) -> Any:
145
+ if self.default is None:
146
+ return ...
147
+
148
+ return TypeAdapter(self.pydantic_field_model()).validate_python(self.default)
149
+
150
+ def pydantic_field_model(self) -> Any:
151
+ fields: dict[str, Any] = {
152
+ name: (child.pydantic_field_model(), child.pydantic_field_default())
153
+ for name, child in self.children.items()
154
+ }
155
+ object_model = create_model("ObjectVariable", **fields)
156
+
157
+ # `create_model` function returns a class dynamically at runtime
158
+ # this dynamic behavior is intentional
159
+ # mypy doesn't recognize the dynamic model as a valid type for generics
160
+ return list[object_model] # type: ignore[valid-type]
161
+
162
+
120
163
  class ObjectVariableDefinition(BaseVariableDefinition):
121
164
  type: Literal["object"] = "object"
122
165
  children: VariableDefinitions
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