GithubHelp home page GithubHelp logo

tadeu / hookman Goto Github PK

View Code? Open in Web Editor NEW

This project forked from esss/hookman

0.0 0.0 0.0 276 KB

A plugin management system in python to applications (in totally or partially) written in C++.    

Home Page: https://hookman.readthedocs.io

License: MIT License

CMake 2.73% Python 82.40% C 3.49% C++ 11.38%

hookman's Introduction

Hookman

https://ci.appveyor.com/api/projects/status/w472d1cm0w37ka3l/branch/master?svg=true 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.

hookman's People

Contributors

arthursoprana avatar ggrbill avatar nicoddemus avatar tadeu avatar williamjamir avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.