Framework for document transformations as microservice based web services.
Project description
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
- make sure to use at least python 3.8
- clone the repo
git clone https://github.com/B4rtware/morpho.git
cd morpho
and install dependencies viapoetry 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
Release history Release notifications | RSS feed
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.0a5.tar.gz
(24.0 kB
view details)
Built Distribution
morpho-1.0.0a5-py3-none-any.whl
(28.6 kB
view details)
File details
Details for the file morpho-1.0.0a5.tar.gz
.
File metadata
- Download URL: morpho-1.0.0a5.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb8b754e0a2b91947e8da381c3109c4fbdc24273042f3ce1ea89d13bd686f9d1 |
|
MD5 | c7e26ed2a1c62933d70f69e53bae7caa |
|
BLAKE2b-256 | 198c48617c14b9907a2ff223b2de460df3d209424665d38d78a41cbe3da539a2 |
Provenance
File details
Details for the file morpho-1.0.0a5-py3-none-any.whl
.
File metadata
- Download URL: morpho-1.0.0a5-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | f42b95edd52f0bbc69d15fd7fe487ef2122160fd91aaea85f727215c5b18ddea |
|
MD5 | 843e346d178d3b6e7c5ac2f6ab48f9d9 |
|
BLAKE2b-256 | 6a27ab23371d818cfe6d0808639636e44a6c24ebc33c79ad92650a0ca4648bc6 |