Metadata-Version: 2.0
Name: Micro-dev
Version: 1.0.0
Summary: Library to create microservices for Micro
Home-page: https://github.com/humu1us/micro-dev
Author: Felipe Ortiz, Pablo Ahumada
Author-email: fortizc@gmail.com, pablo.ahumadadiaz@gmail.com
License: MIT
Keywords: microservices celery
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development
Classifier: Topic :: System
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Requires-Dist: celery (<5,>=4)

micro-dev
=========

``micro-dev`` is the only thing needed to create plugins for Micro and
use the Micro’s endpoints to send tasks.

Installation
------------

::

    $ pip install git+ssh://git@github.com/humu1us/micro-dev.git

Usage
-----

Create Plugins
~~~~~~~~~~~~~~

Write a Micro plugin is very simple. All that you need to do is create a
file named ``interface.py`` which defines the plugin as follow:

.. code:: python

    from micro.plugin.pluginbase import PluginBase
    from micro.plugin.pluginbase import PluginDescription


    class ExamplePlugin(PluginBase):
      def __init__(self):
          print("This is an example plugin")

    # This is the method executed by Micro
      def run(self, **kwargs):
          return "Hello " + kwargs["name"] + "!!!"

    # This description is required by Micro
    plugin = PluginDescription(
      name="Example Plugin",
      author="Jhon Doe",
      short_desc="A very simple example plugin",
      long_desc="This plugin is a very simple example, "
                "for that reason, we don't have a long description"
      help_str="Params: name type string; A name to greet",
      instance=ExamplePlugin
    )

Send tasks
~~~~~~~~~~

.. code:: python

    >>> from micro.api.endpoints import plugins, run
    >>>
    >>> plugins.delay().wait()
    {'Example plugin': 'A very simple example plugin'}
    >>>
    >>> run.delay("Example plugin", name="Micro").wait()
    'Hello Micro!!!'


