Skip to main content

oms.py

A micro-framework for the excellent Open Microservices Specification, 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 service.py
import oms
from uuid import uuid4

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

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

if __name__ == '__main__':
    service.serve()

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

Next, run the command $ oms-generate oms.yml files will automatically be generated, for your application:

$ oms-generate service:service
…
'oms.yml' written to disk!
$ cat oms.yml
actions:
  new:
    help: Generates a UUID, with a given prefix.
    arguments:
      prefix:
        in: query
        required: true
        type: string
    http:
      method: get
      path: /new
      port: 8080
    output:
      type: string
lifecycle:
  startup:
    command:
    - python3
    - /app/service.py
oms: 1
$ cat Dockerfile
FROM kennethreitz/pipenv
COPY . /app
CMD ["python3", "service.py"]

Now, run your microservice!

$ python service.py
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 './oms.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 oms CLI:

$ oms run new -a prefix='user-'
…

Installation

$ pip install

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

✨ 🍰 ✨

Metadata

Release files for oms 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oms 0.5.0
File Size Uploaded Provenance Actions
oms-0.5.0.tar.gz 7.4 kB Without provenance Details for oms-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for oms 0.5.0
File Interpreter ABI Platform Actions
oms-0.5.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for oms-0.5.0-py2.py3-none-any.whl

Total release size: 13.8 kB

Release files / oms-0.5.0.tar.gz

Download URL oms-0.5.0.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5da492fe0b9ee237f6498439b6b080281aadc51ed0da6c0c1b483a54919da3f9
BLAKE2b-256 checksum
How to use checksums
f0394228157144295160d5ecc217bb753c21d017bc00c7f0f3cd9274e6dc9590
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

Release files / oms-0.5.0-py2.py3-none-any.whl

Download URL oms-0.5.0-py2.py3-none-any.whl
Size 6.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2a8213d95b571ca099ae67cd214fe62406692f06e574ad86fabb920d77a5f7ff
BLAKE2b-256 checksum
How to use checksums
5d9d458d74dfe7574a08f91ae8a179a9ec7fa535366f2f2a240ca0c137ee37ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

Security for oms 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page