Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Library of utils to create REST Python Microservices

Project description

Python Microservices Library

PyPI version Build Status Coverage Status Requirements Status Total alerts Language grade: Python

PyMS, Python MicroService, is a collections of libraries, best practices and recommended ways to build microservices with Python.


To know how use, install or build a project see the docs:


When we started to create microservice with no idea, we were looking for tutorials, guides, best practices, but we found nothing to create professional projects. Most articles say:

  • "Install flask"
  • "Create routes"
  • (Sometimes) "Create a swagger specs"
  • "TA-DA! you have a microservice"

But... what happens with our configuration out of code like Kubernetes configmap? what happens with transactionality? If we have many microservices, what happens with traces?.

There are many problems around Python and microservices and we can`t find anyone to give a solution.

We start creating these projects to try to solve all the problems we have found in our professional lives about microservices architecture.

Nowadays, is not perfect and we have a looong roadmap, but we hope this library could help other felas and friends ;)


pip install py-ms


You need to create 2 files: and config.yml:

from flask import jsonify

from import Microservice

ms = Microservice(path=__file__) # 1.1
app = ms.create_app() # 2.1

@app.route("/") # 3.1
def example():
    return jsonify({"main": "hello world"})

if __name__ == '__main__':


pyms: # 1.2
    data: {}
ms: # 1.3
  DEBUG: true
  APP_NAME: business-glossary
  SECRET_KEY: "gjr39dkjn344_!67#"

So what did that code do?

  1. Create a instance of PyMS Microservice class (#1.1). This initialization inject the configuration defined in the 1.3 block and could be accessed through current_app.config. Then, initialize the service defined in the 1.2 block. See Services for more details.
  2. Initialize Flask instance, Connexion if it was defined in the pyms configuration block, create a tracer, add health-check blueprint, initialize libs and set the PyMS Microservice in ms attribute and you can access to it with This steps has their each functions and you can easy override it.
  3. create_app return the flask instance and you can interact with it as a typical flask app

See Documentation to learn more.

How To Contrib

We appreciate opening issues and pull requests to make PyMS even more stable & useful! See This doc for more details

Project details

Download files

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

Files for py-ms, version 1.4.1
Filename, size File type Python version Upload date Hashes
Filename, size py_ms-1.4.1-py3-none-any.whl (72.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size py-ms-1.4.1.tar.gz (32.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page