Skip to main content

Hookman

https://img.shields.io/pypi/v/python-hookman.svg https://img.shields.io/conda/vn/conda-forge/python-hookman.svg https://img.shields.io/pypi/pyversions/python-hookman.svg https://codecov.io/gh/ESSS/hookman/branch/master/graph/badge.svg https://github.com/ESSS/hookman/workflows/Hookman%20-%20CI/badge.svg Documentation Status

This documentation covers HookMan usage & API.

For information about HookMan, read the section above. For public changelog and how the project is maintained, please check the GitHub page

What is HookMan?

HookMan is 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-defined hooks.

This system was largely inspired by pluggy, the plugin system which powers pytest, tox, and devpi, 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.

With HookMan your application can have access to the hooks implemented on plugins as simple as the example below.

# Initializing a class
hm = HookMan(specs=acme_specs, plugin_dirs=['path1','path2'])

hook_caller = hm.get_hook_caller()

# Getting access to the hook implementation
friction_factor = hook_caller.friction_factor()
env_temperature = hook_caller.env_temperature()

# Checking if the hook was implemented
assert friction_factor is not None
assert env_temperature is None

# 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 use HookMan in your application, it is necessary to inform which Hooks are available to be implemented through a configuration object.

With this configuration defined, users can create plugins that implement available Hooks extending 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 the Hooks will be passed to the application.

The HookMan project uses the library pybind11 to 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 the Hooks.

  • User ⇨ The person who installed the application.

Read the docs to learn more!

Credits

Thanks for pluggy, which is a similar project (plugin system) and source for many ideas.

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.8.0 (2025-08-18)

  • Allow install multiple versions of the same plugin.

0.7.0 (2025-06-10)

  • Add a new requirements property which allows specifying any additional requirements for plugins.

  • Add support for packaging Linux libraries with version suffixes (e.g. libhookman.so.1.0.0).

0.6.0 (2025-02-28)

  • Dropped support for old Python versions, requiring Python 3.10+.

  • Add CHANGELOG.rst to plugin generator

0.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 .trash dir and not directly deleted.

  • Allow HookManager to call hooks of a specific plugin.

0.3.0 (2019-12-16)

  • Rename the parameter dst_path to dest_path on install_plugin method.

  • install_plugin now returns the name of the plugin when the installation is successful.

  • Now the library path dir is added to PATH environment 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 in PluginInfo.extras;

    • Plugin generation accepts a dict of default (key, value) pairs to be added to extras;

0.2.0 (2019-02-08)

  • Moved load hook function code to HookCaller.load_impls_from_library function implemented in C++. This enables using hook functionality in projects which don’t use Python as their entry point.

  • HookSpecs now accepts an extra_includes argument, which can be used to add custom #include directives to the generated HookCaller.hpp file.

  • HookCaller now contains a std::vector of 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:

    • ConflictBetweenPluginsError

    • ConflictStatus

    • HookMan.ensure_is_valid

    • HookMan.get_status

  • Generated files now sport a “do not modify” comment header.

  • Generation of the bindings code for HookCaller is skipped if specs.pyd_name is not defined.

  • Code generation is now available directly in the command-line through the commands:

    • python -m hookman generate-plugin-template

    • python -m hookman generate-project-files

    • python -m hookman generate-hook-specs-h

    • python -m hookman package-plugin

  • Explicitly declare extern "C" calling convention in the hook_specs.h file.

  • The INIT_HOOKS macro 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_scm

0.1.0 (2018-08-23)

  • Never released, deployment error.

Release files for python-hookman 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-hookman 0.8.0
File Size Uploaded
python_hookman-0.8.0.tar.gz 54.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-hookman 0.8.0
File Interpreter ABI Platform
python_hookman-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 77.9 kB

Release files / python_hookman-0.8.0.tar.gz

Download URL python_hookman-0.8.0.tar.gz
Size 54.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d848025222e4fe48542c2f2b4e3064a12f2de6da62f9688d13ea1d3fc512aba0
BLAKE2b-256 checksum
How to use checksums
0fd4f355d111ac12625eee587035dc07e81074a38833b6d0328f95168ca644c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2025.

Transparency log

Release files / python_hookman-0.8.0-py3-none-any.whl

Download URL python_hookman-0.8.0-py3-none-any.whl
Size 23.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7bb48807a5e5d516914ffe2cc244facc7c94e08886735d556523ed7e31e35ef6
BLAKE2b-256 checksum
How to use checksums
c45030108fad57026738dd914b2c2f372571febc11b4ecc4bf77605376df421f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.2.0

2 release files

0.1.7

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page