ayon-python-api 1.0.8__tar.gz → 1.0.10__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 (23) hide show
  1. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/PKG-INFO +1 -1
  2. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/ayon_api/__init__.py +8 -0
  3. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/ayon_api/_api.py +136 -18
  4. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/ayon_api/entity_hub.py +122 -34
  5. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/ayon_api/events.py +0 -1
  6. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/ayon_api/graphql.py +1 -1
  7. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/ayon_api/graphql_queries.py +9 -1
  8. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/ayon_api/server_api.py +427 -302
  9. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/ayon_api/utils.py +60 -10
  10. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/ayon_api/version.py +1 -1
  11. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/ayon_python_api.egg-info/PKG-INFO +1 -1
  12. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/pyproject.toml +5 -2
  13. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/setup.py +1 -1
  14. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/LICENSE +0 -0
  15. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/README.md +0 -0
  16. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/ayon_api/constants.py +0 -0
  17. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/ayon_api/exceptions.py +0 -0
  18. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/ayon_api/operations.py +0 -0
  19. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/ayon_python_api.egg-info/SOURCES.txt +0 -0
  20. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/ayon_python_api.egg-info/dependency_links.txt +0 -0
  21. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/ayon_python_api.egg-info/requires.txt +0 -0
  22. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/ayon_python_api.egg-info/top_level.txt +0 -0
  23. {ayon-python-api-1.0.8 → ayon-python-api-1.0.10}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ayon-python-api
3
- Version: 1.0.8
3
+ Version: 1.0.10
4
4
  Summary: AYON Python API
5
5
  Home-page: https://github.com/ynput/ayon-python-api
6
6
  Author: ynput.io
@@ -7,6 +7,8 @@ from .utils import (
7
7
  is_token_valid,
8
8
  validate_url,
9
9
  login_to_server,
10
+ take_web_action_event,
11
+ abort_web_action_event,
10
12
  )
11
13
  from .server_api import (
12
14
  RequestTypes,
@@ -85,6 +87,7 @@ from ._api import (
85
87
  get_attributes_fields_for_type,
86
88
  get_default_fields_for_type,
87
89
  get_addons_info,
90
+ get_addon_endpoint,
88
91
  get_addon_url,
89
92
  download_addon_private_file,
90
93
  get_installers,
@@ -103,6 +106,7 @@ from ._api import (
103
106
  get_bundles,
104
107
  create_bundle,
105
108
  update_bundle,
109
+ check_bundle_compatibility,
106
110
  delete_bundle,
107
111
  get_project_anatomy_presets,
108
112
  get_default_anatomy_preset_name,
@@ -238,6 +242,8 @@ __all__ = (
238
242
  "is_token_valid",
239
243
  "validate_url",
240
244
  "login_to_server",
245
+ "take_web_action_event",
246
+ "abort_web_action_event",
241
247
 
242
248
  "RequestTypes",
243
249
  "ServerAPI",
@@ -313,6 +319,7 @@ __all__ = (
313
319
  "get_attributes_fields_for_type",
314
320
  "get_default_fields_for_type",
315
321
  "get_addons_info",
322
+ "get_addon_endpoint",
316
323
  "get_addon_url",
317
324
  "download_addon_private_file",
318
325
  "get_installers",
@@ -331,6 +338,7 @@ __all__ = (
331
338
  "get_bundles",
332
339
  "create_bundle",
333
340
  "update_bundle",
341
+ "check_bundle_compatibility",
334
342
  "delete_bundle",
335
343
  "get_project_anatomy_presets",
336
344
  "get_default_anatomy_preset_name",
@@ -18,6 +18,9 @@ from .constants import (
18
18
  )
19
19
  from .server_api import ServerAPI
20
20
  from .exceptions import FailedServiceInit
21
+ from .utils import (
22
+ get_default_settings_variant as _get_default_settings_variant
23
+ )
21
24
 
22
25
 
23
26
  class GlobalServerAPI(ServerAPI):
@@ -502,6 +505,8 @@ def get_default_settings_variant():
502
505
  Union[str, None]: name of variant or None.
503
506
 
504
507
  """
508
+ if not GlobalContext.is_connection_created():
509
+ return _get_default_settings_variant()
505
510
  con = get_server_api_connection()
506
511
  return con.get_default_settings_variant()
507
512
 
@@ -722,6 +727,7 @@ def get_events(*args, **kwargs):
722
727
 
723
728
  Args:
724
729
  topics (Optional[Iterable[str]]): Name of topics.
730
+ event_ids (Optional[Iterable[str]]): Event ids.
725
731
  project_names (Optional[Iterable[str]]): Project on which
726
732
  event happened.
727
733
  states (Optional[Iterable[str]]): Filtering by states.
@@ -746,6 +752,22 @@ def get_events(*args, **kwargs):
746
752
 
747
753
 
748
754
  def update_event(*args, **kwargs):
755
+ """Update event data.
756
+
757
+ Args:
758
+ event_id (str): Event id.
759
+ sender (Optional[str]): New sender of event.
760
+ project_name (Optional[str]): New project name.
761
+ username (Optional[str]): New username.
762
+ status (Optional[str]): New event status. Enum: "pending",
763
+ "in_progress", "finished", "failed", "aborted", "restarted"
764
+ description (Optional[str]): New description.
765
+ summary (Optional[dict[str, Any]]): New summary.
766
+ payload (Optional[dict[str, Any]]): New payload.
767
+ progress (Optional[int]): New progress. Range [0-100].
768
+ retries (Optional[int]): New retries.
769
+
770
+ """
749
771
  con = get_server_api_connection()
750
772
  return con.update_event(*args, **kwargs)
751
773
 
@@ -758,17 +780,19 @@ def dispatch_event(*args, **kwargs):
758
780
  sender (Optional[str]): Sender of event.
759
781
  event_hash (Optional[str]): Event hash.
760
782
  project_name (Optional[str]): Project name.
783
+ depends_on (Optional[str]): Add dependency to another event.
761
784
  username (Optional[str]): Username which triggered event.
762
- dependencies (Optional[list[str]]): List of event id dependencies.
763
785
  description (Optional[str]): Description of event.
764
- summary (Optional[dict[str, Any]]): Summary of event that can be used
765
- for simple filtering on listeners.
786
+ summary (Optional[dict[str, Any]]): Summary of event that can
787
+ be used for simple filtering on listeners.
766
788
  payload (Optional[dict[str, Any]]): Full payload of event data with
767
789
  all details.
768
790
  finished (Optional[bool]): Mark event as finished on dispatch.
769
791
  store (Optional[bool]): Store event in event queue for possible
770
792
  future processing otherwise is event send only
771
793
  to active listeners.
794
+ dependencies (Optional[list[str]]): Deprecated.
795
+ List of event id dependencies.
772
796
 
773
797
  Returns:
774
798
  RestApiResponse: Response from server.
@@ -851,7 +875,8 @@ def download_file_to_stream(*args, **kwargs):
851
875
 
852
876
  Args:
853
877
  endpoint (str): Endpoint or URL to file that should be downloaded.
854
- stream (Union[io.BytesIO, BinaryIO]): Stream where output will be stored.
878
+ stream (Union[io.BytesIO, BinaryIO]): Stream where output will
879
+ be stored.
855
880
  chunk_size (Optional[int]): Size of chunks that are received
856
881
  in single loop.
857
882
  progress (Optional[TransferProgress]): Object that gives ability
@@ -1131,6 +1156,30 @@ def get_addons_info(*args, **kwargs):
1131
1156
  return con.get_addons_info(*args, **kwargs)
1132
1157
 
1133
1158
 
1159
+ def get_addon_endpoint(*args, **kwargs):
1160
+ """Calculate endpoint to addon route.
1161
+
1162
+ Examples:
1163
+
1164
+ >>> api = ServerAPI("https://your.url.com")
1165
+ >>> api.get_addon_url(
1166
+ ... "example", "1.0.0", "private", "my.zip")
1167
+ 'addons/example/1.0.0/private/my.zip'
1168
+
1169
+ Args:
1170
+ addon_name (str): Name of addon.
1171
+ addon_version (str): Version of addon.
1172
+ *subpaths (str): Any amount of subpaths that are added to
1173
+ addon url.
1174
+
1175
+ Returns:
1176
+ str: Final url.
1177
+
1178
+ """
1179
+ con = get_server_api_connection()
1180
+ return con.get_addon_endpoint(*args, **kwargs)
1181
+
1182
+
1134
1183
  def get_addon_url(*args, **kwargs):
1135
1184
  """Calculate url to addon route.
1136
1185
 
@@ -1139,13 +1188,14 @@ def get_addon_url(*args, **kwargs):
1139
1188
  >>> api = ServerAPI("https://your.url.com")
1140
1189
  >>> api.get_addon_url(
1141
1190
  ... "example", "1.0.0", "private", "my.zip")
1142
- 'https://your.url.com/addons/example/1.0.0/private/my.zip'
1191
+ 'https://your.url.com/api/addons/example/1.0.0/private/my.zip'
1143
1192
 
1144
1193
  Args:
1145
1194
  addon_name (str): Name of addon.
1146
1195
  addon_version (str): Version of addon.
1147
1196
  *subpaths (str): Any amount of subpaths that are added to
1148
1197
  addon url.
1198
+ use_rest (Optional[bool]): Use rest endpoint.
1149
1199
 
1150
1200
  Returns:
1151
1201
  str: Final url.
@@ -1480,7 +1530,23 @@ def create_bundle(*args, **kwargs):
1480
1530
  """Create bundle on server.
1481
1531
 
1482
1532
  Bundle cannot be changed once is created. Only isProduction, isStaging
1483
- and dependency packages can change after creation.
1533
+ and dependency packages can change after creation. In case dev bundle
1534
+ is created, it is possible to change anything, but it is not possible
1535
+ to mark bundle as dev and production or staging at the same time.
1536
+
1537
+ Development addon config can define custom path to client code. It is
1538
+ used only for dev bundles.
1539
+
1540
+ Example of 'dev_addons_config'::
1541
+
1542
+ ```json
1543
+ {
1544
+ "core": {
1545
+ "enabled": true,
1546
+ "path": "/path/to/ayon-core/client"
1547
+ }
1548
+ }
1549
+ ```
1484
1550
 
1485
1551
  Args:
1486
1552
  name (str): Name of bundle.
@@ -1492,6 +1558,11 @@ def create_bundle(*args, **kwargs):
1492
1558
  is_production (Optional[bool]): Bundle will be marked as
1493
1559
  production.
1494
1560
  is_staging (Optional[bool]): Bundle will be marked as staging.
1561
+ is_dev (Optional[bool]): Bundle will be marked as dev.
1562
+ dev_active_user (Optional[str]): Username that will be assigned
1563
+ to dev bundle. Can be used only if 'is_dev' is set to 'True'.
1564
+ dev_addons_config (Optional[dict[str, Any]]): Configuration for
1565
+ dev addons. Can be used only if 'is_dev' is set to 'True'.
1495
1566
 
1496
1567
  """
1497
1568
  con = get_server_api_connection()
@@ -1507,17 +1578,55 @@ def update_bundle(*args, **kwargs):
1507
1578
 
1508
1579
  Args:
1509
1580
  bundle_name (str): Name of bundle.
1581
+ addon_versions (Optional[dict[str, str]]): Addon versions,
1582
+ possible only for dev bundles.
1583
+ installer_version (Optional[str]): Installer version, possible
1584
+ only for dev bundles.
1510
1585
  dependency_packages (Optional[dict[str, str]]): Dependency pacakge
1511
1586
  names that should be used with the bundle.
1512
1587
  is_production (Optional[bool]): Bundle will be marked as
1513
1588
  production.
1514
1589
  is_staging (Optional[bool]): Bundle will be marked as staging.
1590
+ is_dev (Optional[bool]): Bundle will be marked as dev.
1591
+ dev_active_user (Optional[str]): Username that will be assigned
1592
+ to dev bundle. Can be used only for dev bundles.
1593
+ dev_addons_config (Optional[dict[str, Any]]): Configuration for
1594
+ dev addons. Can be used only for dev bundles.
1515
1595
 
1516
1596
  """
1517
1597
  con = get_server_api_connection()
1518
1598
  return con.update_bundle(*args, **kwargs)
1519
1599
 
1520
1600
 
1601
+ def check_bundle_compatibility(*args, **kwargs):
1602
+ """Check bundle compatibility.
1603
+
1604
+ Can be used as per-flight validation before creating bundle.
1605
+
1606
+ Args:
1607
+ name (str): Name of bundle.
1608
+ addon_versions (dict[str, str]): Addon versions.
1609
+ installer_version (Union[str, None]): Installer version.
1610
+ dependency_packages (Optional[dict[str, str]]): Dependency
1611
+ package names. Keys are platform names and values are name of
1612
+ packages.
1613
+ is_production (Optional[bool]): Bundle will be marked as
1614
+ production.
1615
+ is_staging (Optional[bool]): Bundle will be marked as staging.
1616
+ is_dev (Optional[bool]): Bundle will be marked as dev.
1617
+ dev_active_user (Optional[str]): Username that will be assigned
1618
+ to dev bundle. Can be used only if 'is_dev' is set to 'True'.
1619
+ dev_addons_config (Optional[dict[str, Any]]): Configuration for
1620
+ dev addons. Can be used only if 'is_dev' is set to 'True'.
1621
+
1622
+ Returns:
1623
+ Dict[str, Any]: Server response, with 'success' and 'issues'.
1624
+
1625
+ """
1626
+ con = get_server_api_connection()
1627
+ return con.check_bundle_compatibility(*args, **kwargs)
1628
+
1629
+
1521
1630
  def delete_bundle(*args, **kwargs):
1522
1631
  """Delete bundle from server.
1523
1632
 
@@ -2343,8 +2452,8 @@ def get_folders(*args, **kwargs):
2343
2452
  """Query folders from server.
2344
2453
 
2345
2454
  Todos:
2346
- Folder name won't be unique identifier, so we should add folder path
2347
- filtering.
2455
+ Folder name won't be unique identifier, so we should add
2456
+ folder path filtering.
2348
2457
 
2349
2458
  Notes:
2350
2459
  Filter 'active' don't have direct filter in GraphQl.
@@ -2370,6 +2479,8 @@ def get_folders(*args, **kwargs):
2370
2479
  children. Ignored when None, default behavior.
2371
2480
  statuses (Optional[Iterable[str]]): Folder statuses used
2372
2481
  for filtering.
2482
+ assignees_all (Optional[Iterable[str]]): Filter by assigness
2483
+ on children tasks. Task must have all of passed assignees.
2373
2484
  tags (Optional[Iterable[str]]): Folder tags used
2374
2485
  for filtering.
2375
2486
  active (Optional[bool]): Filter active/inactive folders.
@@ -2992,10 +3103,12 @@ def get_versions(*args, **kwargs):
2992
3103
  version filtering.
2993
3104
  product_ids (Optional[Iterable[str]]): Product ids used for
2994
3105
  version filtering.
3106
+ task_ids (Optional[Iterable[str]]): Task ids used for
3107
+ version filtering.
2995
3108
  versions (Optional[Iterable[int]]): Versions we're interested in.
2996
- hero (Optional[bool]): Receive also hero versions when set to true.
2997
- standard (Optional[bool]): Receive versions which are not hero when
2998
- set to true.
3109
+ hero (Optional[bool]): Skip hero versions when set to False.
3110
+ standard (Optional[bool]): Skip standard (non-hero) when
3111
+ set to False.
2999
3112
  latest (Optional[bool]): Return only latest version of standard
3000
3113
  versions. This can be combined only with 'standard' attribute
3001
3114
  set to True.
@@ -3250,6 +3363,7 @@ def update_version(*args, **kwargs):
3250
3363
  version (Optional[int]): New version.
3251
3364
  product_id (Optional[str]): New product id.
3252
3365
  task_id (Optional[Union[str, None]]): New task id.
3366
+ author (Optional[str]): New author username.
3253
3367
  attrib (Optional[dict[str, Any]]): New attributes.
3254
3368
  data (Optional[dict[str, Any]]): New data.
3255
3369
  tags (Optional[Iterable[str]]): New tags.
@@ -3277,9 +3391,10 @@ def delete_version(*args, **kwargs):
3277
3391
  def get_representations(*args, **kwargs):
3278
3392
  """Get representation entities based on passed filters from server.
3279
3393
 
3280
- Todos:
3394
+ .. todo::
3395
+
3281
3396
  Add separated function for 'names_by_version_ids' filtering.
3282
- Because can't be combined with others.
3397
+ Because can't be combined with others.
3283
3398
 
3284
3399
  Args:
3285
3400
  project_name (str): Name of project where to look for versions.
@@ -3289,7 +3404,7 @@ def get_representations(*args, **kwargs):
3289
3404
  names used for representation filtering.
3290
3405
  version_ids (Optional[Iterable[str]]): Version ids used for
3291
3406
  representation filtering. Versions are parents of
3292
- representations.
3407
+ representations.
3293
3408
  names_by_version_ids (Optional[bool]): Find representations
3294
3409
  by names and version ids. This filter discard all
3295
3410
  other filters.
@@ -4028,7 +4143,10 @@ def delete_link(*args, **kwargs):
4028
4143
  def get_entities_links(*args, **kwargs):
4029
4144
  """Helper method to get links from server for entity types.
4030
4145
 
4031
- Example output::
4146
+ .. highlight:: text
4147
+ .. code-block:: text
4148
+
4149
+ Example output:
4032
4150
  {
4033
4151
  "59a212c0d2e211eda0e20242ac120001": [
4034
4152
  {
@@ -4049,12 +4167,12 @@ def get_entities_links(*args, **kwargs):
4049
4167
  Args:
4050
4168
  project_name (str): Project where links are.
4051
4169
  entity_type (Literal["folder", "task", "product",
4052
- "version", "representations"]): Entity type.
4170
+ | "version", "representations"]): Entity type.
4053
4171
  entity_ids (Optional[Iterable[str]]): Ids of entities for which
4054
- links should be received.
4172
+ | links should be received.
4055
4173
  link_types (Optional[Iterable[str]]): Link type filters.
4056
4174
  link_direction (Optional[Literal["in", "out"]]): Link direction
4057
- filter.
4175
+ | filter.
4058
4176
  link_names (Optional[Iterable[str]]): Link name filters.
4059
4177
  link_name_regex (Optional[str]): Regex filter for link name.
4060
4178