Repository navigation
Conversation
Cover REST endpoints of server 1.16.8 that had no wrapper: - Users: create/update/delete/rename user, password, access groups, sessions, api keys, permissions; access groups; teams; project users. - Addon settings: set studio/project settings, studio/project overrides and raw overrides, site settings, settings migration. - Projects: anatomy presets management, project anatomy, rename, stats, tags, project bundle, root overrides, entity URIs, URI resolve, project file info; folder search and entity grouping. - Services, hosts, sites, restart required, server config schema and patch, enums, bulk event delete. - Reviewables listing/sorting/update, task assignment, entity list materialize/order, entity and project thumbnails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Raise 'UnsupportedServerVersion' when a method uses an endpoint or argument that is not available on the connected server: - 1.15.0: rename_project, get_project_thumbnail, set_project_thumbnail, set_project_thumbnail_from_stream - 1.15.4: 'search' argument of search_folders - 1.15.9: update_server_config, set_entity_list_items_order - 1.16.4: get_enums, get_reviewables, 'latest' and 'latest_done' arguments of entity reviewables getters - 1.16.7: 'error' argument of update_service - 1.16.8: migrate_addon_settings rename_user uses the deprecated PATCH endpoint on servers older than 1.15.0 instead of failing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tests for users, access groups, teams, addon settings, projects, anatomy presets, folders search, thumbnails, services, sites, system, events deletion, reviewables, task assignment and entity lists run against a real AYON server, like the other server tests. Server version validation is tested without a server. Fixes found while writing the tests: - 'delete_events' refuses a filter without conditions, which would delete all events. - Settings, overrides, anatomy, roots, access group and server config payloads are sent as JSON body instead of keyword arguments, so any key name works. - 'set_project_thumbnail' and 'set_project_thumbnail_from_stream' return thumbnail id like entity thumbnail setters. - Docstrings of 'set_project_root_overrides' and 'get_version_reviewables'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@tadeas-hejnic can you test this - and review this if the code and API makes sense to you? @MustafaJafar any question on some of these from docs standpoint? |
In future more entity types might support thumbnails using the same endpoint format. It is also private method there is no reason validate it.
Not at all, thank you for the heads up. fyi, the python api docs are simply generated and deployed on release. Also, I'm considering visiting the docs generation setup for this repo to make it on par with the other docs (either switch to mk docs, or simply keep the current while updating the theme). |
I did this #367 because poetry was broken in some of the newer PRs. |
Replace pairs of studio and project methods with single methods that take optional 'project_name', like 'get_addon_settings': - set_addon_settings - get_addon_overrides - modify_addon_overrides - delete_addon_overrides - get_addon_raw_overrides - set_addon_raw_overrides Passing 'site_id' without 'project_name' raises 'ValueError', as studio settings do not have site overrides. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Restore studio and project specific methods and make the merged methods call them based on 'project_name', same as 'get_addon_settings' calls 'get_addon_studio_settings' or 'get_addon_project_settings'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| def test_set_addon_settings_studio_explicit_pin( | ||
| settings_addon, studio_variant | ||
| ): | ||
| """Unchanged value is stored when pinned with '__pinned_fields__'.""" | ||
| name = settings_addon["name"] | ||
| version = settings_addon["version"] | ||
| path = settings_addon["path"] | ||
|
|
||
| settings = get_addon_studio_settings(name, version, variant=studio_variant) | ||
| value = _get_value(settings, path) | ||
| payload = copy.deepcopy(settings) | ||
| payload["__pinned_fields__"] = [path] | ||
| set_addon_settings(name, version, payload, variant=studio_variant) | ||
|
|
||
| raw = get_addon_raw_overrides(name, version, variant=studio_variant) | ||
| assert _get_value(raw, path) is value |
There was a problem hiding this comment.
This test is failing on my side, because raw = {}, so the assert can't be passed.
But it's probably backend issue, because extract_overrides() can't go deeper in recursion for explicit_pins - https://github.com/ynput/ayon-backend/blob/develop/ayon_server/settings/overrides.py#L212-L231
There should be probably added something like:
def has_pin_below(path):
return any(
pin[:len(path)] == path
for pin in explicit_pins
)
to the condition before the recursive call.
There was a problem hiding this comment.
Tested on my side with this change and at least this test has passed and looks like it didn't break anything.
There was a problem hiding this comment.
I will probably remove the test. It is kinda pointless. This does test if pinning works but without a known addon you can't test it reliable.
There was a problem hiding this comment.
Or maybe just fix it in server? Made a PR ynput/ayon-backend#1208 with that we can keep the test.
There was a problem hiding this comment.
I'd say bug on server should not block this PR. If yes, then I'll remove the test...
Entity type of 'set_entity_thumbnail' is no longer validated on client side, setting thumbnail on product fails on server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Task search matches also folder path of the task, so folder name finds the folder through its task. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Changelog Description
Added methods for AYON server 1.16.8 REST endpoints that had no wrapper in the python api.
Additional info
Every route in server 1.16.8 was compared with the endpoints the api calls. Payloads and query params were checked against the server request models.
New helper classes (added to
ServerAPIandautomated_api.py):UsersAPI,ServicesAPI,SystemAPI,ReviewablesAPI.set_projects_access. Teams and team members. Project users.set_addon_settings,get_addon_overrides,modify_addon_overrides,delete_addon_overrides,get_addon_raw_overrides,set_addon_raw_overrides(call the studio or project specific method, e.g.set_addon_studio_settingsorset_addon_project_settings, based onproject_name),set_addon_site_settings,migrate_addon_settings,migrate_settings_by_bundle.get_addon_settings_schematakes optionalvariantandsite_id.rename_project, project stats and tags, project bundle (get, set, unset),set_project_root_overrides,get_project_entity_uris,resolve_uris,get_project_file_info.search_folders,get_entity_groups.update_server_config(PATCH), enums.delete_eventsthrougheventops. An empty filter deletes all events on the server side.assign_users_to_task, entity list materialize and items order, entity and project thumbnail upload,get_project_thumbnail._api.pyand__init__.pywere regenerated withautomated_api.py. The_api.pydiff only adds lines; plaingit diffshows it as moved because of the diff algorithm.Not added on purpose: endpoints used only by the web UI (onboarding, Ynput Cloud connect, metrics, csv import and export, avatars, password reset, views, frontend preferences, market) and deprecated routes.
Server version requirements
Endpoints and arguments were compared between server 1.14.5 (the last 1.14.x) and 1.16.8. The ones added later raise
UnsupportedServerVersionon older servers:rename_project,get_project_thumbnail,set_project_thumbnail,set_project_thumbnail_from_streamsearchargument ofsearch_foldersupdate_server_config,set_entity_list_items_orderget_enums,get_reviewables,latestandlatest_doneof the entity reviewables getterserrorargument ofupdate_servicemigrate_addon_settingsOn servers older than 1.15.0,
rename_useruses the deprecated PATCH endpoint instead of failing. TheregistryAuthservice config key (1.16.7) is only documented, because older servers ignore unknown config keys.Testing notes:
New tests run against a real AYON server, like the other server tests (
AYON_SERVER_URLandAYON_API_KEYof an admin user). They create only temporary users, access groups, projects, sites and events, and remove them afterwards. Studio-level addon settings are written to a temporary settings variant.tests/test_users_api.py,tests/test_addon_settings_api.py,tests/test_projects_api.py,tests/test_system_api.py,tests/test_review_tasks_lists_api.pytests/test_server_version_validation.pychecks the version validation and needs no server.AYON_SERVER_URLandAYON_API_KEY.pytest tests/test_users_api.py tests/test_addon_settings_api.py tests/test_projects_api.py tests/test_system_api.py tests/test_review_tasks_lists_api.py tests/test_server_version_validation.py.🤖 Generated with Claude Code