Skip to content

Server addon api: Methods to get available apps and tools#151

Merged
iLLiCiTiT merged 8 commits into
developfrom
enhancement/api-to-get-available-apps-and-tools
May 15, 2026
Merged

Server addon api: Methods to get available apps and tools#151
iLLiCiTiT merged 8 commits into
developfrom
enhancement/api-to-get-available-apps-and-tools

Conversation

@iLLiCiTiT
Copy link
Copy Markdown
Member

Changelog Description

Proposal to be able to get apps and tools available for the addon versoin.

Additional review information

Added 5 new public methods to the addon. Methods get_application_items and get_tool_items to get the items for the version of the addon. Helper method get_addon_for_context to get application addon version object for passed context based on project and variant. And methods get_applications_for_context and get_tools_for_context which will find addon version based on the context and call get_application_items or get_tool_items on them -> that will start to work from this version onwards.

It is not really possible to support older versions as there is no way to access their code if is not part of addon classes. Without this we won't be able to do that even in future, so sooner this is merged the earlier we're able to use it.

The idea is that this can be used by other addons e.g. in settings or action forms.

Testing notes:

Validate code changes.

It should be possible to get available tools and applications from other addons.

@iLLiCiTiT iLLiCiTiT requested a review from BigRoy May 12, 2026 14:28
@iLLiCiTiT iLLiCiTiT self-assigned this May 12, 2026
@iLLiCiTiT iLLiCiTiT added community Issues and PRs coming from the community members type: feature Adding something new and exciting to the product labels May 12, 2026
@BigRoy
Copy link
Copy Markdown
Member

BigRoy commented May 14, 2026

The idea is that this can be used by other addons e.g. in settings or action forms.

Can you give example code on how one would do that? Does one just import ayon_applications from the other addons? 🤔

@iLLiCiTiT
Copy link
Copy Markdown
Member Author

iLLiCiTiT commented May 14, 2026

Does one just import ayon_applications from the other addons?

Not on server. You have to know version of an addon and use addons library to get the addon. You can't simply import functions from other addons server side.

Can you give example code on how one would do that?

E.g. rv selection (I think) in review addon has to know structure of settings to be able to show selection of rv available. Another use-case would be enum in core for OCIO app names, which is not possible right now. It can be possible with this.

@BigRoy
Copy link
Copy Markdown
Member

BigRoy commented May 14, 2026

E.g. rv selection (I think) in review addon has to know structure of settings to be able to show selection of rv available. Another use-case would be enum in core for OCIO app names, which is not possible right now. It can be possible with this.

I understand the use cases, I was asking what the code would look like. ;) How does one do this from e.g. the RV addon server-side?

@iLLiCiTiT
Copy link
Copy Markdown
Member Author

The desktop review now reads applications addon settings, instead it could do this.

library = AddonLibrary.getinstance()
addons_by_name = await library.get_addons_by_variant(
    self.settings_variant
)
addon = addons_by_name.get("applications")
if hasattr(addon, "get_application_items"):
    return [
        {
                "value": item.full_name,
                "label": item.full_label,
        }
        for item in addon.get_application_items()
        if item.full_name.startswith("openrv/")
    ]

# Otherwise use the previous logic
...

@iLLiCiTiT
Copy link
Copy Markdown
Member Author

NOTE Also added get_applications_settings_enum which has example in docstring.

Copy link
Copy Markdown
Member

@BigRoy BigRoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The enum seems to work. Tested in: ynput/ayon-usd#124

The example however in the docstring for the apps enum resolver however is incorrect.

Also, I ended up using app_addons.latest instead of iterating the versions so that it'd always call the method from the latest app addons version.

Comment thread server/addon.py Outdated
Comment thread server/addon.py Outdated
@iLLiCiTiT iLLiCiTiT merged commit 31ab0a4 into develop May 15, 2026
1 check passed
@iLLiCiTiT iLLiCiTiT deleted the enhancement/api-to-get-available-apps-and-tools branch May 15, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Issues and PRs coming from the community members type: feature Adding something new and exciting to the product

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants