launchpy 0.4.7__tar.gz → 0.4.7.post1__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 (34) hide show
  1. {launchpy-0.4.7/launchpy.egg-info → launchpy-0.4.7.post1}/PKG-INFO +5 -6
  2. {launchpy-0.4.7 → launchpy-0.4.7.post1}/README.md +4 -5
  3. launchpy-0.4.7.post1/docs/cli.md +498 -0
  4. {launchpy-0.4.7 → launchpy-0.4.7.post1}/docs/synchronizer.md +1 -0
  5. launchpy-0.4.7.post1/launchpy/__version__.py +1 -0
  6. {launchpy-0.4.7 → launchpy-0.4.7.post1}/launchpy/cli/__main__.py +135 -7
  7. {launchpy-0.4.7 → launchpy-0.4.7.post1}/launchpy/synchronizer.py +26 -1
  8. {launchpy-0.4.7 → launchpy-0.4.7.post1/launchpy.egg-info}/PKG-INFO +5 -6
  9. {launchpy-0.4.7 → launchpy-0.4.7.post1}/launchpy.egg-info/SOURCES.txt +1 -0
  10. launchpy-0.4.7/launchpy/__version__.py +0 -1
  11. {launchpy-0.4.7 → launchpy-0.4.7.post1}/LICENSE +0 -0
  12. {launchpy-0.4.7 → launchpy-0.4.7.post1}/docs/admin.md +0 -0
  13. {launchpy-0.4.7 → launchpy-0.4.7.post1}/docs/getstarted.md +0 -0
  14. {launchpy-0.4.7 → launchpy-0.4.7.post1}/docs/library.md +0 -0
  15. {launchpy-0.4.7 → launchpy-0.4.7.post1}/docs/main.md +0 -0
  16. {launchpy-0.4.7 → launchpy-0.4.7.post1}/docs/property.md +0 -0
  17. {launchpy-0.4.7 → launchpy-0.4.7.post1}/docs/releases.md +0 -0
  18. {launchpy-0.4.7 → launchpy-0.4.7.post1}/docs/translator.md +0 -0
  19. {launchpy-0.4.7 → launchpy-0.4.7.post1}/launchpy/__init__.py +0 -0
  20. {launchpy-0.4.7 → launchpy-0.4.7.post1}/launchpy/admin.py +0 -0
  21. {launchpy-0.4.7 → launchpy-0.4.7.post1}/launchpy/cli/__init__.py +0 -0
  22. {launchpy-0.4.7 → launchpy-0.4.7.post1}/launchpy/config.py +0 -0
  23. {launchpy-0.4.7 → launchpy-0.4.7.post1}/launchpy/configs.py +0 -0
  24. {launchpy-0.4.7 → launchpy-0.4.7.post1}/launchpy/connector.py +0 -0
  25. {launchpy-0.4.7 → launchpy-0.4.7.post1}/launchpy/launchpy.py +0 -0
  26. {launchpy-0.4.7 → launchpy-0.4.7.post1}/launchpy/library.py +0 -0
  27. {launchpy-0.4.7 → launchpy-0.4.7.post1}/launchpy/property.py +0 -0
  28. {launchpy-0.4.7 → launchpy-0.4.7.post1}/launchpy.egg-info/dependency_links.txt +0 -0
  29. {launchpy-0.4.7 → launchpy-0.4.7.post1}/launchpy.egg-info/entry_points.txt +0 -0
  30. {launchpy-0.4.7 → launchpy-0.4.7.post1}/launchpy.egg-info/requires.txt +0 -0
  31. {launchpy-0.4.7 → launchpy-0.4.7.post1}/launchpy.egg-info/top_level.txt +0 -0
  32. {launchpy-0.4.7 → launchpy-0.4.7.post1}/pyproject.toml +0 -0
  33. {launchpy-0.4.7 → launchpy-0.4.7.post1}/requirements.txt +0 -0
  34. {launchpy-0.4.7 → launchpy-0.4.7.post1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: launchpy
3
- Version: 0.4.7
3
+ Version: 0.4.7.post1
4
4
  Summary: Adobe Launch API wrapper
5
5
  Author-email: Julien Piccini <piccini.julien@gmail.com>
6
6
  License: Apache License 2.0
@@ -37,17 +37,15 @@ This module is named launchpy.
37
37
 
38
38
  ## Installation
39
39
 
40
- You can install the module by realising the following pip command:
41
-
40
+ You can install the module by realising the following pip command:\
42
41
  `pip install launchpy`
43
42
 
44
- You can access the version of the module that you run via the following attribute:
45
-
43
+ You can access the version of the module that you run via the following attribute:\
46
44
  `launchpy.__version__`
47
45
 
48
46
  ## Content of the module
49
47
 
50
- This module is built around 5 main parts:
48
+ This module is built around 7 main parts:
51
49
 
52
50
  - Helping functions [Core Components](./docs/main.md)
53
51
  - Admin instantiating functions [Admin Class](./docs/admin.md)
@@ -55,6 +53,7 @@ This module is built around 5 main parts:
55
53
  - Managing Publishing Cycle [Library Class](./docs/library.md)
56
54
  - Translator functionationality [Translator Class](./docs/translator.md)
57
55
  - Synchronizer [Synchronizer Class](./docs/synchronizer.md)
56
+ - Command Line Interface [CLI](./docs/cli.md)
58
57
 
59
58
  ## Get Started
60
59
 
@@ -5,17 +5,15 @@ This module is named launchpy.
5
5
 
6
6
  ## Installation
7
7
 
8
- You can install the module by realising the following pip command:
9
-
8
+ You can install the module by realising the following pip command:\
10
9
  `pip install launchpy`
11
10
 
12
- You can access the version of the module that you run via the following attribute:
13
-
11
+ You can access the version of the module that you run via the following attribute:\
14
12
  `launchpy.__version__`
15
13
 
16
14
  ## Content of the module
17
15
 
18
- This module is built around 5 main parts:
16
+ This module is built around 7 main parts:
19
17
 
20
18
  - Helping functions [Core Components](./docs/main.md)
21
19
  - Admin instantiating functions [Admin Class](./docs/admin.md)
@@ -23,6 +21,7 @@ This module is built around 5 main parts:
23
21
  - Managing Publishing Cycle [Library Class](./docs/library.md)
24
22
  - Translator functionationality [Translator Class](./docs/translator.md)
25
23
  - Synchronizer [Synchronizer Class](./docs/synchronizer.md)
24
+ - Command Line Interface [CLI](./docs/cli.md)
26
25
 
27
26
  ## Get Started
28
27
 
@@ -0,0 +1,498 @@
1
+ # Command Line Interface for launchpy
2
+
3
+ This document provides an overview of the command line interface (CLI) for `launchpy`, a tool designed to facilitate the launching of applications and services. The CLI allows users to interact with `launchpy` directly from the terminal, providing a convenient way to manage and execute tasks.
4
+
5
+ **Table of Contents**:
6
+ - [Command Line Interface for launchpy](#command-line-interface-for-launchpy)
7
+ - [Prequisites](#prequisites)
8
+ - [Installation](#installation)
9
+ - [Usage](#usage)
10
+ - [Instantiation](#instantiation)
11
+ - [create\_config\_file](#create_config_file)
12
+ - [config](#config)
13
+ - [get\_properties](#get_properties)
14
+ - [create\_property](#create_property)
15
+ - [delete\_property](#delete_property)
16
+ - [extract\_property](#extract_property)
17
+ - [load\_property](#load_property)
18
+ - [get\_extensions](#get_extensions)
19
+ - [load\_extension](#load_extension)
20
+ - [Property Layer Commands](#property-layer-commands)
21
+ - [get\_extensions](#get_extensions-1)
22
+ - [get\_extension](#get_extension)
23
+ - [get\_rules](#get_rules)
24
+ - [get\_rule](#get_rule)
25
+ - [get\_rules\_components](#get_rules_components)
26
+ - [get\_rule\_components](#get_rule_components)
27
+ - [get\_data\_elements](#get_data_elements)
28
+ - [get\_data\_element](#get_data_element)
29
+ - [get\_latest\_published\_version](#get_latest_published_version)
30
+ - [get\_libraries](#get_libraries)
31
+ - [delete\_library](#delete_library)
32
+ - [delete\_library\_components](#delete_library_components)
33
+ - [create\_env](#create_env)
34
+ - [Synchronizer Layer Commands](#synchronizer-layer-commands)
35
+ - [check\_component](#check_component)
36
+ - [sync](#sync)
37
+ - [rename\_component](#rename_component)
38
+ - [get\_targets](#get_targets)
39
+ - [upgrade\_extension](#upgrade_extension)
40
+ - [get\_base\_rules](#get_base_rules)
41
+ - [get\_base\_data\_elements](#get_base_data_elements)
42
+ - [get\_base\_extensions](#get_base_extensions)
43
+ - [get\_base\_libraries](#get_base_libraries)
44
+ - [get\_base\_library](#get_base_library)
45
+ - [sync\_from\_library](#sync_from_library)
46
+ - [create\_libraries](#create_libraries)
47
+
48
+
49
+
50
+ ## Prequisites
51
+ Before using the `launchpy` CLI, ensure that you have the following prerequisites:
52
+ - Python 3.10 or higher installed on your system.
53
+ - Access to a terminal or command prompt.
54
+ - An active internet connection to install `launchpy` and its dependencies.
55
+ - An Adobe Developer Project that is connected to your Adobe Launch / Adobe Experience Platform Data Collection Tags. This would provide the information required (`client_id`, `secret`, `org_id`, `scopes`) to use the CLI to launch your applications and services.
56
+
57
+ ## Installation
58
+ You would need to have Python installed on your system to use `launchpy`. The recommended version is Python 3.10 or higher. You can check your Python version by running:
59
+
60
+ ```bash
61
+ python --version
62
+ ```
63
+
64
+ In order to use the CLI, you would need to have at least the version `0.4.7` of `launchpy`.
65
+ To install `launchpy`, you can use pip:
66
+
67
+ ```bash
68
+ pip install launchpy
69
+ ```
70
+
71
+ to upgrade to the latest version, you can run:
72
+
73
+ ```bash
74
+ pip install --upgrade launchpy
75
+ ```
76
+
77
+ ## Usage
78
+ Once installed, you can access the `launchpy` CLI by running the following command in your terminal:
79
+
80
+ ```bash
81
+ python -m launchpy.cli
82
+ ```
83
+
84
+ launchpy CLI provides various commands nested in different layer:
85
+ - **Main Layer** : This is the top layer of the CLI where you can access the main functionalities such as creating a config file and setting up the configuration for API connection. It can be recognized by the `(Cmd)` or `launchpy>` (once config has been ran) prompt.
86
+ - **Property Layer**: This layer allows you to access information about a specific Launch property and perform actions related to that property. It can be recognized by the `property_name>` prompt, where `property_name` is replaced by the name of your property. You can directly access this layer by providing the property name in the `config` command in the main layer.
87
+ - **Synchronizer Layer**: This layer is focused on synchronizing Launch properties. It provides commands to check for updates and synchronize your property. It can be recognized by the `synchronizer:base_property>` prompt, where `base_property` will be replaced by the name of your base property.
88
+
89
+ All layers contains the following common commands:
90
+ - `help` : Display the help message with a list of available commands and their descriptions.
91
+ - `exit` : Exit the CLI.
92
+
93
+
94
+ ### Instantiation
95
+
96
+ Once you have started the CLI, you can either create a config file if needed, or load the config file in the `config` method.
97
+ The config method also take individual parameters as arguments, which would override the values in the config file.
98
+
99
+ #### create_config_file
100
+ Create a config file to store your credentials and other necessary information for using `launchpy`. This is a one-time setup step that allows you to save your configuration for future use.\
101
+ Arguments
102
+ `-fn`, `--file_name`: The name of the config file to be created. If not provided, it defaults to `launchpy_config.json`.\
103
+
104
+ You can create a config file by running the following command:
105
+
106
+ ```bash
107
+ python -m launchpy.cli
108
+ (Cmd) create_config_file
109
+ ```
110
+
111
+
112
+ #### config
113
+ Setup the API connection to use the full capacity of the CLI.
114
+ Arguments
115
+ `-cid`,`--client_id`: The client ID for your Adobe Developer Project. This is a required parameter.
116
+ `-s`,`--secret`: The secret key for your Adobe Developer Project. This is a required parameter.
117
+ `-o`,`--org_id`: The organization ID associated with your Adobe Developer Project. This is a required parameter.
118
+ `-sc`,`--scopes`: The scopes that define the permissions for your API connection. This is a required parameter.
119
+ `-cf`,`--config_file`: The path to the config file that contains your credentials and other necessary information.
120
+ `-p`,`--property` : The property name to be used and directly instantiated the property layer. This is an optional parameter.
121
+
122
+ Example via parameters:
123
+ ```bash
124
+ python -m launchpy.cli
125
+ (Cmd) config --client_id <your_client_id> --secret <your_secret> --org_id <your_org_id> --scopes <your_scopes>
126
+ ```
127
+
128
+ Example via config file:
129
+ ```bash
130
+ python -m launchpy.cli
131
+ (Cmd) config --config_file <path_to_your_config_file>
132
+ ```
133
+ Example with direct access to property layer:
134
+ ```bash
135
+ python -m launchpy.cli
136
+ (Cmd) config --config_file <path_to_your_config_file> --property <your_property_name>
137
+ ```
138
+
139
+ **TIP**
140
+ When you are instantiating the CLI, you can directly pass the credentials information:
141
+
142
+ ```bash
143
+ python -m launchpy.cli --client_id <your_client_id> --secret <your_secret> --org_id <your_org_id> --scopes <your_scopes>
144
+ ```
145
+
146
+ or
147
+
148
+ ```bash
149
+ python -m launchpy.cli --config_file <path_to_your_config_file>
150
+ ```
151
+
152
+ It also supports direct access to the property layer by providing the property name in the parameters:
153
+
154
+ ```bash
155
+ python -m launchpy.cli --config_file <path_to_your_config_file> --property <your_property_name>
156
+ ```
157
+
158
+
159
+ #### get_properties
160
+ Retrieve a list of properties associated with your Adobe Developer Project. This command allows you to view the properties that you have access to and can manage using `launchpy`.\
161
+ Arguments:
162
+ `-n`,`--name`: The name of the property to filter the results (partial match, non-case sensitive). This is an optional parameter.
163
+ `-s`,`--save`: Boolean. Save properties to a CSV file. Default False. Possible values: `True`, `False`
164
+
165
+ ```bash
166
+ python -m launchpy.cli -cf <path_to_your_config_file>
167
+ launchpy> get_properties -n <property_name> -s True
168
+ ```
169
+
170
+ #### create_property
171
+ Create a new property in your Adobe Launch account. This command allows you to set up a new property that you can manage and synchronize using `launchpy`.\
172
+ Arguments:
173
+ `name` : The name of the new property to be created. This is a required parameter.
174
+ `-d`,`--description`: The description of the new property. This is an optional parameter.
175
+ `-p`,`--platform`: The platform for the new property. Default 'web', possible values: 'web', 'mobile'. This is an optional parameter.
176
+
177
+ Example:
178
+ ```bash
179
+ python -m launchpy.cli -cf <path_to_your_config_file>
180
+ launchpy> create_property "New Property" --description "This is a new property"
181
+ ```
182
+
183
+ #### delete_property
184
+ Delete an existing property from your Adobe Launch account. This command allows you to remove a property that you no longer need or want to manage using `launchpy`.\
185
+ Arguments:
186
+ `name`: The name of the property to be deleted. This is a required parameter.
187
+
188
+ ```bash
189
+ python -m launchpy.cli -cf <path_to_your_config_file>
190
+ launchpy> delete_property "Property Name"
191
+ ```
192
+
193
+
194
+ #### extract_property
195
+ This method allows you to extract the details of a specific property and save them to a folder.\
196
+ The folder name would be the name of the property, it will contains sub folders for each rules.\
197
+ Arguments:
198
+ `name`: The name of the property to extract. This is a required parameter.
199
+
200
+ This can be useful for searching code or for backup purposes.
201
+
202
+ ```bash
203
+
204
+ python -m launchpy.cli -cf <path_to_your_config_file>
205
+ launchpy> extract_property "Property Name"
206
+ ```
207
+
208
+
209
+ #### load_property
210
+ This method load the property layer for a specific property, allowing you to access and manage that property directly.
211
+ Arguments:
212
+ `name`: The name of the property to load. This is a required parameter.
213
+
214
+ ```bash
215
+ python -m launchpy.cli -cf <path_to_your_config_file>
216
+ launchpy> load_property "Property Name"
217
+ property_name>
218
+ ```
219
+
220
+ #### get_extensions
221
+ List all available extensions in the connected Adobe Launch organization.
222
+ Arguments:
223
+ `-s`, `--save`: Boolean. Save extensions to a JSON file. Default False. Possible values: `True`, `False`
224
+
225
+ ```bash
226
+ python -m launchpy.cli -cf <path_to_your_config_file>
227
+ launchpy> get_extensions -s True
228
+ ```
229
+
230
+ #### load_extension
231
+ Load a the synchronizer layer, allowing you to manage and synchronize properties with rules and data elements.\
232
+ Arguments:
233
+ `base_name`: Name of the Launch Property to use as base.
234
+ `-t`, `--targets`: list of target property names for synchronization. This is a required parameter.
235
+ `-dy`, `--dynamic_component`: Name of the Data Element that would contain dynamic component rules. This is an optional parameter, if not provided, it would not use dynamic component rules.
236
+
237
+ ```bash
238
+ python -m launchpy.cli -cf <path_to_your_config_file>
239
+ launchpy> load_synchronizer "Base Property Name" -t "Target Property 1" "Target Property 2" -dy "Dynamic Component Data Element Name"
240
+ synchronizer:Base_Property_Name>
241
+ ```
242
+
243
+ ### Property Layer Commands
244
+
245
+ Once you have instantiated the property layer for a specific property, you can access various commands to manage that property. These commands allow you to perform actions such as viewing and editing rules, data elements, and other configurations related to that property.
246
+
247
+ #### get_extensions
248
+ Get all extensions in the property and list them.\
249
+ Arguments:
250
+ `-s`, `--save`: Boolean. Save extensions to a CSV file. Default False. Possible values: `True`, `False`
251
+
252
+ ```bash
253
+ property_name> get_extensions -s True
254
+ ```
255
+
256
+ #### get_extension
257
+ Get details of a specific extension in the property.\
258
+ Arguments:
259
+ `name`: The name of the extension to retrieve details for. This is a required parameter.
260
+ `-s`, `--save`: Boolean. Save the extension details to a JSON file. Default False. Possible values: `True`, `False`
261
+
262
+ ```bash
263
+ property_name> get_extension "Extension Name" -s True
264
+ ```
265
+
266
+ #### get_rules
267
+ Get all rules in the property and list them.\
268
+ Arguments:
269
+ `-n`, `--name`: The name of the rule to filter the results (partial match, non-case sensitive). This is an optional parameter.
270
+ `-s`, `--save`: Boolean. Save rules to a CSV file. Default False. Possible values: `True`, `False`
271
+
272
+ ```bash
273
+ property_name> get_rules -n "Rule Name" -s True
274
+ ```
275
+
276
+ #### get_rule
277
+ Get details of a specific rule in the property.\
278
+ Arguments:
279
+ `name`: The name of the rule to retrieve details for. This is a required parameter.
280
+ `-s`, `--save`: Boolean. Save the rule details to a JSON file. Default False. Possible values: `True`, `False`
281
+
282
+ ```bash
283
+ property_name> get_rule "Rule Name" -s True
284
+ ```
285
+
286
+ #### get_rules_components
287
+ Get all rule components, and save them to a CSV file if specified. Intended to be used for all components, but can be filtering.\
288
+ Arguments:
289
+ `-s`, `--save`: Boolean. Save rules components to a CSV file. Default False. Possible values: `True`, `False`
290
+ `-rn`, `--rule_name`: (Partial) Name of the rule to get components for. This is an optional parameter.
291
+ `-rid`, `--rule_id`: ID of the rule to get components for. This is an optional parameter, if both `rule_name` and `rule_id` are provided, it will use `rule_id`.
292
+
293
+ ```bash
294
+ property_name> get_rules_components -s True
295
+ ```
296
+
297
+ #### get_rule_components
298
+ Get all components for a specific rule by name or ID. Way more effective than the other methods and provide more details.\
299
+ Arguments:
300
+ `-s`, `--save`: Boolean. Save the rule components to a JSON file. Default False. Possible values: `True`, `False`
301
+ `-rn`, `--rule_name`: (Partial) Name of the rule to get components for. This is an optional parameter.
302
+ `-rid`, `--rule_id`: ID of the rule to get components for. This is an optional parameter, if both `rule_name` and `rule_id` are provided, it will use `rule_id`.
303
+
304
+ ```bash
305
+ property_name> get_rule_components -rn "Rule Name" -s True
306
+ ```
307
+
308
+ #### get_data_elements
309
+ Get all data elements in the property and list them.\
310
+ Arguments:
311
+ `-n`, `--name`: The name of the data element to filter the results (partial match, non-case sensitive). This is an optional parameter.
312
+ `-s`, `--save`: Boolean. Save data elements to a CSV file. Default False. Possible values: `True`, `False`
313
+
314
+ ```bash
315
+ property_name> get_data_elements -n "Data Element Name" -s True
316
+ ```
317
+
318
+ #### get_data_element
319
+ Get details of a specific data element in the property.\
320
+ Arguments:
321
+ `name`: The name of the data element to retrieve details for. This is a required parameter.
322
+ `-s`, `--save`: Boolean. Save the data element details to a JSON file. Default False. Possible values: `True`, `False`
323
+
324
+ ```bash
325
+ property_name> get_data_element "Data Element Name" -s True
326
+ ```
327
+
328
+ #### get_latest_published_version
329
+ Get the latest published version of a specific component in the property.\
330
+ Arguments:
331
+ `-n`, `--name`: The name of the component to get the latest published version for. This is a required parameter.
332
+ `-t`, `--type`: The type of the component (e.g. 'rule', 'data_element', 'extension') to get the latest published version for. This is a required parameter.
333
+ `-s`, `--save`: Boolean. Save the latest published version details to a JSON file. Default False. Possible values: `True`, `False`
334
+
335
+ ```bash
336
+ property_name> get_latest_published_version -n "Component Name" -t "rule" -s True
337
+ ```
338
+
339
+ #### get_libraries
340
+ Get all libraries in the property and list them.\
341
+ Arguments:
342
+ `-s`, `--save`: Boolean. Save libraries to a CSV file. Default False. Possible values: `True`, `False`
343
+ `-st`, `--state`: Filter by library state. Possible values: 'development' (default), 'submitted', 'approved', 'rejected', 'published'. This is an optional parameter.
344
+
345
+ ```bash
346
+ property_name> get_libraries -s True -st "development"
347
+ ```
348
+
349
+ #### delete_library
350
+ Delete a library from the property.\
351
+ Arguments:
352
+ `name`: The name of the library to delete. This is a required parameter.
353
+
354
+ ```bash
355
+ property_name> delete_library "Library Name"
356
+ ```
357
+
358
+ #### delete_library_components
359
+ Delete components from a library.\
360
+ Arguments:
361
+ `name`: The name of the library to delete components from. This is a required parameter.
362
+
363
+ ```bash
364
+ property_name> delete_library_components "Library Name"
365
+ ```
366
+
367
+ #### create_env
368
+ Create a new environment based on Adobe host in the property.\
369
+ Arguments:
370
+ `name`: The name of the environment to create. This is a required parameter.
371
+
372
+ ```bash
373
+ property_name> create_env "Environment Name"
374
+ ```
375
+
376
+ ### Synchronizer Layer Commands
377
+ Once you have loaded the synchronizer layer for a specific base property, you can access commands to manage and synchronize that property with target properties. These commands allow you to perform actions such as checking for updates, synchronizing properties, and managing dynamic component rules.
378
+
379
+ #### check_component
380
+ Check if a specific component is in sync between the base property and target properties.\
381
+ Arguments:
382
+ `-n`, `--name`: The name of the component to check for synchronization. This is a required parameter.
383
+ `-id`, `--id`: ID of the component to check (overrides name if both provided)
384
+ `-p`, `--published` : Boolean. Check the synchronization based on the latest published version of the component. Default False. Possible values: `True`, `False`
385
+
386
+ ```bash
387
+ synchronizer:Base_Property_Name> check_component -n "Component Name" -p True
388
+ ```
389
+
390
+ #### sync
391
+ Synchronize a specific component between the base property and target properties.\
392
+ Arguments:
393
+ `-n`, `--name`: The name of the component to synchronize. This is a required parameter.
394
+ `-id`, `--id`: ID of the component to synchronize (overrides name if both provided)
395
+ `-p`, `--published` : Boolean. Synchronize the latest published version of the component. Default `False`. Possible values: `True`, `False`
396
+ `-f`, `--force` : Boolean. Create the component if it does not exist. Default `True`. Possible values: `True`, `False`
397
+
398
+ ```bash
399
+ synchronizer:Base_Property_Name> sync -n "Component Name" -p True -f True
400
+ ```
401
+
402
+ #### rename_component
403
+ Rename a component in the destination property.
404
+ Arguments:
405
+ `current_name` : The current name of the component to rename. This is a required parameter.
406
+ `new_name`: The new name for the component. This is a required parameter.
407
+
408
+ ```bash
409
+ synchronizer:Base_Property_Name> rename_component "Current Component Name" "New Component Name"
410
+ ```
411
+
412
+ #### get_targets
413
+ Get the target properties for synchronization. This command allows you to view the properties that are set as targets for synchronization with the base property.
414
+
415
+ ```bash
416
+ synchronizer:Base_Property_Name> get_targets
417
+ ```
418
+
419
+ #### upgrade_extension
420
+ Upgrade an extension in the destination property to the latest version available in the base property.
421
+ Arguments:
422
+ `name`: The name of the extension to upgrade. This is a required parameter.
423
+ `-p`, `--platform`: The platform of the extension to upgrade (e.g. 'web', 'app'). This is an optional parameter. Default `web`.
424
+
425
+ ```bash
426
+ synchronizer:Base_Property_Name> upgrade_extension "Extension Name"
427
+ ```
428
+
429
+ #### get_base_rules
430
+ This command allows you to view the rules that are availble in the base property for synchronization with the target properties.\
431
+ Arguments:
432
+ `-n`, `--name`: The name of the rule to filter the results (partial match, non-case sensitive). This is an optional parameter.
433
+
434
+
435
+ ```bash
436
+ synchronizer:Base_Property_Name> get_base_rules -n "Rule Name"
437
+ ```
438
+
439
+ #### get_base_data_elements
440
+ This command allows you to view the data elements that are availble in the base property for synchronization with the target properties.\
441
+ Arguments:
442
+ `-n`, `--name`: The name of the data element to filter the results (partial match, non-case sensitive). This is an optional parameter.
443
+
444
+ ```bash
445
+ synchronizer:Base_Property_Name> get_base_data_elements -n "Data Element Name"
446
+ ```
447
+
448
+ #### get_base_extensions
449
+ This command allows you to view the extensions that are availble in the base property for synchronization with the target properties.\
450
+ Arguments:
451
+ `-n`, `--name`: The name of the extension to filter the results (partial match, non-case sensitive). This is an optional parameter.
452
+
453
+ ```bash
454
+ synchronizer:Base_Property_Name> get_base_extensions -n "Extension Name"
455
+ ```
456
+
457
+ #### get_base_libraries
458
+ This command allows you to view the libraries that are availble in the base property for synchronization with the target properties.\
459
+ Arguments:
460
+ `-s`, `--state`: Filter by library state. Possible values: 'published'(default),'development' , 'submitted', 'approved', 'rejected'. This is an optional parameter.
461
+ `-n`, `--name`: Filter base libraries by name (partial match, non-case sensitive). This is an optional parameter.
462
+ `-d`, `--days`: Filter libraries that have been updated in the last X days. This is an optional parameter.
463
+
464
+ ```bash
465
+ synchronizer:Base_Property_Name> get_base_libraries -s "published" -n "Library Name" -d 30
466
+ ```
467
+
468
+ #### get_base_library
469
+ This command allows you to view the details of a specific library that is availble in the base property for synchronization with the target properties.\
470
+ It returns the rule, data elements and extensions that are part of the library, as well as the details of the library itself.\
471
+ Arguments:
472
+ `-n`, `--name`: The name of the library to get details for. This is a required parameter.
473
+ `-id`, `--id`: The ID of the library to get details for (overrides name if both provided). This is an optional parameter.
474
+
475
+ ```bash
476
+ synchronizer:Base_Property_Name> get_base_library -n "Library Name"
477
+ ```
478
+
479
+ #### sync_from_library
480
+ This command allows you to synchronize a library from the base property to the target properties.\
481
+ **IMPORTANT**:By default it will use the published version of the elements that are part of the library.
482
+ `-n`, `--name`: The name of the library to sync from. This is a required parameter.
483
+ `-id`, `--id`: The ID of the library to sync from (overrides name if both provided). This is an optional parameter.
484
+
485
+ ```bash
486
+ synchronizer:Base_Property_Name> sync_from_library -n "Library Name"
487
+ ```
488
+
489
+ #### create_libraries
490
+ This command allows you to create a library in the destination properties with the elements you have sync.\
491
+ Arguments:
492
+ `name`: Name for the new library to be created in the destination properties. This is a required parameter.
493
+ `-env`, `--environment`: Boolean. Try to find an empty environment to build the library. Default False. Possible values: `True`, `False`
494
+
495
+ ```bash
496
+ synchronizer:Base_Property_Name> create_library "Library Name" -env True
497
+ ```
498
+
@@ -142,6 +142,7 @@ The name is then used to match if a library already exist with that name, in the
142
142
  Note that the match looked for is using regular expression (`re.search`) to find a match in the existing libraries name.\
143
143
  Arguments:
144
144
  * name : REQUIRED : Name of the library to create or to use.
145
+ * assignEnv : OPTIONAL : If you want to automatically assign an environment to the library and build it. Default False. Possible values: `True`, `False`
145
146
 
146
147
  ## renameComponent
147
148
 
@@ -0,0 +1 @@
1
+ __version__ = "0.4.7-1"
@@ -1,5 +1,3 @@
1
- from html import parser
2
- from matplotlib.pyplot import table
3
1
  from rich import rule
4
2
  import launchpy
5
3
  import argparse, cmd, shlex, json
@@ -7,12 +5,9 @@ from functools import wraps
7
5
  from rich.console import Console
8
6
  from rich.table import Table
9
7
  from rich.panel import Panel
10
- from rich.markdown import Markdown
11
8
  from pathlib import Path
12
- from io import FileIO
13
9
  import pandas as pd
14
- from datetime import datetime
15
- import urllib.parse
10
+ from datetime import datetime, timedelta
16
11
  from typing import Any, Concatenate, ParamSpec, ParamSpecKwargs
17
12
  from collections.abc import Callable
18
13
 
@@ -675,7 +670,140 @@ class SynchronizerCLI(cmd.Cmd):
675
670
  return
676
671
  except SystemExit:
677
672
  return
678
-
673
+
674
+ def do_get_base_libraries(self,args:Any):
675
+ """Get the base libraries that are being synchronized."""
676
+ parser = argparse.ArgumentParser(prog='get_base_libraries', add_help=True)
677
+ parser.add_argument('-s', '--state', help="Filter by library state. Possible values: 'published'(default),'development' , 'submitted', 'approved', 'rejected', ", type=str, default="published")
678
+ parser.add_argument("-n", "--name", help="Filter base libraries by name (partial match, non-case sensitive)", type=str, default=None)
679
+ parser.add_argument("-d", "--days", help="Filter libraries that have been updated in the last X days", type=int, default=None)
680
+ try:
681
+ args = parser.parse_args(shlex.split(args))
682
+ base_libs = self.synchronizer.base["api"].getLibraries(state=args.state)
683
+ if args.name:
684
+ base_libs = [lib for lib in base_libs if args.name.lower() in lib['attributes']['name'].lower()]
685
+ if args.days is not None:
686
+ cutoff_date = datetime.now() - timedelta(days=args.days)
687
+ base_libs = [lib for lib in base_libs if 'updated_at' in lib['attributes'] and datetime.strptime(lib['attributes']['updated_at'], "%Y-%m-%dT%H:%M:%S.%fZ") >= cutoff_date]
688
+ table = Table(title=f"Libraries for {self.synchronizer.base['name']}")
689
+ table.add_column("ID", style="cyan")
690
+ table.add_column("Name", style="magenta")
691
+ table.add_column("State", style="green")
692
+ table.add_column("Published", style="yellow")
693
+ for lib in base_libs:
694
+ lib_id = lib['id']
695
+ lib_name = lib['attributes']['name']
696
+ lib_state = lib['attributes']['state']
697
+ lib_published = lib['attributes'].get('published_at', 'N/A')
698
+ table.add_row(lib_id, lib_name, lib_state, lib_published)
699
+ console.print(table)
700
+ except Exception as e:
701
+ console.print(f"(!) Error: {str(e)}", style="red")
702
+ return
703
+ except SystemExit:
704
+ return
705
+
706
+ def do_get_base_library(self,args:Any):
707
+ """ Return the components that are in the base library specified (rules, data elements, extensions)"""
708
+ parser = argparse.ArgumentParser(prog='get_base_library', add_help=True)
709
+ parser.add_argument("-n", "--name", help="Name of the library to get details for", type=str)
710
+ parser.add_argument("-id", "--id", help="ID of the library to get details for (overrides name if both provided)", type=str)
711
+ try:
712
+ args = parser.parse_args(shlex.split(args))
713
+ if args.id is not None:
714
+ lib = self.synchronizer.base["api"].getLibrary(args.id, return_class=True)
715
+ else:
716
+ libs = self.synchronizer.base["api"].getLibraries()
717
+ matching_libs = [lib for lib in libs if lib['attributes']['name'] == args.name]
718
+ if not matching_libs:
719
+ console.print(f"Library '{args.name}' not found in this property.", style="red")
720
+ return
721
+ lib = self.synchronizer.base["api"].getLibrary(matching_libs[0]['id'], return_class=True)
722
+ rules = lib.getRules()
723
+ data_elements = lib.getDataElements()
724
+ extensions = lib.getExtensions()
725
+ data = {
726
+ "rules": [],
727
+ "dataElements": [],
728
+ "extensions": []
729
+ }
730
+ if len(rules) > 0:
731
+ data['rules'] = [r['attributes']['name'] for r in rules]
732
+ if len(data_elements) > 0:
733
+ data['dataElements'] = [de['attributes']['name'] for de in data_elements]
734
+ if len(extensions) > 0:
735
+ data['extensions'] = [ext['attributes']['name'] for ext in extensions]
736
+ console.print_json(json.dumps(data, indent=4))
737
+ except Exception as e:
738
+ console.print(f"(!) Error: {str(e)}", style="red")
739
+ return
740
+ except SystemExit:
741
+ return
742
+
743
+ def do_sync_from_library(self,args:Any):
744
+ """Sync all components from a base library in the source property to the destination properties. Rules and data elements will be the latest published one"""
745
+ parser = argparse.ArgumentParser(prog='sync_from_library', add_help=True)
746
+ parser.add_argument("-n", "--name", help="Name of the library to sync from", type=str)
747
+ parser.add_argument("-id", "--id", help="ID of the library to sync from (overrides name if both provided)", type=str)
748
+ try:
749
+ args = parser.parse_args(shlex.split(args))
750
+ if args.id is not None:
751
+ lib = self.synchronizer.base["api"].getLibrary(args.id, return_class=True)
752
+ else:
753
+ libs = self.synchronizer.base["api"].getLibraries()
754
+ matching_libs = [lib for lib in libs if lib['attributes']['name'] == args.name]
755
+ if not matching_libs:
756
+ console.print(f"Library '{args.name}' not found in this property.", style="red")
757
+ return
758
+ lib = self.synchronizer.base["api"].getLibrary(matching_libs[0]['id'], return_class=True)
759
+ rules = lib.getRules()
760
+ dataelements = lib.getDataElements()
761
+ extensions = lib.getExtensions()
762
+ if len(extensions)>0:
763
+ console.print(f"Upgrading {len(extensions)} extension{'s' if len(extensions) > 1 else ''} from library '{lib.name}'...", style="blue")
764
+ for ext in extensions:
765
+ try:
766
+ self.synchronizer.upgradeTargetExtension(extensionName=ext['attributes']['name'])
767
+ console.print(f"Extension '{ext['attributes']['name']}' upgraded successfully.", style="green")
768
+ except Exception as e:
769
+ console.print(f"(!) Error upgrading extension '{ext['attributes']['name']}': {str(e)}", style="red")
770
+ if len(rules)>0:
771
+ console.print(f"Syncing {len(rules)} rule{'s' if len(rules) > 1 else ''} from library '{lib.name}'...", style="blue")
772
+ for rule in rules:
773
+ try:
774
+ self.synchronizer.syncComponent(componentId=rule['id'], publishedVersion=True, forceCreation=True)
775
+ console.print(f"Rule '{rule['attributes']['name']}' synced successfully.", style="green")
776
+ except Exception as e:
777
+ console.print(f"(!) Error syncing rule '{rule['attributes']['name']}': {str(e)}", style="red")
778
+ if len(dataelements)>0:
779
+ console.print(f"Syncing {len(dataelements)} data element{'s' if len(dataelements) > 1 else ''} from library '{lib.name}'...", style="blue")
780
+ for de in dataelements:
781
+ try:
782
+ self.synchronizer.syncComponent(componentId=de['id'], publishedVersion=True, forceCreation=True)
783
+ console.print(f"Data element '{de['attributes']['name']}' synced successfully.", style="green")
784
+ except Exception as e:
785
+ console.print(f"(!) Error syncing data element '{de['attributes']['name']}': {str(e)}", style="red")
786
+ except Exception as e:
787
+ console.print(f"(!) Error: {str(e)}", style="red")
788
+ return
789
+ except SystemExit:
790
+ return
791
+
792
+ def do_create_libraries(self,args:Any):
793
+ """Create libraries in the destination property based on the libraries in the source property that are selected for synchronization."""
794
+ parser = argparse.ArgumentParser(prog='create_libraries', add_help=True)
795
+ parser.add_argument("name",help="Name for the new library to be created in the destination properties", type=str)
796
+ parser.add_argument("-env",'--environment',help='Boolean. try to find an empty environment to build the library. Default False.',type=bool,default=False)
797
+ try:
798
+ args = parser.parse_args(shlex.split(args))
799
+ res = self.synchronizer.createTargetsLibrary(name=args.name,assignEnv=args.environment)
800
+ console.print_json(json.dumps(res, indent=4))
801
+ except Exception as e:
802
+ console.print(f"(!) Error: {str(e)}", style="red")
803
+ return
804
+ except SystemExit:
805
+ return
806
+
679
807
  def do_exit(self, arg):
680
808
  """Return to the main menu."""
681
809
  console.print(Panel("Returning to main menu...", style="blue"))
@@ -369,13 +369,16 @@ class Synchronizer:
369
369
  for component in componentsId:
370
370
  self.syncComponent(componentId=component,publishedVersion=publishedVersion)
371
371
 
372
- def createTargetsLibrary(self,name:str="syncComponents")->None:
372
+ def createTargetsLibrary(self,name:str="syncComponents",assignEnv:bool=False)->None:
373
373
  """
374
374
  This method will create or update a Library in all of the target properties to gather all elements changed.
375
375
  If a library exists and **contains** the same name, it will be used.
376
376
  Argument:
377
377
  name : REQUIRED : The name of the library to create. Default : "syncComponents"
378
+ assignEnv : REQUIRED : If you want to assign a library to an environment. By default, the library is not assigned to any environment.
379
+ If set to True, the library will be assigned to an available environment in the Target Property if available and build it.
378
380
  """
381
+ response = {target:{'libraryName':name} for target in self.targets.keys()}
379
382
  for target in list(self.targets.keys()):
380
383
  if 'library' not in list(self.targets[target].keys()):
381
384
  librariesDev = self.targets[target]['api'].getLibraries(state="development")
@@ -407,6 +410,28 @@ class Synchronizer:
407
410
  self.targets[target]['library'].updateExtensions(existingExtensions)
408
411
  if len(newExtensions)>0:
409
412
  self.targets[target]['library'].addExtensions(newExtensions)
413
+ if assignEnv:
414
+ envs = self.targets[target]['api'].getEnvironments()
415
+ found_free_env = False
416
+ if len(envs)>0:
417
+ for env in envs:
418
+ library_rel = env['relationships']['library'].get('data')
419
+ if library_rel is None: ## no associated library
420
+ found_free_env = True
421
+ envId = env['id']
422
+ envName = env['attributes']['name']
423
+ scriptSource = env['meta'].get('script_sources',[{}])[0].get('minified')
424
+ break ## take the first one available
425
+ if found_free_env:
426
+ self.targets[target]['library'].setEnvironment(envId)
427
+ self.targets[target]['library'].build()
428
+ response[target]['environment'] = envName
429
+ response[target]['script'] = scriptSource
430
+ else:
431
+ response[target]['environment'] = "No free environment to assign"
432
+ response[target]['script'] = None
433
+ return response
434
+
410
435
 
411
436
  def upgradeTargetExtension(self,extensionName:str=None,platform:str="web")->dict:
412
437
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: launchpy
3
- Version: 0.4.7
3
+ Version: 0.4.7.post1
4
4
  Summary: Adobe Launch API wrapper
5
5
  Author-email: Julien Piccini <piccini.julien@gmail.com>
6
6
  License: Apache License 2.0
@@ -37,17 +37,15 @@ This module is named launchpy.
37
37
 
38
38
  ## Installation
39
39
 
40
- You can install the module by realising the following pip command:
41
-
40
+ You can install the module by realising the following pip command:\
42
41
  `pip install launchpy`
43
42
 
44
- You can access the version of the module that you run via the following attribute:
45
-
43
+ You can access the version of the module that you run via the following attribute:\
46
44
  `launchpy.__version__`
47
45
 
48
46
  ## Content of the module
49
47
 
50
- This module is built around 5 main parts:
48
+ This module is built around 7 main parts:
51
49
 
52
50
  - Helping functions [Core Components](./docs/main.md)
53
51
  - Admin instantiating functions [Admin Class](./docs/admin.md)
@@ -55,6 +53,7 @@ This module is built around 5 main parts:
55
53
  - Managing Publishing Cycle [Library Class](./docs/library.md)
56
54
  - Translator functionationality [Translator Class](./docs/translator.md)
57
55
  - Synchronizer [Synchronizer Class](./docs/synchronizer.md)
56
+ - Command Line Interface [CLI](./docs/cli.md)
58
57
 
59
58
  ## Get Started
60
59
 
@@ -3,6 +3,7 @@ README.md
3
3
  pyproject.toml
4
4
  requirements.txt
5
5
  docs/admin.md
6
+ docs/cli.md
6
7
  docs/getstarted.md
7
8
  docs/library.md
8
9
  docs/main.md
@@ -1 +0,0 @@
1
- __version__ = "0.4.7"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes