tiferet 1.0.0a2__tar.gz → 1.0.0a4__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 (48) hide show
  1. {tiferet-1.0.0a2/tiferet.egg-info → tiferet-1.0.0a4}/PKG-INFO +2 -1
  2. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/setup.py +4 -2
  3. tiferet-1.0.0a4/tiferet/__init__.py +1 -0
  4. tiferet-1.0.0a4/tiferet/clients/__init__.py +1 -0
  5. tiferet-1.0.0a4/tiferet/contexts/__init__.py +4 -0
  6. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/data/container.py +2 -2
  7. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/domain/app.py +6 -6
  8. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/domain/core.py +2 -3
  9. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/repos/app.py +5 -4
  10. tiferet-1.0.0a4/tiferet/services/__init__.py +1 -0
  11. {tiferet-1.0.0a2 → tiferet-1.0.0a4/tiferet.egg-info}/PKG-INFO +2 -1
  12. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet.egg-info/SOURCES.txt +0 -1
  13. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet.egg-info/requires.txt +1 -0
  14. tiferet-1.0.0a2/tiferet/commands/__init__.py +0 -0
  15. tiferet-1.0.0a2/tiferet/contexts/__init__.py +0 -2
  16. tiferet-1.0.0a2/tiferet/repos/__init__.py +0 -0
  17. tiferet-1.0.0a2/tiferet/services/__init__.py +0 -4
  18. tiferet-1.0.0a2/tiferet/services/cli.py +0 -186
  19. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/LICENSE +0 -0
  20. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/setup.cfg +0 -0
  21. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/clients/yaml.py +0 -0
  22. {tiferet-1.0.0a2/tiferet → tiferet-1.0.0a4/tiferet/commands}/__init__.py +0 -0
  23. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/commands/container.py +0 -0
  24. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/commands/error.py +0 -0
  25. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/commands/feature.py +0 -0
  26. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/configs/__init__.py +0 -0
  27. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/configs/app.py +0 -0
  28. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/contexts/app.py +0 -0
  29. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/contexts/container.py +0 -0
  30. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/contexts/env.py +0 -0
  31. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/contexts/error.py +0 -0
  32. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/contexts/feature.py +0 -0
  33. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/contexts/request.py +0 -0
  34. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/data/__init__.py +0 -0
  35. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/data/app.py +0 -0
  36. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/data/error.py +0 -0
  37. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/data/feature.py +0 -0
  38. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/domain/__init__.py +0 -0
  39. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/domain/container.py +0 -0
  40. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/domain/error.py +0 -0
  41. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/domain/feature.py +0 -0
  42. {tiferet-1.0.0a2/tiferet/clients → tiferet-1.0.0a4/tiferet/repos}/__init__.py +0 -0
  43. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/repos/container.py +0 -0
  44. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/repos/error.py +0 -0
  45. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/repos/feature.py +0 -0
  46. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet/services/container.py +0 -0
  47. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/tiferet.egg-info/dependency_links.txt +0 -0
  48. {tiferet-1.0.0a2 → tiferet-1.0.0a4}/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.0a2
3
+ Version: 1.0.0a4
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,3 +10,4 @@ License: BSD 3
10
10
  License-File: LICENSE
11
11
  Requires-Dist: schematics>=2.1.1
12
12
  Requires-Dist: pyyaml>=6.0.1
13
+ Requires-Dist: dependencies>=7.7.0
@@ -9,11 +9,13 @@ 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.2',
12
+ 'version': '1.0.0-alpha.4',
13
13
  'license': 'BSD 3',
14
14
  'install_requires': [
15
15
  'schematics>=2.1.1',
16
- 'pyyaml>=6.0.1'
16
+ 'pyyaml>=6.0.1',
17
+ 'dependencies>=7.7.0'
18
+
17
19
  ],
18
20
  'packages': [
19
21
  'tiferet',
@@ -0,0 +1 @@
1
+ from .contexts import *
@@ -0,0 +1 @@
1
+ from . import yaml as yaml_client
@@ -0,0 +1,4 @@
1
+ from .app import AppInterfaceContext
2
+ from .env import EnvironmentContext
3
+ from .request import RequestContext
4
+ from .error import ErrorContext
@@ -36,7 +36,7 @@ class ContainerDependencyYamlData(ContainerDependency, DataObject):
36
36
  parameters = DictType(
37
37
  StringType,
38
38
  default={},
39
- serialize_name='params',
39
+ serialized_name='params',
40
40
  deserialize_from=['params'],
41
41
  metadata=dict(
42
42
  description='The parameters need to now account for new data names in the YAML format.'
@@ -117,7 +117,7 @@ class ContainerAttributeYamlData(ContainerAttribute, DataObject):
117
117
  dependencies = DictType(
118
118
  ModelType(ContainerDependencyYamlData),
119
119
  default=[],
120
- serialize_name='deps',
120
+ serialized_name='deps',
121
121
  deserialize_from=['deps', 'dependencies'],
122
122
  metadata=dict(
123
123
  description='The dependencies are now a key-value pair keyed by the flags.'
@@ -31,9 +31,9 @@ class AppDependency(ModuleDependency):
31
31
  '''
32
32
 
33
33
  # Create and return a new AppDependency object.
34
- return super(AppDependency, AppDependency).new(
35
- AppDependency,
36
- **kwargs
34
+ return AppDependency(
35
+ super(AppDependency, AppDependency).new(**kwargs),
36
+ strict=False,
37
37
  )
38
38
 
39
39
  # ** model: app_interface
@@ -266,9 +266,9 @@ class AppRepositoryConfiguration(ModuleDependency):
266
266
  '''
267
267
 
268
268
  # Create and return a new AppRepositoryConfiguration object.
269
- return super(AppRepositoryConfiguration, AppRepositoryConfiguration).new(
270
- AppRepositoryConfiguration,
271
- **kwargs
269
+ return AppRepositoryConfiguration(
270
+ super(AppRepositoryConfiguration, AppRepositoryConfiguration).new(**kwargs),
271
+ strict=False,
272
272
  )
273
273
 
274
274
 
@@ -193,7 +193,6 @@ class ModuleDependency(Model):
193
193
  '''
194
194
 
195
195
  # Create a new ModuleDependency object.
196
- return super(ModuleDependency, ModuleDependency).new(
197
- ModuleDependency,
196
+ return ModuleDependency(dict(
198
197
  **kwargs
199
- )
198
+ ), strict=False)
@@ -2,7 +2,7 @@
2
2
 
3
3
  # ** app
4
4
  from ..domain.app import AppInterface
5
- from ..data.app import AppInterfaceData
5
+ from ..data.app import AppInterfaceYamlData
6
6
  from ..clients import yaml as yaml_client
7
7
 
8
8
 
@@ -72,9 +72,10 @@ class YamlProxy(object):
72
72
  interfaces = yaml_client.load(
73
73
  self.config_file,
74
74
  create_data=lambda data: [
75
- AppInterfaceData.new(
75
+ AppInterfaceYamlData.new(
76
+ id=interface_id,
76
77
  **record
77
- ).map() for record in data],
78
+ ).map() for interface_id, record in data.items()],
78
79
  start_node=lambda data: data.get('interfaces'))
79
80
 
80
81
  # Return the list of app interface objects.
@@ -94,7 +95,7 @@ class YamlProxy(object):
94
95
  # Load the app interface data from the yaml configuration file.
95
96
  _data: AppInterface = yaml_client.load(
96
97
  self.config_file,
97
- create_data=lambda data: AppInterfaceData.new (
98
+ create_data=lambda data: AppInterfaceYamlData.new (
98
99
  id=id, **data),
99
100
  start_node=lambda data: data.get('interfaces').get(id))
100
101
 
@@ -0,0 +1 @@
1
+ from . import container as container_service
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tiferet
3
- Version: 1.0.0a2
3
+ Version: 1.0.0a4
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,3 +10,4 @@ License: BSD 3
10
10
  License-File: LICENSE
11
11
  Requires-Dist: schematics>=2.1.1
12
12
  Requires-Dist: pyyaml>=6.0.1
13
+ Requires-Dist: dependencies>=7.7.0
@@ -38,5 +38,4 @@ tiferet/repos/container.py
38
38
  tiferet/repos/error.py
39
39
  tiferet/repos/feature.py
40
40
  tiferet/services/__init__.py
41
- tiferet/services/cli.py
42
41
  tiferet/services/container.py
@@ -1,2 +1,3 @@
1
1
  schematics>=2.1.1
2
2
  pyyaml>=6.0.1
3
+ dependencies>=7.7.0
File without changes
@@ -1,2 +0,0 @@
1
- from .app import AppContext
2
- from .env import EnvironmentContext
File without changes
@@ -1,4 +0,0 @@
1
- from . import cli as cli_service
2
- from . import container as container_service
3
- from . import object as object_service
4
- from . import sync as sync_service
@@ -1,186 +0,0 @@
1
- from typing import List, Dict, Any
2
- import argparse
3
-
4
- from ..contexts.request import RequestContext
5
- from ..domain.cli import CliInterface
6
- from ..domain.cli import CliArgument
7
-
8
-
9
- def create_argument_data(cli_argument: CliArgument):
10
-
11
- # List fields to be excluded.
12
- exclude_fields = ['name_or_flags', 'arg_type', 'to_data']
13
-
14
- # Exclude unneeded fields if the argument contains an action.
15
- if cli_argument.action:
16
- exclude_fields.append('nargs')
17
- exclude_fields.append('type')
18
- exclude_fields.append('choices')
19
-
20
- # Set the data type for the argument.
21
- if cli_argument.type == 'str':
22
- data_type = str
23
- elif cli_argument.type == 'int':
24
- data_type = int
25
- elif cli_argument.type == 'float':
26
- data_type = float
27
-
28
- # For each name or flag in the argument,
29
- for name in cli_argument.name_or_flags:
30
-
31
- # If the name or flag is a positional argument,
32
- if not name.startswith('--'):
33
-
34
- # Remove the required field.
35
- exclude_fields.append('required')
36
-
37
- # Assemble the argument data.
38
- argument_data = cli_argument.to_primitive()
39
-
40
- # Set the data type.
41
- argument_data['type'] = data_type
42
-
43
- # For each field in the excluded fields,
44
- for field in exclude_fields:
45
-
46
- # Remove the field from the argument data if it is present.
47
- try:
48
- del argument_data[field]
49
- except KeyError:
50
- pass
51
-
52
- # Return the argument data.
53
- return argument_data
54
-
55
-
56
- def create_headers(data: dict):
57
- headers = dict(
58
- group_id=data.pop('group'),
59
- command_id=data.pop('command'),
60
- )
61
- headers['id'] = f"{headers['group_id']}.{headers['command_id']}".replace(
62
- '-', '_')
63
- return headers
64
-
65
-
66
- def create_cli_parser(cli_interface: CliInterface):
67
-
68
- # Format commands into a dictionary lookup by group id.
69
- commands = {}
70
- for command in cli_interface.commands:
71
- group_id = command.group_id
72
- if group_id not in commands:
73
- commands[group_id] = []
74
- commands[group_id].append(command)
75
-
76
- # Create parser.
77
- parser = argparse.ArgumentParser()
78
-
79
- # Add command subparsers
80
- command_subparsers = parser.add_subparsers(dest='group')
81
- for group_id, commands in commands.items():
82
- group_name = group_id.replace('_', '-')
83
- command_subparser = command_subparsers.add_parser(
84
- group_name)
85
- subcommand_subparsers = command_subparser.add_subparsers(
86
- dest='command')
87
- for command in commands:
88
- command_name = command.id.split('.')[-1].replace('_', '-')
89
- subcommand_subparser = subcommand_subparsers.add_parser(
90
- command_name)
91
- for argument in command.arguments:
92
- subcommand_subparser.add_argument(
93
- *argument.name_or_flags, **create_argument_data(argument))
94
- for argument in cli_interface.parent_arguments:
95
- subcommand_subparser.add_argument(
96
- *argument.name_or_flags, **create_argument_data(argument))
97
-
98
- return parser
99
-
100
-
101
- def create_request(request: argparse.Namespace, cli_interface: CliInterface, **kwargs) -> RequestContext:
102
-
103
- # Convert argparse.Namespace to dictionary.
104
- data = vars(request)
105
-
106
- # Create header values.
107
- headers = create_headers(data)
108
-
109
- # Get the command from the CLI interface.
110
- command = cli_interface.get_command(**headers)
111
-
112
- # Create map of arguments to their data attribute names.
113
- argument_map = {arg.get_name(): arg for arg in command.arguments}
114
-
115
- # Map the data to the request context.
116
- for key, value in data.items():
117
- if value is None:
118
- continue
119
- argument = argument_map.get(key)
120
- data[key] = map_object_input(value, argument)
121
-
122
- # Create request context.
123
- return RequestContext(
124
- feature_id=command.feature_id,
125
- data=data,
126
- headers=headers,
127
- **headers,
128
- **kwargs
129
- )
130
-
131
-
132
- def map_object_input(data: Any, argument: CliArgument):
133
-
134
- # If the argument is not input to data,
135
- if not argument.to_data:
136
-
137
- # Return the data.
138
- return data
139
-
140
- # If the argument is a dictionary,
141
- if argument.nargs:
142
-
143
- # If the argument is a list, split the data by the delimiter.
144
- result = {}
145
-
146
- # For each item in the data, split the item into key and value.
147
- for item in data:
148
-
149
- # Split the item into key and value.
150
- key, value = item.split('=')
151
-
152
- # Add the key and value to the result.
153
- result[key] = value
154
-
155
- # Return result.
156
- return result
157
-
158
- # If the argument is an object list,
159
- if argument.action == 'append':
160
-
161
- # Create a list to store the result.
162
- result = []
163
-
164
- # For each row object in the data,
165
- for row in data:
166
-
167
- # Create an object to store the key value pairs.
168
- obj = {}
169
-
170
- # Split the row by the delimiter.
171
- items = row.split(';')
172
-
173
- # For each item in the row,
174
- for item in items:
175
-
176
- # Split the item into key and value.
177
- key, value = item.split('=')
178
-
179
- # Add the key and value to the object.
180
- obj[key] = value
181
-
182
- # Add the object to the result.
183
- result.append(obj)
184
-
185
- # Return result.
186
- return result
File without changes
File without changes
File without changes