launchpy 0.4.8__tar.gz → 0.4.9.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.8/launchpy.egg-info → launchpy-0.4.9.post1}/PKG-INFO +2 -1
  2. {launchpy-0.4.8 → launchpy-0.4.9.post1}/docs/cli.md +6 -6
  3. {launchpy-0.4.8 → launchpy-0.4.9.post1}/docs/releases.md +11 -1
  4. {launchpy-0.4.8 → launchpy-0.4.9.post1}/docs/synchronizer.md +1 -1
  5. {launchpy-0.4.8 → launchpy-0.4.9.post1}/launchpy/__init__.py +23 -2
  6. launchpy-0.4.9.post1/launchpy/__version__.py +1 -0
  7. {launchpy-0.4.8 → launchpy-0.4.9.post1}/launchpy/cli/__main__.py +11 -8
  8. {launchpy-0.4.8 → launchpy-0.4.9.post1}/launchpy/synchronizer.py +36 -14
  9. {launchpy-0.4.8 → launchpy-0.4.9.post1/launchpy.egg-info}/PKG-INFO +2 -1
  10. {launchpy-0.4.8 → launchpy-0.4.9.post1}/launchpy.egg-info/requires.txt +1 -0
  11. {launchpy-0.4.8 → launchpy-0.4.9.post1}/pyproject.toml +1 -1
  12. {launchpy-0.4.8 → launchpy-0.4.9.post1}/requirements.txt +2 -1
  13. launchpy-0.4.8/launchpy/__version__.py +0 -1
  14. {launchpy-0.4.8 → launchpy-0.4.9.post1}/LICENSE +0 -0
  15. {launchpy-0.4.8 → launchpy-0.4.9.post1}/README.md +0 -0
  16. {launchpy-0.4.8 → launchpy-0.4.9.post1}/docs/admin.md +0 -0
  17. {launchpy-0.4.8 → launchpy-0.4.9.post1}/docs/getstarted.md +0 -0
  18. {launchpy-0.4.8 → launchpy-0.4.9.post1}/docs/library.md +0 -0
  19. {launchpy-0.4.8 → launchpy-0.4.9.post1}/docs/main.md +0 -0
  20. {launchpy-0.4.8 → launchpy-0.4.9.post1}/docs/property.md +0 -0
  21. {launchpy-0.4.8 → launchpy-0.4.9.post1}/docs/translator.md +0 -0
  22. {launchpy-0.4.8 → launchpy-0.4.9.post1}/launchpy/admin.py +0 -0
  23. {launchpy-0.4.8 → launchpy-0.4.9.post1}/launchpy/cli/__init__.py +0 -0
  24. {launchpy-0.4.8 → launchpy-0.4.9.post1}/launchpy/config.py +0 -0
  25. {launchpy-0.4.8 → launchpy-0.4.9.post1}/launchpy/configs.py +0 -0
  26. {launchpy-0.4.8 → launchpy-0.4.9.post1}/launchpy/connector.py +0 -0
  27. {launchpy-0.4.8 → launchpy-0.4.9.post1}/launchpy/launchpy.py +0 -0
  28. {launchpy-0.4.8 → launchpy-0.4.9.post1}/launchpy/library.py +0 -0
  29. {launchpy-0.4.8 → launchpy-0.4.9.post1}/launchpy/property.py +0 -0
  30. {launchpy-0.4.8 → launchpy-0.4.9.post1}/launchpy.egg-info/SOURCES.txt +0 -0
  31. {launchpy-0.4.8 → launchpy-0.4.9.post1}/launchpy.egg-info/dependency_links.txt +0 -0
  32. {launchpy-0.4.8 → launchpy-0.4.9.post1}/launchpy.egg-info/entry_points.txt +0 -0
  33. {launchpy-0.4.8 → launchpy-0.4.9.post1}/launchpy.egg-info/top_level.txt +0 -0
  34. {launchpy-0.4.8 → launchpy-0.4.9.post1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: launchpy
3
- Version: 0.4.8
3
+ Version: 0.4.9.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
@@ -28,6 +28,7 @@ Requires-Dist: pathlib
28
28
  Requires-Dist: aepp
29
29
  Requires-Dist: rich
30
30
  Requires-Dist: deprecated
31
+ Requires-Dist: httpx
31
32
  Dynamic: license-file
32
33
 
33
34
  # Launchpy
@@ -394,10 +394,10 @@ Arguments:
394
394
  `-n`, `--name`: The name of the component to synchronize. This is a required parameter.
395
395
  `-id`, `--id`: ID of the component to synchronize (overrides name if both provided)
396
396
  `-p`, `--published` : Boolean. Synchronize the latest published version of the component. Default `False`. Possible values: `True`, `False`
397
- `-f`, `--force` : Boolean. Create the component if it does not exist. Default `True`. Possible values: `True`, `False`
397
+ `-c`, `--create` : Boolean. Create the component if it does not exist. Default `True`. Possible values: `True`, `False`
398
398
 
399
399
  ```bash
400
- synchronizer:Base_Property_Name> sync -n "Component Name" -p True -f True
400
+ synchronizer:Base_Property_Name> sync -n "Component Name" -p True -c True
401
401
  ```
402
402
 
403
403
  #### rename_component
@@ -482,10 +482,10 @@ This command allows you to synchronize a library from the base property to the t
482
482
  **IMPORTANT**:By default it will use the published version of the elements that are part of the library.
483
483
  * `-n`, `--name`: Name of the library to sync from. This is a required parameter.
484
484
  * `-id`, `--id`: ID of the library to sync from (overrides name if both provided). This is an optional parameter.
485
- * `-f`, `--force`: Boolean. Create the component if it does not exist. Default True. Possible values: True, False
486
- * `-ll`, `--library_linked`: Boolean. Whether to use library linked components or not. If set to True, the sync will be done using the library linked components. If set to False, the sync will be done using the component IDs in the library. Default True. Possible values: True, False
487
- * `-p`, `--published`: Boolean. Sync the latest published version of the component instead of the current version. Default False. Possible values: True, False
488
- * `-dr`, `--dry_run`: Boolean. If set to True, will only check the sync status of the components without actually syncing them. Default False. Possible values: True, False
485
+ * `-c`, `--create`: Boolean. Create the component if it does not exist. Default `False`. Possible values: True, False
486
+ * `-ll`, `--library_linked`: Boolean. Whether to use library linked components or not. If set to True, the sync will be done using the library linked components. If set to False, the sync will be done using the component IDs in the library. Default `True`. Possible values: True, False
487
+ * `-p`, `--published`: Boolean. Sync the latest published version of the component instead of the current version. Default `False`. Possible values: True, False
488
+ * `-dr`, `--dry_run`: Boolean. If set to True, will only check the sync status of the components without actually syncing them. Default `False`. Possible values: True, False
489
489
 
490
490
  ```bash
491
491
  synchronizer:Base_Property_Name> sync_from_library -id "LibraryId" -ll False -p True -dr True
@@ -3,13 +3,23 @@
3
3
  This page gathered the changes made between version of the launchpy module.\
4
4
  This has been started after the 0.3.0 release.\
5
5
 
6
+ ## 0.4.9
7
+ * fixing httpx dependency requirement
8
+ * extractProperty will now also extract Data Elements and Extensions configurations in separate folders.
9
+ * fix the argument handling for linkedLibrary in CLI.
10
+ * Change of the `force` parameter to `create` in the synchronizer CLI for better understanding of the action. `create` is now default to `False`. The synchronizer module keeps its long name `forceCreation` for backward compatibility and better understanding of the action. Also turning it to `False` by default. \
11
+ Patch:
12
+ * adding a `verbose` parameter to the synchronizer CLI for better understanding of the process. Default to `False`.
13
+ * adding a `verbose` parameter to the synchronizer module for better understanding of the process. Default to `False`.
14
+ * fixing default value for `create` parameter and its documentation in the CLI.
15
+
6
16
  ## 0.4.8
7
17
  * Adding the `clear` method in CLI
8
18
  * Adding `syncFromLibrary` in synchronizer[doc](./synchronizer.md#syncFromLibrary).
9
19
  * Adding `sync_from_library` command in CLI[doc](./cli.md#sync_from_library-command).
10
20
  * Cleaning the JWT components and requirements
11
21
  * Adding the `definition` attribute in the Library class
12
- * Adding capability to define a specific environment name when creating a library in synchronizer
22
+ * Adding capability to define a specific environment name when creating a library in synchronizer.
13
23
 
14
24
  ## 0.4.7
15
25
  * Modify `getRuleComponents` to `getRulesComponents` as it can return all the rules components if no rule is specified. Kept `getRuleComponents` as an alias for backward compatibility and also provide a single rule components retrieval.
@@ -146,7 +146,7 @@ This method allows you to take a library in your base property and sync all of t
146
146
  Arguments:
147
147
  * library : REQUIRED : the name or the ID of the library to sync from.
148
148
  * state : OPTIONAL : the state of the library to sync from. Default: 'published', possible states: "development", "submitted", "approved", "rejected", "published"
149
- * force : OPTIONAL : If set to True, it will create the element sync if it does not exist in the target property. Set to `False`, it will prevent that behavior. Default: `True`.
149
+ * create : OPTIONAL : If set to True, it will create the element sync if it does not exist in the target property. Set to `False`, it will prevent that behavior. Default: `False`.
150
150
  * libraryLinked : OPTIONAL : If set to True, it will use library linked components for comparison. Default: `True`.
151
151
  * publishedVersion : OPTIONAL : If set to True, it will compare the components to the published version in the target properties. Default: `False`.
152
152
  * dryRun : OPTIONAL : If set to True, will only check the sync status of the components without actually syncing them. Default `False`. Possible values: `True`, `False`
@@ -9,7 +9,7 @@ from launchpy.library import Library
9
9
  from launchpy.admin import Admin
10
10
  from launchpy.property import Property
11
11
  from launchpy.synchronizer import Synchronizer
12
- import re
12
+ import re,json
13
13
  from pathlib import Path
14
14
  import httpx, asyncio
15
15
 
@@ -51,6 +51,15 @@ async def process_all_rules(rules_list, folder, header):
51
51
  # 'gather' runs them all concurrently
52
52
  await asyncio.gather(*tasks)
53
53
 
54
+
55
+ async def write_all_data_elements(data_elements_list, folder, header):
56
+ for data_element in data_elements_list:
57
+ data_element_name = __safe_name__(data_element['attributes']['name'])
58
+ file_path = Path(folder) / f"{data_element_name}.json"
59
+ with open(file_path, "w") as f:
60
+ json.dump(data_element, f, indent=4)
61
+
62
+
54
63
  def extractProperty(property: dict | Property):
55
64
  if property is None:
56
65
  raise ValueError("Property is None")
@@ -62,4 +71,16 @@ def extractProperty(property: dict | Property):
62
71
  folder = __safe_name__(property.name)
63
72
  Path(folder).mkdir(parents=True, exist_ok=True)
64
73
  rules = property.getRules()
65
- asyncio.run(process_all_rules(rules, folder, property.header))
74
+ asyncio.run(process_all_rules(rules, folder, property.header))
75
+ dataElements = property.getDataElements()
76
+ dataElements_folder = Path(folder) / "data_elements"
77
+ Path(dataElements_folder).mkdir(parents=True, exist_ok=True)
78
+ asyncio.run(write_all_data_elements(dataElements, dataElements_folder, property.header))
79
+ extension_folder = Path(folder) / "extensions"
80
+ extension_folder.mkdir(parents=True, exist_ok=True)
81
+ extensions = property.getExtensions()
82
+ for extension in extensions:
83
+ extension_name = __safe_name__(extension['attributes']['name'])
84
+ file_path = extension_folder / f"{extension_name}.json"
85
+ with open(file_path, "w") as f:
86
+ json.dump(extension, f, indent=4)
@@ -0,0 +1 @@
1
+ __version__ = "0.4.9-1"
@@ -568,13 +568,14 @@ class SynchronizerCLI(cmd.Cmd):
568
568
  parser.add_argument("-n", "--name", help="Name of the component to sync", type=str)
569
569
  parser.add_argument("-id", "--id", help="ID of the component to sync (overrides name if both provided)", type=str)
570
570
  parser.add_argument("-p", "--published", help="Boolean. Sync the latest published version of the component instead of the current version. Default False. Possible values: True, False", type=str2bool, nargs="?", const=True, default=False)
571
- parser.add_argument("-f", "--force", help="Boolean. Create the component if it does not exist. Default True. Possible values: True, False", type=str2bool, default=True)
571
+ parser.add_argument("-c", "--create", help="Boolean. Create the component if it does not exist. Default False. Possible values: True, False", type=str2bool, default=False)
572
+ parser.add_argument("-v", "--verbose", help="Boolean. Print detailed information about the sync process. Default False. Possible values: True, False", type=str2bool, nargs="?", const=True, default=False)
572
573
  try:
573
574
  args = parser.parse_args(shlex.split(args))
574
575
  if args.id is not None:
575
- result = self.synchronizer.syncComponent(componentId=args.id, publishedVersion=args.published, forceCreation=args.force)
576
+ result = self.synchronizer.syncComponent(componentId=args.id, publishedVersion=args.published, forceCreation=args.create, verbose=args.verbose)
576
577
  else:
577
- result = self.synchronizer.syncComponent(componentName=args.name, publishedVersion=args.published, forceCreation=args.force)
578
+ result = self.synchronizer.syncComponent(componentName=args.name, publishedVersion=args.published, forceCreation=args.create, verbose=args.verbose)
578
579
  console.print(f"Component '{args.name or args.id}' synced successfully.", style="green")
579
580
  except Exception as e:
580
581
  console.print(f"(!) Error: {str(e)}", style="red")
@@ -765,14 +766,16 @@ class SynchronizerCLI(cmd.Cmd):
765
766
  parser = argparse.ArgumentParser(prog='sync_from_library', add_help=True)
766
767
  parser.add_argument("-n", "--name", help="Name of the library to sync from", type=str)
767
768
  parser.add_argument("-id", "--id", help="ID of the library to sync from (overrides name if both provided)", type=str)
768
- parser.add_argument("-f", "--force", help="Boolean. Create the component if it does not exist. Default True. Possible values: True, False", type=str2bool, default=True)
769
- parser.add_argument("-ll", "--library_linked", help="Boolean. Whether to use library linked components or not. If set to True, the sync will be done using the library linked components. If set to False, the sync will be done using the component IDs in the library. Default True. Possible values: True, False", type=str, default=True)
769
+ parser.add_argument("-c", "--create", help="Boolean. Create the component if it does not exist. Default False. Possible values: True, False", type=str2bool, default=False)
770
+ parser.add_argument("-ll", "--library_linked", help="Boolean. Whether to use library linked components or not. If set to True, the sync will be done using the library linked components. If set to False, the sync will be done using the component IDs in the library. Default True. Possible values: True, False", type=str2bool, default=True)
770
771
  parser.add_argument("-p", "--published", help="Boolean. Sync the latest published version of the component instead of the current version. Default False. Possible values: True, False", type=str2bool, nargs="?", const=True, default=False,)
771
772
  parser.add_argument("-dr", "--dry_run", help="Boolean. If set to True, will only check the sync status of the components without actually syncing them. Default False. Possible values: True, False", type=str2bool, nargs="?", const=True, default=False,)
773
+ parser.add_argument("-v", "--verbose", help="Boolean. Print detailed information about the sync process. Default False. Possible values: True, False", type=str2bool, nargs="?", const=True, default=False)
772
774
  try:
773
775
  args = parser.parse_args(shlex.split(args))
774
776
  publishedVersion = args.published # default False
775
777
  libraryLinked = args.library_linked # default True
778
+ verbose = args.verbose # default False
776
779
  if args.published:
777
780
  publishedVersion = True
778
781
  libraryLinked = False
@@ -796,7 +799,7 @@ class SynchronizerCLI(cmd.Cmd):
796
799
  console.print(f"Upgrading {len(extensions)} extension{'s' if len(extensions) > 1 else ''} from library '{lib.name}'...", style="blue")
797
800
  for ext in extensions:
798
801
  try:
799
- self.synchronizer.upgradeTargetExtension(extensionName=ext['attributes']['name'])
802
+ self.synchronizer.upgradeTargetExtension(extensionName=ext['attributes']['name'], platform=ext['attributes']['platform'], publishedVersion=publishedVersion, verbose=args.verbose)
800
803
  console.print(f"Extension '{ext['attributes']['name']}' upgraded successfully.", style="green")
801
804
  except Exception as e:
802
805
  console.print(f"(!) Error upgrading extension '{ext['attributes']['name']}': {str(e)}", style="red")
@@ -808,7 +811,7 @@ class SynchronizerCLI(cmd.Cmd):
808
811
  ruleId = rule['links']['self'].split('/').pop()
809
812
  else:
810
813
  ruleId = rule['id']
811
- self.synchronizer.syncComponent(componentId=ruleId, publishedVersion=publishedVersion, forceCreation=args.force,libraryLinked=libraryLinked)
814
+ self.synchronizer.syncComponent(componentId=ruleId, publishedVersion=publishedVersion, forceCreation=args.create,libraryLinked=libraryLinked,verbose=args.verbose)
812
815
  console.print(f"Rule '{rule['attributes']['name']}' synced successfully.", style="green")
813
816
  except Exception as e:
814
817
  console.print(f"(!) Error syncing rule '{rule['attributes']['name']}': {str(e)}", style="red")
@@ -820,7 +823,7 @@ class SynchronizerCLI(cmd.Cmd):
820
823
  deId = de['links']['self'].split('/').pop()
821
824
  else:
822
825
  deId = de['id']
823
- self.synchronizer.syncComponent(componentId=deId, publishedVersion=publishedVersion, forceCreation=args.force,libraryLinked=libraryLinked)
826
+ self.synchronizer.syncComponent(componentId=deId, publishedVersion=publishedVersion, forceCreation=args.create,libraryLinked=libraryLinked,verbose=args.verbose)
824
827
  console.print(f"Data element '{de['attributes']['name']}' synced successfully.", style="green")
825
828
  except Exception as e:
826
829
  console.print(f"(!) Error syncing data element '{de['attributes']['name']}': {str(e)}", style="red")
@@ -217,7 +217,7 @@ class Synchronizer:
217
217
  cmp_baseDict = {'id':lib_cmp_base['id'],'name':lib_cmp_base['attributes']['name'],'component':lib_cmp_base,'copy':copySettings(lib_cmp_base)}
218
218
  return cmp_baseDict
219
219
 
220
- def syncComponent(self,componentName:str=None,componentId:str=None,publishedVersion:bool=False,forceCreation:bool=True,**kwargs)->None:
220
+ def syncComponent(self,componentName:str=None,componentId:str=None,publishedVersion:bool=False,forceCreation:bool=False,**kwargs)->None:
221
221
  """
222
222
  Synchronize a component from the base property to the different target properties.
223
223
  It will detect the component with the same name in target properties.
@@ -227,13 +227,15 @@ class Synchronizer:
227
227
  componentName : REQUIRED : the name of the component to sync
228
228
  componentID : REQUIRED : the id of the component to sync
229
229
  publishedVersion : OPTIONAL : if you want to take the version that has been published
230
- forceCreation : OPTIONAL : If the component does not exist in the target property, create it. Default: True
230
+ forceCreation : OPTIONAL : If the component does not exist in the target property, create it. Default: False
231
231
  possible kwargs:
232
232
  timeout : OPTIONAL : The timeout to be used for the rule component. If not provided, the existing timeout will be used.
233
233
  libraryLinked : OPTIONAL : If you want to take a component ID that are associated to a specific library. Default: False. If set to True, the method will look for the component in the library and take the version linked to the library instead of the latest version in the property. Do not work for Extensions.
234
+ verbose : OPTIONAL : If set to True, it will print the synchronization status of each property. Default: False.
234
235
  """
235
236
  timeout = kwargs.get('timeout',None)
236
237
  libraryLinked = kwargs.get('libraryLinked',False)
238
+ verbose = kwargs.get('verbose',False)
237
239
  if componentName is None and componentId is None:
238
240
  raise ValueError('Require a component Name of a component ID')
239
241
  cmp_baseDict = self.__prepareBaseComponent__(componentName=componentName,componentId=componentId,publishedVersion=publishedVersion,libraryLinked=libraryLinked)
@@ -254,6 +256,8 @@ class Synchronizer:
254
256
  ## if it does not exist
255
257
  if cmp_baseDict['name'] not in [de.get('attributes',{}).get('name') for de in self.targets[target]['dataElements']]:
256
258
  if forceCreation:
259
+ if verbose:
260
+ print(f'The data element "{cmp_baseDict["name"]}" does not exist in the target property "{target}". Creating it')
257
261
  comp = self.targets[target]['api'].createDataElement(
258
262
  name=cmp_baseDict['name'],
259
263
  descriptor= translatedComponent['descriptor'],
@@ -270,6 +274,9 @@ class Synchronizer:
270
274
  attr_dict=translatedComponent)
271
275
  self.targets[target]['libraryStack']['dataElements'].append(comp)
272
276
  self.targets[target]['dataElements'].append(comp)
277
+ else:
278
+ if verbose:
279
+ print(f'The data element "{cmp_baseDict["name"]}" does not exist in the target property "{target}". Set forceCreation to True if you want to create it.')
273
280
  else:
274
281
  index,old_component = [(index,de) for index,de in enumerate(self.targets[target]['dataElements']) if de.get('attributes',{}).get('name') == cmp_baseDict['name']][0]
275
282
  attributes = {
@@ -313,6 +320,8 @@ class Synchronizer:
313
320
  ## if rule does not exist
314
321
  if cmp_baseDict['name'] not in [rule['attributes']['name'] for rule in self.targets[target]['rules']]:
315
322
  if forceCreation:## creating the rule
323
+ if verbose:
324
+ print(f'The rule "{cmp_baseDict["name"]}" does not exist in the target property "{target}". Creating it')
316
325
  targetRule = self.targets[target]['api'].createRule(
317
326
  name=cmp_baseDict['name']
318
327
  )
@@ -343,7 +352,11 @@ class Synchronizer:
343
352
  )
344
353
  else:
345
354
  flagSkipCreation = True
355
+ if verbose:
356
+ print(f'The rule "{cmp_baseDict["name"]}" does not exist in the target property "{target}". Not creating it')
346
357
  else: ## if a rule exist with the same name
358
+ if verbose:
359
+ print(f'The rule "{cmp_baseDict["name"]}" exists in the target property "{target}". Updating it')
347
360
  index, targetRule = [(index,rule) for index, rule in enumerate(self.targets[target]['rules']) if rule['attributes']['name'] == cmp_baseDict['name']][0]
348
361
  self.targets[target]['libraryStack']['rules'].append(targetRule)
349
362
  targetRuleId = targetRule['id']
@@ -377,29 +390,30 @@ class Synchronizer:
377
390
  timeout=translatedComponent['timeout'],
378
391
  )
379
392
  ## updating rule attribute if difference between base and target
380
- if not flagSkipCreation:
393
+ if not flagSkipCreation: ## if the rule was created or updated, we want to make sure that the attribute are the same as the template
381
394
  if cmp_baseDict['component']['attributes']['enabled'] != targetRule['attributes']['enabled']:
382
395
  baseRuleAttr = copySettings(cmp_baseDict['component'])
383
396
  targetRule = self.targets[target]['api'].updateRule(rule_id=targetRuleId,attr_dict=baseRuleAttr) ## keeping in a var for debug
384
397
  del self.targets[target]['rules'][index]
385
398
  self.targets[target]['rules'].append(targetRule)
386
399
 
387
- def syncComponents(self,componentsName:list=None,componentsId:list=None,publishedVersion:bool=False)->None:
400
+ def syncComponents(self,componentsName:list=None,componentsId:list=None,publishedVersion:bool=False,forceCreation:bool=False)->None:
388
401
  """
389
402
  Sync multiple components by looping through the list of name passed.
390
403
  Arguments:
391
404
  componentsName : REQUIRED : The list of component names to sync
392
405
  componentsId : REQUIRED : The list of component ID to sync
393
406
  publishedVersion : OPTIONAL : if you want to take the version that has been published
407
+ forceCreation : OPTIONAL : If set to True, it will sync the components even if they do not exist in the target properties. If set to False, it will only sync the components that already exist in the target properties. Default: False.
394
408
  """
395
409
  if componentsName is not None:
396
410
  for component in componentsName:
397
- self.syncComponent(componentName=component,publishedVersion=publishedVersion)
411
+ self.syncComponent(componentName=component,publishedVersion=publishedVersion,forceCreation=forceCreation)
398
412
  if componentsId is not None:
399
413
  for component in componentsId:
400
- self.syncComponent(componentId=component,publishedVersion=publishedVersion)
414
+ self.syncComponent(componentId=component,publishedVersion=publishedVersion,forceCreation=forceCreation)
401
415
 
402
- def createTargetsLibrary(self,name:str="syncComponents",assignEnv:bool|str=False)->None:
416
+ def createTargetsLibrary(self,name:str="syncComponents",assignEnv:bool|str=False,**kwargs)->None:
403
417
  """
404
418
  This method will create or update a Library in all of the target properties to gather all elements changed.
405
419
  If a library exists and **contains** the same name, it will be used.
@@ -508,13 +522,14 @@ class Synchronizer:
508
522
  return response
509
523
 
510
524
 
511
- def upgradeTargetExtension(self,extensionName:str=None,platform:str="web")->dict:
525
+ def upgradeTargetExtension(self,extensionName:str=None,platform:str="web",verbose:bool=False)->dict:
512
526
  """
513
527
  Upgrade the name extension in the target properties.
514
528
  Arguments:
515
529
  extensionName : REQUIRED : The name of the extension to upgrade.
516
530
  ex : "core" or "adobe-analytics"
517
531
  platform : OPTIONAL : If you want to update the extension of a specific platform (default "web")
532
+ verbose : OPTIONAL : If set to True, will print detailed information about the upgrade process. Default False.
518
533
  """
519
534
  if extensionName is None:
520
535
  raise ValueError("Require an extension name")
@@ -529,7 +544,11 @@ class Synchronizer:
529
544
  index = [index for index, ext in enumerate(target['extensions']) if ext['attributes']['name'] == extName][0]
530
545
  del target['extensions'][index]
531
546
  target['extensions'].append(res)
532
-
547
+ if verbose:
548
+ print(f"Extension '{extName}' upgraded successfully in '{prop}' property.")
549
+ else:
550
+ if verbose:
551
+ print(f"Extension '{extName}' is already up to date in '{prop}' property.")
533
552
  except:
534
553
  raise ValueError(f"Could not find an extension name: {extensionName}")
535
554
 
@@ -781,17 +800,20 @@ class Synchronizer:
781
800
  dict_check[element_name] = self.checkComponentSync(componentId=element_id, excludeSimilar=excludeSimilar,publishedVersion=publishedVersion,libraryLinked=libraryLink)
782
801
  return dict_check
783
802
 
784
- def syncFromLibrary(self,library:str=None,state='published',force:bool=True,libraryLinked:bool=True,publishedVersion:bool=False,dryRun:bool=False)->None:
803
+ def syncFromLibrary(self,library:str=None,state='published',forceCreation:bool=False,libraryLinked:bool=True,publishedVersion:bool=False,dryRun:bool=False,**kwargs)->None:
785
804
  """
786
805
  Sync the components in a library, from the base property, to the different target properties by using the createTargetsLibrary method.
787
806
  Arguments:
788
807
  library : REQUIRED : the library name or the library ID to get the components.
789
808
  state : OPTIONAL : the state of the library to compare. Default: 'published', possible states: "development", "submitted", "approved", "rejected", "published"
790
- force : OPTIONAL : If set to True, it will sync the components even if they do not exist in the target properties. If set to False, it will only sync the components that already exist in the target properties. Default: True.
809
+ forceCreation : OPTIONAL : If set to True, it will sync the components even if they do not exist in the target properties. If set to False, it will only sync the components that already exist in the target properties. Default: False.
791
810
  libraryLinked : OPTIONAL : If set to True, it will sync the components using the library version. Default: False.
792
811
  publishedVersion : OPTIONAL : if you want to sync the version of the library that has been published in your base vs the published version of your target. Default: False.
793
812
  dryRun : OPTIONAL : If set to True, it will not actually sync the components but will return a dictionary with the components that would be synced and the target properties they would be synced to. Default: False.
813
+ Possible kwargs:
814
+ verbose : bool : If set to True, it will print the name of the components and the property that are being synced and the target property. Default: False.
794
815
  """
816
+ verbose = kwargs.get('verbose', False)
795
817
  if library is None:
796
818
  raise ValueError('Require a library Name of a library ID')
797
819
  libs = self.base['api'].getLibraries(state=state)
@@ -810,7 +832,7 @@ class Synchronizer:
810
832
  if len(extensions)>0:
811
833
  for ext in extensions:
812
834
  try:
813
- self.upgradeTargetExtension(extensionName=ext['attributes']['name'])
835
+ self.upgradeTargetExtension(extensionName=ext['attributes']['name'],platform=ext['attributes']['platform'],publishedVersion=publishedVersion,verbose=verbose)
814
836
  except:
815
837
  print(f'Extension {ext["attributes"]["name"]} could not be updated in the target properties. Please check if the extension exist and if there is an update available.')
816
838
  if len(rules)>0:
@@ -820,7 +842,7 @@ class Synchronizer:
820
842
  ruleId = rule['links']['self'].split('/').pop()
821
843
  else:
822
844
  ruleId = rule['id']
823
- self.syncComponent(componentId=ruleId,publishedVersion=publishedVersion, forceCreation=force,libraryLinked=libraryLinked)
845
+ self.syncComponent(componentId=ruleId,publishedVersion=publishedVersion, forceCreation=forceCreation,libraryLinked=libraryLinked,verbose=verbose)
824
846
  except:
825
847
  print(f'Rule {rule["attributes"]["name"]} could not be updated in the target properties. Please check if the rule exist.')
826
848
  if len(dataelements)>0:
@@ -830,7 +852,7 @@ class Synchronizer:
830
852
  deId = de['links']['self'].split('/').pop()
831
853
  else:
832
854
  deId = de['id']
833
- self.syncComponent(componentId=deId,publishedVersion=publishedVersion,forceCreation=force,libraryLinked=libraryLinked)
855
+ self.syncComponent(componentId=deId,publishedVersion=publishedVersion,forceCreation=forceCreation,libraryLinked=libraryLinked,verbose=verbose)
834
856
  except:
835
857
  print(f'Data Element {de["attributes"]["name"]} could not be updated in the target properties. Please check if the data element exist.')
836
858
  return
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: launchpy
3
- Version: 0.4.8
3
+ Version: 0.4.9.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
@@ -28,6 +28,7 @@ Requires-Dist: pathlib
28
28
  Requires-Dist: aepp
29
29
  Requires-Dist: rich
30
30
  Requires-Dist: deprecated
31
+ Requires-Dist: httpx
31
32
  Dynamic: license-file
32
33
 
33
34
  # Launchpy
@@ -5,3 +5,4 @@ pathlib
5
5
  aepp
6
6
  rich
7
7
  deprecated
8
+ httpx
@@ -32,7 +32,7 @@ dependencies = ['pandas',
32
32
  "pathlib",
33
33
  "aepp",
34
34
  "rich",
35
- "deprecated"]
35
+ "deprecated","httpx"]
36
36
 
37
37
  [project.urls]
38
38
  homepage = "https://github.com/pitchmuc/launchpy"
@@ -4,4 +4,5 @@ requests>=2.25.0
4
4
  aepp>=0.3.12
5
5
  pandas>=2.1.0
6
6
  rich>=14.0.0
7
- deprecated
7
+ deprecated
8
+ httpx>=0.24.0
@@ -1 +0,0 @@
1
- __version__ = "0.4.8"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes