Name | python-hookman JSON |
Version |
0.5.0
JSON |
| download |
home_page | https://github.com/esss/hookman |
Summary | HookMan is a python package that provides a plugin management system to applications, specially those who are written (in totally or partially) in C++. |
upload_time | 2023-02-10 14:19:47 |
maintainer | |
docs_url | None |
author | ESSS |
requires_python | |
license | MIT license |
keywords |
hookman
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
=======
Hookman
=======
.. image:: https://img.shields.io/pypi/v/python-hookman.svg
:target: https://pypi.python.org/pypi/python-hookman
.. image:: https://img.shields.io/conda/vn/conda-forge/python-hookman.svg
:target: https://anaconda.org/conda-forge/python-hookman
.. image:: https://img.shields.io/pypi/pyversions/python-hookman.svg
:target: https://pypi.org/project/python-hookman
.. image:: https://codecov.io/gh/ESSS/hookman/branch/master/graph/badge.svg
:target: https://codecov.io/gh/ESSS/hookman
.. image:: https://github.com/ESSS/hookman/workflows/Hookman%20-%20CI/badge.svg
:target: https://github.com/ESSS/hookman/actions
.. image:: https://readthedocs.org/projects/hookman/badge/?version=latest
:target: https://hookman.readthedocs.io/en/latest/?badge=latest
:alt: 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.
.. code-block:: python
# 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!`_
* Documentation: https://hookman.readthedocs.io.
* Free software: MIT license
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.
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
.. _`GitHub page` : https://github.com/ESSS/hookman
.. _`read the docs to learn more!` : https://hookman.readthedocs.io
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _devpi: https://github.com/devpi/devpi
.. _pluggy: https://github.com/pytest-dev/pluggy
.. _pybind11: https://github.com/pybind/pybind11
.. _pytest: https://github.com/pytest-dev/pytest
.. _tox: https://github.com/tox-dev/tox
=======
History
=======
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/esss/hookman",
"name": "python-hookman",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "hookman",
"author": "ESSS",
"author_email": "foss@esss.co",
"download_url": "https://files.pythonhosted.org/packages/c0/7d/7b8ea79998e0a540c2f97ef62041b8e6d666a5718d2e06f99e2d6eafe8fe/python-hookman-0.5.0.tar.gz",
"platform": null,
"description": "=======\nHookman\n=======\n\n.. image:: https://img.shields.io/pypi/v/python-hookman.svg\n :target: https://pypi.python.org/pypi/python-hookman\n\n.. image:: https://img.shields.io/conda/vn/conda-forge/python-hookman.svg\n :target: https://anaconda.org/conda-forge/python-hookman\n\n.. image:: https://img.shields.io/pypi/pyversions/python-hookman.svg\n :target: https://pypi.org/project/python-hookman\n\n.. image:: https://codecov.io/gh/ESSS/hookman/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/ESSS/hookman\n\n.. image:: https://github.com/ESSS/hookman/workflows/Hookman%20-%20CI/badge.svg\n :target: https://github.com/ESSS/hookman/actions\n\n.. image:: https://readthedocs.org/projects/hookman/badge/?version=latest\n :target: https://hookman.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\n\nThis documentation covers HookMan usage & API.\n\nFor information about HookMan, read the section above. For public changelog and how the project is maintained, please check the `GitHub page`_\n\nWhat is HookMan?\n================\n\n``HookMan`` is a python package that provides a plugin management system to applications,\nspecially those who are written (in totally or partially) in C++.\n\nIt enables external contributors to implement plugins which act as extensions written in C/C++\nthat interact with the application through well-defined *hooks*.\n\nThis system was largely inspired by `pluggy`_,\nthe plugin system which powers `pytest`_, `tox`_, and `devpi`_, but with the intent to be called\nfrom a C++ application rather than from Python.\n\nIt was conceived to facilitate the application development, allowing hooks to be exposed in a\nclear way and allowing plugins to be developed without access to classes or data from the application.\n\nWith ``HookMan`` your application can have access to the hooks implemented on plugins as simple as the example below.\n\n.. code-block:: python\n\n # Initializing a class\n hm = HookMan(specs=acme_specs, plugin_dirs=['path1','path2'])\n\n hook_caller = hm.get_hook_caller()\n\n # Getting access to the hook implementation\n friction_factor = hook_caller.friction_factor()\n env_temperature = hook_caller.env_temperature()\n\n # Checking if the hook was implemented\n assert friction_factor is not None\n assert env_temperature is None\n\n # Executing the hook, wherever it is implemented either in plugin A or B.\n ff_result = friction_factor(1, 2.5)\n env_tmp_result = env_temperature(35.5, 45.5)\n\nHow does it work?\n-----------------\n\nIn order to use ``HookMan`` in your application, it is necessary to inform which ``Hooks``\nare available to be implemented through a configuration object.\n\n\nWith this configuration defined, users can create plugins that implement available ``Hooks`` extending the behavior of your application.\n\n\nAll plugins informed to your application will be validated by HookMan (to check which hooks are implemented),\nand an object holding a reference to the ``Hooks`` will be passed to the application.\n\n\nThe ``HookMan`` project uses the library pybind11_ to interact between Python and C/C++,\nallowing a straightforward usage for who is calling the function (either in Python or in C++).\n\n\nDefining some terminologies:\n\n- ``Application`` \u21e8 The program that offers the extensions.\n- ``Hook`` \u21e8 An extension of the Application.\n- ``Plugin`` \u21e8 The program that implements the ``Hooks``.\n- ``User`` \u21e8 The person who installed the application.\n\n\n\n\n`Read the docs to learn more!`_\n\n* Documentation: https://hookman.readthedocs.io.\n* Free software: MIT license\n\n\nCredits\n-------\nThanks for pluggy_, which is a similar project (plugin system) and source for many ideas.\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n.. _`GitHub page` : https://github.com/ESSS/hookman\n.. _`read the docs to learn more!` : https://hookman.readthedocs.io\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _devpi: https://github.com/devpi/devpi\n.. _pluggy: https://github.com/pytest-dev/pluggy\n.. _pybind11: https://github.com/pybind/pybind11\n.. _pytest: https://github.com/pytest-dev/pytest\n.. _tox: https://github.com/tox-dev/tox\n\n\n=======\nHistory\n=======\n\n0.5.0 (2023-02-10)\n==================\n\n- Allow to add some extra text to created hmplugin file.\n\n\n0.4.0 (2020-10-23)\n==================\n\n- When removing plugins they are first moved to a ``.trash`` dir and not directly deleted.\n- Allow HookManager to call hooks of a specific plugin.\n\n\n0.3.0 (2019-12-16)\n==================\n\n- Rename the parameter ``dst_path`` to ``dest_path`` on ``install_plugin`` method.\n- ``install_plugin`` now returns the name of the plugin when the installation is successful.\n- Now the library path dir is added to ``PATH`` environment variable before load the library (Only on Windows).\n- Added an optional \"extras\" entry to plugin definition yaml:\n\n - \"extras\" is a dictionary for adding (key, value) customized options, accessible in ``PluginInfo.extras``;\n - Plugin generation accepts a dict of default (key, value) pairs to be added to ``extras``;\n\n\n0.2.0 (2019-02-08)\n==================\n\n- Moved load hook function code to ``HookCaller.load_impls_from_library`` function implemented in C++. This\n enables using hook functionality in projects which don't use Python as their entry point.\n\n- ``HookSpecs`` now accepts an ``extra_includes`` argument, which can be used to add custom ``#include`` directives\n to the generated ``HookCaller.hpp`` file.\n\n- ``HookCaller`` now contains a ``std::vector`` of functions bound to plugin implementations. This allows multiple\n plugins to implement the same hook; how the results of each call is to behave is responsibility of the caller.\n\n Because of this, the following classes/methods have been removed because they are no longer relevant:\n\n * ``ConflictBetweenPluginsError``\n * ``ConflictStatus``\n * ``HookMan.ensure_is_valid``\n * ``HookMan.get_status``\n\n\n- Generated files now sport a \"do not modify\" comment header.\n\n- Generation of the bindings code for ``HookCaller`` is skipped if ``specs.pyd_name`` is not defined.\n\n- Code generation is now available directly in the command-line through the commands:\n\n * ``python -m hookman generate-plugin-template``\n * ``python -m hookman generate-project-files``\n * ``python -m hookman generate-hook-specs-h``\n * ``python -m hookman package-plugin``\n\n- Explicitly declare ``extern \"C\"`` calling convention in the ``hook_specs.h`` file.\n\n- The ``INIT_HOOKS`` macro has been removed as it didn't have any useful function.\n\n0.1.7 (2018-08-23)\n==================\n\n- First Release on PyPI.\n\n0.1.6 (2018-08-23)\n==================\n\n- Never released, deployment error.\n\n0.1.5 (2018-08-23)\n==================\n\n- Never released, deployment error.\n\n\n0.1.4 (2018-08-23)\n==================\n\n- Never released, deployment error.\n\n0.1.3 (2018-08-23)\n==================\n\n- Never released, deployment error.\n\n\n0.1.2 (2018-08-23)\n==================\n\n- Never released, deployment error.\n\n\n0.1.1 (2018-08-23)\n==================\n\n- Never released, deployment error.\n- Dropping bumperversion and using setuptool_scm\n\n0.1.0 (2018-08-23)\n==================\n\n- Never released, deployment error.\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "HookMan is a python package that provides a plugin management system to applications, specially those who are written (in totally or partially) in C++.",
"version": "0.5.0",
"split_keywords": [
"hookman"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "69c279d18d6ad4e9a28dedc0de3b83b7f955ddef5ac280eb8b15d784ea74d709",
"md5": "4e14a98d96f20d5b6bc43696a4bfbeff",
"sha256": "317d662d1b05078af0290e6b2e66be8aba2a096588f6c1c3993a119df82e6924"
},
"downloads": -1,
"filename": "python_hookman-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4e14a98d96f20d5b6bc43696a4bfbeff",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 21988,
"upload_time": "2023-02-10T14:19:45",
"upload_time_iso_8601": "2023-02-10T14:19:45.767223Z",
"url": "https://files.pythonhosted.org/packages/69/c2/79d18d6ad4e9a28dedc0de3b83b7f955ddef5ac280eb8b15d784ea74d709/python_hookman-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c07d7b8ea79998e0a540c2f97ef62041b8e6d666a5718d2e06f99e2d6eafe8fe",
"md5": "75b6277caa1c3d6ba4f4feb9be7e7a35",
"sha256": "6f009e6b944af847425121aa147483652c79f26c81ac51da1db0f98811681562"
},
"downloads": -1,
"filename": "python-hookman-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "75b6277caa1c3d6ba4f4feb9be7e7a35",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 48688,
"upload_time": "2023-02-10T14:19:47",
"upload_time_iso_8601": "2023-02-10T14:19:47.718549Z",
"url": "https://files.pythonhosted.org/packages/c0/7d/7b8ea79998e0a540c2f97ef62041b8e6d666a5718d2e06f99e2d6eafe8fe/python-hookman-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-10 14:19:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "esss",
"github_project": "hookman",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "python-hookman"
}