-
Notifications
You must be signed in to change notification settings - Fork 582
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
Create system for plugin modules to tie into specified hooks #29
Comments
Merged
Refactoring issue to be more specific, now that #61 has covered some of the original scope. |
ewels
changed the title
Get each module to return a dict, trigger a hook
Create system for plugin modules to tie into specified hooks
Oct 13, 2015
A load of pseudocode to pen down roughly how I see this working: Plugin setuptools code: entry_points = {
'multiqc.hooks.v1': 'mypluginhooks = myplugin.hooks'
} Then in def hooks(trigger):
return triggers.get(trigger, None)
triggers = {
'click' : click_trigger,
'modules_start': modules_start_trigger,
'modules_end': modules_end_trigger
}
def click_trigger():
""" Could add some extra click arguments here """
pass
def modules_start_trigger():
""" Runs before modules start """
pass
def modules_end_trigger():
""" Runs when modules finish """
pass Finally, in multiqc: # Load the hooks
hook_functions = []
for entry_point in pkg_resources.iter_entry_points('multiqc.hooks.v1'):
hook_functions.append(entry_point.load())
# Function to run the hooks
def multiqc_trigger(trigger):
for h in hook_functions:
h(trigger)
# .. do some stuff, trigger the hook ..
multiqc_trigger('modules_end') |
ewels
added a commit
that referenced
this issue
Oct 22, 2015
ewels
added a commit
that referenced
this issue
Oct 22, 2015
Merged
alexiswl
pushed a commit
to alexiswl/MultiQC
that referenced
this issue
Aug 15, 2022
* Add scATAC metrics * missing file * Update search_patterns.yaml Co-authored-by: Lee <slee2@illumina.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could create another setuptools entrypoints class (
multiqc.hooks.v1
?) that could create a list of functions to run at different points in the code.The text was updated successfully, but these errors were encountered: