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

Let plugins choose the priority order of their events #2973

Merged
merged 1 commit into from Sep 14, 2022
Merged

Let plugins choose the priority order of their events #2973

merged 1 commit into from Sep 14, 2022

Conversation

oprypin
Copy link
Contributor

@oprypin oprypin commented Sep 11, 2022

Add a decorator that sets a priority value for plugins' events.
Events with higher priority are called first.
Events without a chosen priority get a default of 0.
Events that have the same priority are ordered as they appear in the config.

Recommended priority values:
100 "first", 50 "early", 0 "default", -50 "late", -100 "last".
As different plugins discover more precise relations to each other, the values should be further tweaked.

@plugins.event_priority(-100)  # Wishing to run this after all other plugins' `on_files` events.
def on_files(self, files, config, **kwargs):
    ...

Add a decorator that sets a priority value for plugins' events. Events with higher priority are called first. Events without a chosen priority get a default of 0. Events that have the same priority are ordered as they appear in the config.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant