annex-0.5.0
توضیحات
A Simple Plugin System for Python
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | annex-0.5.0 |
| نام | annex |
| نسخه کتابخانه | 0.5.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Gary M. Josack |
| ایمیل نویسنده | gary@byoteki.com |
| آدرس صفحه اصلی | https://github.com/gmjosack/annex |
| آدرس اینترنتی | https://pypi.org/project/annex/ |
| مجوز | MIT |
annex
=====
Summary
~~~~~~~
Annex provides assistance with developing plugin-based tools.
With Annex you can load and reload plugins from various python modules
without the requirement that they exist on the PYTHONPATH.
Example Usage
~~~~~~~~~~~~~
In your project you would define a base class from which all plugins for
project would subclass.
base\_plugin.py
'''''''''''''''
::
class BaseTestPlugin(object):
def run(self, *args, **kwargs):
raise NotImplementedError()
example\_plugin.py
''''''''''''''''''
::
from base_plugin import BaseTestPlugin
class PrinterPlugin(BaseTestPlugin):
def run(self, *args, **kwargs):
print args, kwargs
foo.py
''''''
::
from base_plugin import BaseTestPlugin
from annex import Annex
plugins = Annex(BaseTestPlugin, ["/path/to/plugins"])
for plugin in plugins:
plugin.run("foo", bar="baz")
نحوه نصب
نصب پکیج whl annex-0.5.0:
pip install annex-0.5.0.whl
نصب پکیج tar.gz annex-0.5.0:
pip install annex-0.5.0.tar.gz