Package: python-hookman
HookmanThis documentation covers HookMan usage & API.For information about HookMan,  read the section above. For public changelog and how the project is maintained, please check theGitHub pageWhat is HookMan?HookManis a python package that provides a plugin management system to applications,
specially those who are written (in totally or partially) in C++.It enables external contributors to implement plugins which act as extensions written in C/C++
that interact with the application through well-definedhooks.This system was largely inspired bypluggy,
the plugin system which powerspytest,tox, anddevpi, but with the intent to be called
from a C++ application rather than from Python.It was conceived to facilitate the application development, allowing hooks to be exposed in a
clear way and allowing plugins to be developed without access to classes or data from the application.WithHookManyour application can have access to the hooks implemented on plugins as simple as the example below.# Initializing a classhm=HookMan(specs=acme_specs,plugin_dirs=['path1','path2'])hook_caller=hm.get_hook_caller()# Getting access to the hook implementationfriction_factor=hook_caller.friction_factor()env_temperature=hook_caller.env_temperature()# Checking if the hook was implementedassertfriction_factorisnotNoneassertenv_temperatureisNone# Executing the hook, wherever it is implemented either in plugin A or B.ff_result=friction_factor(1,2.5)env_tmp_result=env_temperature(35.5,45.5)How does it work?In order to useHookManin your application, it is necessary to inform whichHooksare available to be implemented through a configuration object.With this configuration defined, users can create plugins that implement availableHooksextending the behavior of your application.All plugins informed to your application will be validated by HookMan (to check which hooks are implemented),
and an object holding a reference to theHookswill be passed to the application.TheHookManproject uses the librarypybind11to interact between Python and C/C++,
allowing a straightforward usage for who is calling the function (either in Python or in C++).Defining some terminologies:Application⇨  The program that offers the extensions.Hook⇨  An extension of the Application.Plugin⇨  The program that implements theHooks.User⇨  The person who installed the application.Read the docs to learn more!Documentation:https://hookman.readthedocs.io.Free software: MIT licenseCreditsThanks forpluggy,  which is a similar project (plugin system) and source for many ideas.This package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.5.0 (2023-02-10)Allow to add some extra text to created hmplugin file.0.4.0 (2020-10-23)When removing plugins they are first moved to a.trashdir and not directly deleted.Allow HookManager to call hooks of a specific plugin.0.3.0 (2019-12-16)Rename the parameterdst_pathtodest_pathoninstall_pluginmethod.install_pluginnow returns the name of the plugin when the installation is successful.Now the library path dir is added toPATHenvironment variable before load the library (Only on Windows).Added an optional “extras” entry to plugin definition yaml:“extras” is a dictionary for adding (key, value) customized options, accessible inPluginInfo.extras;Plugin generation accepts a dict of default (key, value) pairs to be added toextras;0.2.0 (2019-02-08)Moved load hook function code toHookCaller.load_impls_from_libraryfunction implemented in C++. This
enables using hook functionality in projects which don’t use Python as their entry point.HookSpecsnow accepts anextra_includesargument, which can be used to add custom#includedirectives
to the generatedHookCaller.hppfile.HookCallernow contains astd::vectorof functions bound to plugin implementations. This allows multiple
plugins to implement the same hook; how the results of each call is to behave is responsibility of the caller.Because of this, the following classes/methods have been removed because they are no longer relevant:ConflictBetweenPluginsErrorConflictStatusHookMan.ensure_is_validHookMan.get_statusGenerated files now sport a “do not modify” comment header.Generation of the bindings code forHookCalleris skipped ifspecs.pyd_nameis not defined.Code generation is now available directly in the command-line through the commands:python-mhookmangenerate-plugin-templatepython-mhookmangenerate-project-filespython-mhookmangenerate-hook-specs-hpython-mhookmanpackage-pluginExplicitly declareextern "C"calling convention in thehook_specs.hfile.TheINIT_HOOKSmacro has been removed as it didn’t have any useful function.0.1.7 (2018-08-23)First Release on PyPI.0.1.6 (2018-08-23)Never released, deployment error.0.1.5 (2018-08-23)Never released, deployment error.0.1.4 (2018-08-23)Never released, deployment error.0.1.3 (2018-08-23)Never released, deployment error.0.1.2 (2018-08-23)Never released, deployment error.0.1.1 (2018-08-23)Never released, deployment error.Dropping bumperversion and using setuptool_scm0.1.0 (2018-08-23)Never released, deployment error.