A framework for microservice based document transformation.
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 be used for research purposes.
💡 Installation
pip install morpho
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!
👩🏽💻 Development
Creating a new release
-
Run the following command
poetry version <version>
Morpho uses the following schema:^\d+\.\d+\.\d+((b|a)\d+)?$
-
Bump the version within the file:
morpho/__version__.py
Make sure it's the same version used when bumping with poetry -
Open
Changelog.md
and write the new changelog:- Use the following
#
header:v<version> - (dd.mm.yyyy)
Used##
headers: - 💌 Added
- 🔨 Fixed
- ♻️ Changed
- Use the following
-
Stage the modified files and push them with the following commit message:
chore: bump to version
<version>
-
Run the following command
poetry build
to create a tarball and a wheel based on the new version -
Create a new github release and:
- Copy and paste the changelog content without the
#
header into the description of the release textbox - Use the
#
header style to fill in the Release title (copy it from theChangelog.md
) - Copy the version with the
v
-prefix into the Tag version
- Copy and paste the changelog content without the
-
Attach the produced tarball and wheel (
dist/
) to the release -
Check This is a pre-release if it's either an alpha or beta release (a|b) - optional
-
Publish release
📝 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
Built Distribution
File details
Details for the file morpho-1.0.0b4.tar.gz
.
File metadata
- Download URL: morpho-1.0.0b4.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.8.5 Linux/4.15.0-1077-aws
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed45803c08b7a79745ff71d1e32d5b7e7fd237b3e3bebedd6b3eb108115eecb5 |
|
MD5 | baee822d8c0e5b17b503449c56dd097b |
|
BLAKE2b-256 | 69a9d9802d0dc73bd10699d565e50459171171436967db4583d6805dc95963f5 |
Provenance
File details
Details for the file morpho-1.0.0b4-py3-none-any.whl
.
File metadata
- Download URL: morpho-1.0.0b4-py3-none-any.whl
- Upload date:
- Size: 22.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.8.5 Linux/4.15.0-1077-aws
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 271825dc4cabcd39e3d709e3fa588ce796f1e6ae02bd259d28a314d075866f74 |
|
MD5 | f0a1a5d99cc7ca9dbe706dcbb3d3545a |
|
BLAKE2b-256 | dd45e80e8cb1928d39db0fc38fb6df797ffb58e9a9de93931afee2ad57c7ba4e |