Skip to main content

Framework for document transformations as microservice based web services.

Project description

Morpho Logo

Python port for the go written doctrans

Morpho is a framework for microservice based web services. It offers the ability to transform a given document with a provided function.

In the first place this framework was created to use it for research purposes.

💡 Installation

pip install morpho

⚠️ currently in alpha: public api may change with breaking changes ⚠️

via git

  1. make sure to use at least python 3.8
  2. clone the repo git clone https://github.com/B4rtware/morpho.git
  3. cd morpho and install dependencies via
    • poetry install (Poetry) or
    • use the provided requirements.txt

⚙️ Server Example

... without options

service.py

from morpho.server import Service

def work(document: str) -> str:
    return document

service = Service(name="Echo", version="0.0.1")

if __name__ == "__main__":
    service.run()

... with options

service.py

from morpho.server import Service
from pydantic import BaseModel

class Options(BaseModel):
    name: str

def work(document: str, options: Options) -> str:
    return document + options.name

service = Service(name="AppendName", version="0.0.1", options_type=Options)

if __name__ == "__main__":
    service.run()

🖥️ Client Example

client.py

from morpho.client import Client
from morpho.client import ClientConfig

morpho = Client(ClientConfig("http://localhost:8761/eureka/"))

response = morpho.transform_document(
    "This is a Document!",
    service_name="Echo"
)

print(response.document)

>>> This is a Document!

📝 License

MIT

Project details


Download files

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

Source Distribution

morpho-1.0.0a4.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

morpho-1.0.0a4-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file morpho-1.0.0a4.tar.gz.

File metadata

  • Download URL: morpho-1.0.0a4.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.9 CPython/3.8.1 Windows/10

File hashes

Hashes for morpho-1.0.0a4.tar.gz
Algorithm Hash digest
SHA256 83117e1e91b70d570d02bc7d2511cf631b8383939a70c572a662df8ba98c8061
MD5 315a99b3239a0649be97d711bd14681a
BLAKE2b-256 4789132716522ba054b9342a35383c307deca76e22632d0fa59086d7ecbd57a3

See more details on using hashes here.

Provenance

File details

Details for the file morpho-1.0.0a4-py3-none-any.whl.

File metadata

  • Download URL: morpho-1.0.0a4-py3-none-any.whl
  • Upload date:
  • Size: 28.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.9 CPython/3.8.1 Windows/10

File hashes

Hashes for morpho-1.0.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 b965eea957617a15601434bdf8995e722f980ea6b8483995f11870ef15c4eb23
MD5 9e023536d75aa0ed9fb039a5a076e4fd
BLAKE2b-256 4000302cf1ab826dc18deed67b6a52b5c67073654256611a8c5efba3d8d3923a

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page