Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Allow plugins as Python modules #537

Closed
3 tasks done
Jan200101 opened this issue Sep 11, 2023 · 8 comments
Closed
3 tasks done

[Request] Allow plugins as Python modules #537

Jan200101 opened this issue Sep 11, 2023 · 8 comments
Labels
feature request a request for a feature, no guarantee of addition

Comments

@Jan200101
Copy link
Contributor

Please confirm

  • I have searched existing issues
  • This issue is not a duplicate of an existing one
  • This is not a request for a plugin

Feature Request Description

Decky Plugins should also be usable as a python module

Further Description

Right now plugins are mainly loaded via a main.py
A module would allow proper encapsulation of the code as well as allow specifying relevant information in multiple ways that are query able through official means (the pkg_resources library).

Modules would also allow the creation of wheels, which can be used to bundle dependencies of various kind.

@Jan200101 Jan200101 added the feature request a request for a feature, no guarantee of addition label Sep 11, 2023
@KP2048
Copy link
Contributor

KP2048 commented Sep 11, 2023

What would also be useful is to tell decky to just start and stop a binary, as I mainly just have a native backend and use websockets to communicate. This would completely eliminate the need for a python file in general if you don't want one

@KP2048
Copy link
Contributor

KP2048 commented Sep 11, 2023

But yes op makes a good point and is a better plan than the current py_modules thing

@KP2048
Copy link
Contributor

KP2048 commented Sep 11, 2023

It seems for module backends, all that really needs changing is this line here
https://github.com/SteamDeckHomebrew/decky-loader/blob/main/backend/loader.py#L159
To fall back to main instead of main.py if main.py doesn't exist

@KP2048
Copy link
Contributor

KP2048 commented Sep 11, 2023

Well, depending on how importlib handles things it may need to be the __init__.py

@Jan200101
Copy link
Contributor Author

Importlib handles it like the core import
So when importing a module e.g. main/ you need main/init.py (edit sniped, damn)

The module name could be made configurable but one step at a time

@KP2048
Copy link
Contributor

KP2048 commented Sep 11, 2023

Yeah, that line seems to be the only change really needed

@KP2048
Copy link
Contributor

KP2048 commented Sep 11, 2023

Feel free to pr if you like

@Jan200101
Copy link
Contributor Author

Enough feedback on the Discord has convinced me that this isn't worthwhile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request a request for a feature, no guarantee of addition
Projects
None yet
Development

No branches or pull requests

2 participants