A microservice framework for Python.
Write regular Python methods and classes to implement your service. Nameko will manage connections, transports and concurrency for you.
Spin up multiple service instances to easily scale out. Nameko gives you effortless concurrency by yielding workers when they wait for I/O, leaving you free to handle many requests without the worry of threading.
Nameko is compatible with almost any protocol, transport or database. Simply use the built-in extensions, build your own or leverage the community.
Nameko includes an implementation of RPC over AMQP. It comprises the @rpc entrypoint, a proxy for services to talk to other services, and a standalone proxy that non-Nameko clients can use to make RPC calls to a cluster
# rpc_services.py
from nameko.rpc import rpc, RpcProxy
class ServiceY:
name = "service_y"
@rpc
def append_identifier(self, value):
return u"{}-y".format(value)
class ServiceX:
name = "service_x"
y = RpcProxy("service_y")
@rpc
def remote_method(self, value):
res = u"{}-x".format(value)
return self.y.append_identifier(res)
The HTTP entrypoint is built on top of werkzeug, and supports all the standard HTTP methods (GET/POST/DELETE/PUT etc)
# http_service.py
import json
from nameko.web.handlers import http
class HttpService:
name = "http_service"
@http('GET', '/get/<int:value>')
def get_method(self, request, value):
return json.dumps({'value': value})
@http('POST', '/post')
def do_post(self, request):
return u"received: {}".format(request.get_data(as_text=True))
The easiest way to install Nameko is from PyPI, using pip
$ pip install nameko
To read the detailed installation instructions, see our documentation
Professional support for Nameko is available as part of the Tidelift subscription
Tidelift gives software development teams a single source for purchasing and maintaining their software, with professional grade assurances from the experts who know it best, while seamlessly integrating with existing tools.
Sends exception info to Sentry
Send and receive messages from Slack
Sqlalchemy dependency
Redis dependency
Django wrapper for Nameko
Retry delivery of messages
A team effort - designed by Andreea Hrincu and built by Kyle Stewart