tiferet 1.0.0a10__tar.gz → 1.0.0a11__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 (42) hide show
  1. {tiferet-1.0.0a10/tiferet.egg-info → tiferet-1.0.0a11}/PKG-INFO +4 -1
  2. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/setup.py +5 -3
  3. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/contexts/container.py +19 -3
  4. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/contexts/feature.py +24 -1
  5. {tiferet-1.0.0a10 → tiferet-1.0.0a11/tiferet.egg-info}/PKG-INFO +4 -1
  6. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet.egg-info/requires.txt +4 -0
  7. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/LICENSE +0 -0
  8. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/setup.cfg +0 -0
  9. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/__init__.py +0 -0
  10. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/clients/__init__.py +0 -0
  11. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/clients/yaml.py +0 -0
  12. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/commands/__init__.py +0 -0
  13. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/commands/container.py +0 -0
  14. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/commands/error.py +0 -0
  15. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/commands/feature.py +0 -0
  16. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/configs/__init__.py +0 -0
  17. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/contexts/__init__.py +0 -0
  18. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/contexts/app.py +0 -0
  19. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/contexts/error.py +0 -0
  20. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/contexts/request.py +0 -0
  21. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/data/__init__.py +0 -0
  22. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/data/app.py +0 -0
  23. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/data/container.py +0 -0
  24. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/data/error.py +0 -0
  25. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/data/feature.py +0 -0
  26. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/domain/__init__.py +0 -0
  27. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/domain/app.py +0 -0
  28. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/domain/container.py +0 -0
  29. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/domain/core.py +0 -0
  30. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/domain/error.py +0 -0
  31. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/domain/feature.py +0 -0
  32. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/repos/__init__.py +0 -0
  33. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/repos/app.py +0 -0
  34. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/repos/container.py +0 -0
  35. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/repos/error.py +0 -0
  36. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/repos/feature.py +0 -0
  37. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/services/__init__.py +0 -0
  38. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/services/app.py +0 -0
  39. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet/services/container.py +0 -0
  40. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet.egg-info/SOURCES.txt +0 -0
  41. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet.egg-info/dependency_links.txt +0 -0
  42. {tiferet-1.0.0a10 → tiferet-1.0.0a11}/tiferet.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tiferet
3
- Version: 1.0.0a10
3
+ Version: 1.0.0a11
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
@@ -11,3 +11,6 @@ License-File: LICENSE
11
11
  Requires-Dist: schematics>=2.1.1
12
12
  Requires-Dist: pyyaml>=6.0.1
13
13
  Requires-Dist: dependencies>=7.7.0
14
+ Provides-Extra: test
15
+ Requires-Dist: pytest>=8.3.3; extra == "test"
16
+ Requires-Dist: pytest_env>=1.1.5; extra == "test"
@@ -9,13 +9,12 @@ config = {
9
9
  'url': r'https://github.com/greatstrength/app',
10
10
  'download_url': r'https://github.com/greatstrength/app',
11
11
  'author_email': 'andrew@greatstrength.me',
12
- 'version': '1.0.0-alpha.10',
12
+ 'version': '1.0.0-alpha.11',
13
13
  'license': 'BSD 3',
14
14
  'install_requires': [
15
15
  'schematics>=2.1.1',
16
16
  'pyyaml>=6.0.1',
17
17
  'dependencies>=7.7.0'
18
-
19
18
  ],
20
19
  'packages': [
21
20
  'tiferet',
@@ -29,7 +28,10 @@ config = {
29
28
  'tiferet.services',
30
29
  ],
31
30
  'scripts': [],
32
- 'name': 'tiferet'
31
+ 'name': 'tiferet',
32
+ 'extras_require': {
33
+ 'test': ['pytest>=8.3.3', 'pytest_env>=1.1.5'],
34
+ }
33
35
  }
34
36
 
35
37
  setup(**config)
@@ -1,6 +1,7 @@
1
1
  # *** imports
2
2
 
3
3
  # ** core
4
+ import os
4
5
  from typing import Any
5
6
 
6
7
  # ** app
@@ -78,11 +79,15 @@ class ContainerContext(Model):
78
79
  :type data_flag: str
79
80
  '''
80
81
 
81
- # Add the attributes as an empty dictionary.
82
+ # Add the attributes and constants as empty dictionaries.
82
83
  attributes = {}
84
+ constants = {}
83
85
 
84
86
  # Get and set attributes and constants.
85
87
  attrs, consts = container_repo.list_all()
88
+
89
+ # Parse the constants.
90
+ constants.update({key: self.parse_parameter(consts[key]) for key in consts})
86
91
 
87
92
  # Add the attributes to the context.
88
93
  for attr in attrs:
@@ -99,7 +104,7 @@ class ContainerContext(Model):
99
104
  # Add any parameters as constants.
100
105
  for dep in attr.dependencies:
101
106
  for key in dep.parameters:
102
- consts[key] = dep.parameters[key]
107
+ constants[key] = self.parse_parameter(dep.parameters[key])
103
108
 
104
109
  # Add the constants and attributes to the context.
105
110
  super().__init__(dict(
@@ -107,9 +112,20 @@ class ContainerContext(Model):
107
112
  feature_flag=feature_flag,
108
113
  data_flag=data_flag,
109
114
  attributes=attributes,
110
- constants=consts,
115
+ constants=constants,
111
116
  ))
112
117
 
118
+
119
+ # * method: parse_environment_parameter
120
+ def parse_parameter(self, parameter: str) -> str:
121
+
122
+ # If the parameter is an environment variable, get the value.
123
+ if parameter.startswith('$env.'):
124
+ return os.getenv(parameter[5:])
125
+
126
+ # Otherwise, return the parameter.
127
+ return parameter
128
+
113
129
  # * method: get_dependency
114
130
  def get_dependency(self, attribute_id: str):
115
131
  '''
@@ -51,6 +51,20 @@ class FeatureContext(Model):
51
51
  features=features,
52
52
  ))
53
53
  self.container = container_context
54
+
55
+ # * method: parse_parameter
56
+ def parse_parameter(self, parameter: str) -> str:
57
+ '''
58
+ Parse a parameter.
59
+
60
+ :param parameter: The parameter to parse.
61
+ :type parameter: str
62
+ :return: The parsed parameter.
63
+ :rtype: str
64
+ '''
65
+
66
+ # Parse the parameter.
67
+ return self.container.parse_parameter(parameter)
54
68
 
55
69
  # * method: execute
56
70
  def execute(self, request: RequestContext, debug: bool = False, **kwargs):
@@ -71,12 +85,21 @@ class FeatureContext(Model):
71
85
  # Get the feature command handler instance.
72
86
  handler = self.container.get_dependency(command.attribute_id)
73
87
 
88
+ # Parse the command parameters
89
+ params = {
90
+ param:
91
+ self.parse_parameter(
92
+ command.params.get(param)
93
+ )
94
+ for param in command.params
95
+ }
96
+
74
97
  # Execute the handler function.
75
98
  # Handle assertion errors if pass on error is not set.
76
99
  try:
77
100
  result = handler.execute(
78
101
  **request.data,
79
- **command.params,
102
+ **params,
80
103
  debug=debug,
81
104
  **kwargs)
82
105
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tiferet
3
- Version: 1.0.0a10
3
+ Version: 1.0.0a11
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
@@ -11,3 +11,6 @@ License-File: LICENSE
11
11
  Requires-Dist: schematics>=2.1.1
12
12
  Requires-Dist: pyyaml>=6.0.1
13
13
  Requires-Dist: dependencies>=7.7.0
14
+ Provides-Extra: test
15
+ Requires-Dist: pytest>=8.3.3; extra == "test"
16
+ Requires-Dist: pytest_env>=1.1.5; extra == "test"
@@ -1,3 +1,7 @@
1
1
  schematics>=2.1.1
2
2
  pyyaml>=6.0.1
3
3
  dependencies>=7.7.0
4
+
5
+ [test]
6
+ pytest>=8.3.3
7
+ pytest_env>=1.1.5
File without changes
File without changes