Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Library to create microservices for Micro

Project Description

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

Installation

PyPi:

$ pip install micro-dev

Development version:

$ git clone git@github.com:humu1us/micro-dev.git:
$ cd micro-dev
$ pip install .

or direct from repository:

$ 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:

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

>>> 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!!!'

Release History

This version
History Node

1.0.1

History Node

1.0.0

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
Micro_dev-1.0.1-py3-none-any.whl
(4.8 kB) Copy SHA256 Hash SHA256
Wheel py3 Jan 4, 2018
Micro-dev-1.0.1.tar.gz
(3.5 kB) Copy SHA256 Hash SHA256
Source None Jan 4, 2018

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting