Skip to main content

A framework for microservice based document transformation.

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 be used 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!

👩🏽‍💻 Development

Creating a new release

  1. Run the following command poetry bump <version>
    Morpho uses the following schema: ^v\d+\.\d+\.\d+((b|a)\d+)?$

  2. Bump the version within the file: morpho/__version__.py
    Make sure it's the same version used when bumping with poetry

  3. Open Changelog.md and write the new changelog:

    • Use the following # header: v<version> - (dd.mm.yyyy)
      Used ## headers:
    • 💌 Added
    • 🔨 Fixed
    • ♻️ Changed
  4. Stage the modified files and push them with the following commit message:

    chore: bump to version <version>

  5. Run the following command poetry build to create a tarball and a wheel based on the new version

  6. Create a new github release and:

    1. Copy and paste the changelog content without the # header into the description of the release textbox
    2. Use the # header style to fill in the Release title (copy it from the Changelog.md)
    3. Copy the version with the v-prefix into the Tag version
  7. Attach the produced tarball and wheel (dist/) to the release

  8. Check This is a pre-release if it's either an alpha or beta release (a|b) - optional

  9. Publish release

📝 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.0b1.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

morpho-1.0.0b1-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: morpho-1.0.0b1.tar.gz
  • Upload date:
  • Size: 19.3 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

Hashes for morpho-1.0.0b1.tar.gz
Algorithm Hash digest
SHA256 11f6e1a95ac398a6b2e83eed7b36df7ccea9aef14bb6aa5e5261f2481d8da955
MD5 cd937b676c228872b8a8586149e99e3b
BLAKE2b-256 75f4a20611fe8dc97382dff512af8569aa7fc772c4f1dbc1a343958f70197c9e

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: morpho-1.0.0b1-py3-none-any.whl
  • Upload date:
  • Size: 21.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

Hashes for morpho-1.0.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 5ba27542ed5543fc5525cf98374d1912fb681ae0ec74271fbec78740498def36
MD5 cecd811f0ede3a872fd3c734c6a6d83c
BLAKE2b-256 40c8e184e379f1081e93d91a7ddf759ebc519fc6c1d877a6333981242c7746c9

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