tiferet 1.0.0a4__py3-none-any.whl → 1.0.0a5__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.
tiferet/contexts/env.py CHANGED
@@ -89,14 +89,19 @@ class EnvironmentContext(Model):
89
89
  # Get the app interface.
90
90
  app_interface: AppInterface = self.interfaces.get(interface_id)
91
91
 
92
- # Get the dependencies for the app interface.
92
+ # Get the default dependencies for the app interface.
93
93
  dependencies = dict(
94
94
  interface_id=app_interface.id,
95
95
  feature_flag=app_interface.feature_flag,
96
96
  data_flag=app_interface.data_flag,
97
+ app_context=container_service.import_dependency(
98
+ **app_interface.app_context.to_primitive()
99
+ ),
97
100
  **app_interface.constants
98
101
  )
99
- for dep in app_interface.get_dependencies():
102
+
103
+ # Import the dependencies.
104
+ for dep in app_interface.dependencies:
100
105
  dependencies[dep.attribute_id] = container_service.import_dependency(dep.module_path, dep.class_name)
101
106
 
102
107
  # Create the injector from the dependencies, constants, and the app interface.
tiferet/data/app.py CHANGED
@@ -1,5 +1,8 @@
1
1
  # *** imports
2
2
 
3
+ # ** core
4
+ from typing import Dict
5
+
3
6
  # ** app
4
7
  from ..configs import *
5
8
  from ..domain import DataObject
@@ -14,6 +17,13 @@ class AppDependencyYamlData(AppDependency, DataObject):
14
17
  A YAML data representation of an app dependency object.
15
18
  '''
16
19
 
20
+ # * attribute: attribute_id
21
+ attribute_id = StringType(
22
+ metadata=dict(
23
+ description='The attribute id for the application dependency.'
24
+ ),
25
+ )
26
+
17
27
  class Options():
18
28
  '''
19
29
  The options for the app dependency data.
@@ -38,9 +48,8 @@ class AppDependencyYamlData(AppDependency, DataObject):
38
48
 
39
49
  # Create a new AppDependencyData object.
40
50
  return AppDependencyYamlData(
41
- super(AppDependencyYamlData, AppDependencyYamlData).new(
42
- **kwargs
43
- )
51
+ dict(**kwargs),
52
+ strict=False,
44
53
  )
45
54
 
46
55
  # * method: map
@@ -72,7 +81,7 @@ class AppInterfaceYamlData(AppInterface, DataObject):
72
81
  '''
73
82
  serialize_when_none = False
74
83
  roles = {
75
- 'to_model': DataObject.allow(),
84
+ 'to_model': DataObject.deny('app_context', 'container_context', 'feature_context', 'error_context', 'feature_repo', 'container_repo', 'error_repo'),
76
85
  'to_data.yaml': DataObject.deny('id')
77
86
  }
78
87
 
@@ -89,6 +98,11 @@ class AppInterfaceYamlData(AppInterface, DataObject):
89
98
  feature_context = ModelType(
90
99
  AppDependencyYamlData,
91
100
  required=True,
101
+ default=AppDependencyYamlData.new(
102
+ attribute_id='feature_context',
103
+ module_path='tiferet.contexts.feature',
104
+ class_name='FeatureContext',
105
+ ),
92
106
  metadata=dict(
93
107
  description='The feature context dependency.'
94
108
  ),
@@ -98,6 +112,11 @@ class AppInterfaceYamlData(AppInterface, DataObject):
98
112
  container_context = ModelType(
99
113
  AppDependencyYamlData,
100
114
  required=True,
115
+ default=AppDependencyYamlData.new(
116
+ attribute_id='container_context',
117
+ module_path='tiferet.contexts.container',
118
+ class_name='ContainerContext',
119
+ ),
101
120
  metadata=dict(
102
121
  description='The container context dependency.'
103
122
  ),
@@ -107,6 +126,11 @@ class AppInterfaceYamlData(AppInterface, DataObject):
107
126
  error_context = ModelType(
108
127
  AppDependencyYamlData,
109
128
  required=True,
129
+ default=AppDependencyYamlData.new(
130
+ attribute_id='error_context',
131
+ module_path='tiferet.contexts.error',
132
+ class_name='ErrorContext',
133
+ ),
110
134
  metadata=dict(
111
135
  description='The error context dependency.'
112
136
  ),
@@ -116,6 +140,11 @@ class AppInterfaceYamlData(AppInterface, DataObject):
116
140
  feature_repo = ModelType(
117
141
  AppDependencyYamlData,
118
142
  required=True,
143
+ default=AppDependencyYamlData.new(
144
+ attribute_id='feature_repo',
145
+ module_path='tiferet.repos.feature',
146
+ class_name='FeatureRepository',
147
+ ),
119
148
  metadata=dict(
120
149
  description='The feature repository dependency.'
121
150
  ),
@@ -125,6 +154,11 @@ class AppInterfaceYamlData(AppInterface, DataObject):
125
154
  container_repo = ModelType(
126
155
  AppDependencyYamlData,
127
156
  required=True,
157
+ default=AppDependencyYamlData.new(
158
+ attribute_id='container_repo',
159
+ module_path='tiferet.repos.container',
160
+ class_name='ContainerRepository',
161
+ ),
128
162
  metadata=dict(
129
163
  description='The container repository dependency.'
130
164
  ),
@@ -134,6 +168,11 @@ class AppInterfaceYamlData(AppInterface, DataObject):
134
168
  error_repo = ModelType(
135
169
  AppDependencyYamlData,
136
170
  required=True,
171
+ default=AppDependencyYamlData.new(
172
+ attribute_id='error_repo',
173
+ module_path='tiferet.repos.error',
174
+ class_name='ErrorRepository',
175
+ ),
137
176
  metadata=dict(
138
177
  description='The error repository dependency.'
139
178
  ),
@@ -141,7 +180,14 @@ class AppInterfaceYamlData(AppInterface, DataObject):
141
180
 
142
181
  # * method: new
143
182
  @staticmethod
144
- def new(**kwargs) -> 'AppInterfaceYamlData':
183
+ def new(app_context: Dict[str, str],
184
+ container_context: Dict[str, str] = None,
185
+ feature_context: Dict[str, str] = None,
186
+ error_context: Dict[str, str] = None,
187
+ feature_repo: Dict[str, str] = None,
188
+ container_repo: Dict[str, str] = None,
189
+ error_repo: Dict[str, str] = None,
190
+ **kwargs) -> 'AppInterfaceYamlData':
145
191
  '''
146
192
  Initializes a new YAML representation of an AppInterface object.
147
193
 
@@ -151,12 +197,33 @@ class AppInterfaceYamlData(AppInterface, DataObject):
151
197
  :rtype: AppInterfaceData
152
198
  '''
153
199
 
200
+ # Format the dependencies.
201
+ dependencies = {}
202
+ if app_context:
203
+ dependencies['app_context'] = AppDependencyYamlData.new(attribute_id='app_context', **app_context)
204
+ if container_context:
205
+ dependencies['container_context'] = AppDependencyYamlData.new(attribute_id='container_context', **container_context)
206
+ if feature_context:
207
+ dependencies['feature_context'] = AppDependencyYamlData.new(attribute_id='feature_context', **feature_context)
208
+ if error_context:
209
+ dependencies['error_context'] = AppDependencyYamlData.new(attribute_id='error_context', **error_context)
210
+ if feature_repo:
211
+ dependencies['feature_repo'] = AppDependencyYamlData.new(attribute_id='feature_repo', **feature_repo)
212
+ if container_repo:
213
+ dependencies['container_repo'] = AppDependencyYamlData.new(attribute_id='container_repo', **container_repo)
214
+ if error_repo:
215
+ dependencies['error_repo'] = AppDependencyYamlData.new(attribute_id='error_repo', **error_repo)
216
+
154
217
  # Create a new AppInterfaceData object.
155
- return AppInterfaceYamlData(
156
- super(AppInterfaceYamlData, AppInterfaceYamlData).new(
157
- **kwargs
158
- )
218
+ data = AppInterfaceYamlData(dict(
219
+ **dependencies,
220
+ **kwargs),
221
+ strict=False,
159
222
  )
223
+
224
+ # Validate and return the new AppInterfaceData object.
225
+ data.validate()
226
+ return data
160
227
 
161
228
  # * method: map
162
229
  def map(self, **kwargs) -> AppInterface:
@@ -171,8 +238,23 @@ class AppInterfaceYamlData(AppInterface, DataObject):
171
238
  :rtype: AppInterface
172
239
  '''
173
240
 
241
+ # Format and map the dependencies.
242
+ dependencies = [
243
+ self.app_context.map(),
244
+ self.container_context.map(),
245
+ self.feature_context.map(),
246
+ self.error_context.map(),
247
+ self.feature_repo.map(),
248
+ self.container_repo.map(),
249
+ self.error_repo.map(),
250
+ ]
251
+
174
252
  # Map the app interface data.
175
- return super().map(AppInterface, **kwargs)
253
+ return super().map(AppInterface,
254
+ dependencies=dependencies,
255
+ **self.to_primitive('to_model'),
256
+ **kwargs
257
+ )
176
258
 
177
259
 
178
260
  # ** data: app_repository_configuration_yaml_data
tiferet/domain/app.py CHANGED
@@ -31,9 +31,9 @@ class AppDependency(ModuleDependency):
31
31
  '''
32
32
 
33
33
  # Create and return a new AppDependency object.
34
- return AppDependency(
35
- super(AppDependency, AppDependency).new(**kwargs),
36
- strict=False,
34
+ return super(AppDependency, AppDependency).new(
35
+ AppDependency,
36
+ **kwargs,
37
37
  )
38
38
 
39
39
  # ** model: app_interface
@@ -73,96 +73,13 @@ class AppInterface(Entity):
73
73
  ),
74
74
  )
75
75
 
76
- # * attribute: app_context
77
- app_context = ModelType(
78
- AppDependency,
79
- required=True,
80
- metadata=dict(
81
- description='The application context dependency.'
82
- ),
83
- )
84
-
85
- # * attribute: feature_context
86
- feature_context = ModelType(
87
- AppDependency,
88
- required=True,
89
- default=AppDependency.new(
90
- attribute_id='feature_context',
91
- module_path='tiferet.contexts.feature',
92
- class_name='FeatureContext',
93
- ),
94
- metadata=dict(
95
- description='The feature context dependency.'
96
- ),
97
- )
98
-
99
- # * attribute: container_context
100
- container_context = ModelType(
101
- AppDependency,
76
+ # * attribute: dependencies
77
+ dependencies = ListType(
78
+ ModelType(AppDependency),
102
79
  required=True,
103
- default=AppDependency.new(
104
- attribute_id='container_context',
105
- module_path='tiferet.contexts.container',
106
- class_name='ContainerContext',
107
- ),
108
- metadata=dict(
109
- description='The container context dependency.'
110
- ),
111
- )
112
-
113
- # * attribute: error_context
114
- error_context = ModelType(
115
- AppDependency,
116
- required=True,
117
- default=AppDependency.new(
118
- attribute_id='error_context',
119
- module_path='tiferet.contexts.error',
120
- class_name='ErrorContext',
121
- ),
122
- metadata=dict(
123
- description='The error context dependency.'
124
- ),
125
- )
126
-
127
- # * attribute: feature_repo
128
- feature_repo = ModelType(
129
- AppDependency,
130
- required=True,
131
- default=AppDependency.new(
132
- attribute_id='feature_repo',
133
- module_path='tiferet.repos.feature',
134
- class_name='FeatureRepository',
135
- ),
136
- metadata=dict(
137
- description='The feature repository dependency.'
138
- ),
139
- )
140
-
141
- # * attribute: container_repo
142
- container_repo = ModelType(
143
- AppDependency,
144
- required=True,
145
- default=AppDependency.new(
146
- attribute_id='container_repo',
147
- module_path='tiferet.repos.container',
148
- class_name='ContainerRepository',
149
- ),
150
- metadata=dict(
151
- description='The container repository dependency.'
152
- ),
153
- )
154
-
155
- # * attribute: error_repo
156
- error_repo = ModelType(
157
- AppDependency,
158
- required=True,
159
- default=AppDependency.new(
160
- attribute_id='error_repo',
161
- module_path='tiferet.repos.error',
162
- class_name='ErrorRepository',
163
- ),
80
+ default=[],
164
81
  metadata=dict(
165
- description='The error repository dependency.'
82
+ description='The application interface dependencies.'
166
83
  ),
167
84
  )
168
85
 
@@ -197,26 +114,6 @@ class AppInterface(Entity):
197
114
  **kwargs
198
115
  )
199
116
 
200
- # * method: list_dependencies
201
- def get_dependencies(self) -> list:
202
- '''
203
- Lists the dependencies for the application interface.
204
-
205
- :return: The list of dependencies for the application interface.
206
- :rtype: list
207
- '''
208
-
209
- # Return the list of dependencies for the application interface.
210
- return [
211
- self.app_context,
212
- self.feature_context,
213
- self.container_context,
214
- self.error_context,
215
- self.feature_repo,
216
- self.container_repo,
217
- self.error_repo,
218
- ]
219
-
220
117
 
221
118
  # ** model: app_repository_configuration
222
119
  class AppRepositoryConfiguration(ModuleDependency):
tiferet/domain/core.py CHANGED
@@ -159,7 +159,7 @@ class DataObject(Model):
159
159
 
160
160
 
161
161
  # ** model: module_dependency
162
- class ModuleDependency(Model):
162
+ class ModuleDependency(ValueObject):
163
163
  '''
164
164
  A module dependency.
165
165
  '''
@@ -172,27 +172,10 @@ class ModuleDependency(Model):
172
172
  )
173
173
  )
174
174
 
175
- # ** attribute: class_name
175
+ # * attribute: class_name
176
176
  class_name = StringType(
177
177
  required=True,
178
178
  metadata=dict(
179
179
  description='The class name.'
180
180
  )
181
181
  )
182
-
183
- # * method: new
184
- @staticmethod
185
- def new(**kwargs) -> 'ModuleDependency':
186
- '''
187
- Initializes a new ModuleDependency object.
188
-
189
- :param kwargs: Additional keyword arguments.
190
- :type kwargs: dict
191
- :return: A new ModuleDependency object.
192
- :rtype: ModuleDependency
193
- '''
194
-
195
- # Create a new ModuleDependency object.
196
- return ModuleDependency(dict(
197
- **kwargs
198
- ), strict=False)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tiferet
3
- Version: 1.0.0a4
3
+ Version: 1.0.0a5
4
4
  Summary: A multi-purpose application framework embodying beauty in form.
5
5
  Home-page: https://github.com/greatstrength/app
6
6
  Download-URL: https://github.com/greatstrength/app
@@ -10,19 +10,19 @@ tiferet/configs/app.py,sha256=XMBbwHS2y_Wm-scxVJ2mcAtBy0cRj5e0WLbi1F3R1Q4,299
10
10
  tiferet/contexts/__init__.py,sha256=6ElZETwHoWC-gUEm0XWnXbV_-liIgLGByGh62DO4AY8,140
11
11
  tiferet/contexts/app.py,sha256=MPRFu3ut7DOmc3i3PqLR96ymvWMShW6BUbY9eG8i6Eg,3296
12
12
  tiferet/contexts/container.py,sha256=zGCGm1lF0mI6AmEa9WK-N_Gwyv1oHSqUCOmLnkqvFyc,4871
13
- tiferet/contexts/env.py,sha256=bbvZzDy075SuKL2ZIfDEE5yD1Hbk-4XLGe4eC_tT8e8,3080
13
+ tiferet/contexts/env.py,sha256=Hhbv3sqmcVd61ck_5Uq8WWV171vaKIpIRTggeIdIrZ8,3253
14
14
  tiferet/contexts/error.py,sha256=VO3Wgkmf5bdK6LoT0xhQn1WeSAVulQwUhvBAsoUPd1c,2503
15
15
  tiferet/contexts/feature.py,sha256=u7wEhdfTLeWKIv5i2nzBcu4cAcVkm6iqNNznczPmHjc,2293
16
16
  tiferet/contexts/request.py,sha256=TOECa0V1wKuNGCYFIRKxwsZVpLtP0FS_Nm96DaEVsWU,2726
17
17
  tiferet/data/__init__.py,sha256=ts3bkFftArKTgUJj7q65Sob4fC6jOqfYNxm6cqjFr_w,74
18
- tiferet/data/app.py,sha256=8kv7tDJUjl70bqdpiMXXs6e89zDQIvtlDSOq42iyyX0,6312
18
+ tiferet/data/app.py,sha256=jZ-4fUTU-FPyaihMlmxVnSsRabcAX5ay56WbRsnKwds,9675
19
19
  tiferet/data/container.py,sha256=DMrw-jXTRgRAuxf8zmIftHwQkN9tBxBKj4pmcS7ZpB4,5182
20
20
  tiferet/data/error.py,sha256=lfGO3SjtsxSv6d7iKDeVw3vXfocCk29g4-uwC3jnaig,2377
21
21
  tiferet/data/feature.py,sha256=s_aqVYhH7VKzXpWM3d-uvSv3_r8A0LgObv3Agg-CKoc,3697
22
22
  tiferet/domain/__init__.py,sha256=uC1lHXzRnpoHqfgPcUraea5F_T1Nsx0wBau0paslsQg,146
23
- tiferet/domain/app.py,sha256=WUTiNHN-1zY7KRxxSuapUKiX56GhgwPccrHT5OaMJAY,8558
23
+ tiferet/domain/app.py,sha256=I3nFat5a73mlNvaBsTy_kIYVcv8F2mUN8MGbCxyxwtg,5640
24
24
  tiferet/domain/container.py,sha256=Kw_xNn5_tWghcx3Dl_vPEdwZ2b8u23ZpbgMQ_bkUKaw,3666
25
- tiferet/domain/core.py,sha256=jnf-33uRXrTygYv1aU71Cpf-_4KyN_ES4BodZ7JJq0o,4561
25
+ tiferet/domain/core.py,sha256=iNL5w71FQjbNICSMTZnxFAqWl6b0Cj9V94vBM6NU03Y,4112
26
26
  tiferet/domain/error.py,sha256=myUpdB4rgmbVBwIP8Pa88uastTSjPFGqrSwqR9C-VYg,3371
27
27
  tiferet/domain/feature.py,sha256=RhedOKb8nG1D0J9b_aPVtJc_rQjLXwOpwpIsmzrH21o,4552
28
28
  tiferet/repos/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -32,8 +32,8 @@ tiferet/repos/error.py,sha256=c3Bs2QTktMuJWGSRF8rKeTN5vFEsaOycUdYD7QSIDEc,4224
32
32
  tiferet/repos/feature.py,sha256=uR4s-n28J4WCO4Npi6AzOxk5R9I6HuUMHDzoK1Xo_80,4361
33
33
  tiferet/services/__init__.py,sha256=rwaCBwIfhqLkdXage-Q0hl_Ou7MAlGVW1Bg555uAUD8,44
34
34
  tiferet/services/container.py,sha256=yZU09pziCMz74UIRqiM_gHNqNE4Hml555WEuNoJlEDA,1048
35
- tiferet-1.0.0a4.dist-info/LICENSE,sha256=e8_GutFM0sxbRlgUaeVsGvJ5uE-KvruLApOzIoHy_zU,1513
36
- tiferet-1.0.0a4.dist-info/METADATA,sha256=wQ6c5-Rrgvr1kW7F5h6R-HdrJ-ecYwABZtJNNO2wEKA,422
37
- tiferet-1.0.0a4.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
38
- tiferet-1.0.0a4.dist-info/top_level.txt,sha256=g19Qw0j_VxPw-fgPF1TMPwbtHjnEhNQs0fa69wJZ6IM,8
39
- tiferet-1.0.0a4.dist-info/RECORD,,
35
+ tiferet-1.0.0a5.dist-info/LICENSE,sha256=e8_GutFM0sxbRlgUaeVsGvJ5uE-KvruLApOzIoHy_zU,1513
36
+ tiferet-1.0.0a5.dist-info/METADATA,sha256=R9SuKQafnfLIYmKLp8-ek9IC4jchvX0XpuOfXD8ZE1U,422
37
+ tiferet-1.0.0a5.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
38
+ tiferet-1.0.0a5.dist-info/top_level.txt,sha256=g19Qw0j_VxPw-fgPF1TMPwbtHjnEhNQs0fa69wJZ6IM,8
39
+ tiferet-1.0.0a5.dist-info/RECORD,,