Skip to main content

A micro-framework for the OMG, and code written in Python 3.6+.

Project description

A micro-framework for the excellent Open Microservices Guide, for suppportive code written in Python 3.6+.

Note: this is pre-release software, and is subject to improvement. Contributions are welcome! This framework is being developed for other languages, as well. If you'd like to help, let us know!

Intended / Example Usage

$ cat
import omg
from uuid import uuid4

service = omg.Microservice(name='uuid')

def new(prefix: str) -> str:
    """Generates a UUID, with a given prefix."""
    return f'{prefix}{uuid4().hex}'

if __name__ == '__main__':

register takes some optional arguments: name and path. You can also call service.add(f=new), instead.

If not available on disk, the required Dockerfile and microservice.yml files will automatically be generated, for your application:

$ cat microservice.yml
    help: Generates a UUID, with a given prefix.
        in: query
        required: true
        type: string
      method: get
      path: /new
      port: 8080
      type: string
    - python3
    - /app/
omg: 1
$ cat Dockerfile
FROM kennethreitz/pipenv
COPY . /app
CMD ["python3", ""]

Now, run your microservice!

$ python
2019-05-09 14:45:39,342 - micro - DEBUG - Initiating 'uuid' service.
2019-05-09 14:45:39,344 - micro - DEBUG - Registering Flask endpoint: '/new'
2019-05-09 14:45:39,344 - micro - DEBUG - Dockerfile './Dockerfile' already exists!
2019-05-09 14:45:39,345 - micro - DEBUG - Microservice Manifest './microservice.yml' already exists!
2019-05-09 14:45:39,346 - micro - INFO - Serving on: '*:8080'

This will spawn a Flask application (using the production-ready waitress web server), preconfigured to serve the masses!

Or, use the omg-cli:

$ omg run new -a prefix='user-'


$ pip install

P.S. Do provide feedback, if you desire! :)

✨ 🍰 ✨

Project details

Release history Release notifications

Download files

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

Files for, version 0.3.3
Filename, size File type Python version Upload date Hashes
Filename, size (8.1 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size (6.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page