Skip to main content

Python bindings for the DataMorph transformation engine

Project description

datamorph-python

datamorph-python exposes the DataMorph transformation engine as a normal Python package.

Install it with:

pip install datamorph-python

Then import it with:

from datamorph import evaluate, read, write

Quick Start

from datamorph import evaluate

script = """
output application/json
---
{
  id: payload.id,
  requestId: headers.requestId,
  stage: attributes.stage,
  env: vars.env
}
"""

result = evaluate(
    script,
    payload={"id": 42},
    headers={"requestId": "req-001"},
    attributes={"stage": "test"},
    variables={"env": "dev"},
)

assert result == {
    "id": 42,
    "requestId": "req-001",
    "stage": "test",
    "env": "dev",
}

API

  • evaluate(script, payload=None, headers=None, attributes=None, variables=None, payload_mime=None)
  • transform(...) as an alias for evaluate(...)
  • eval_expression(expression)
  • read(input_text, mime_type)
  • write(data, mime_type)
  • validate(script)
  • version()

Notes

  • Package name on PyPI: datamorph-python
  • Import name in Python: datamorph
  • Wheels built from this folder contain the Rust engine, so users do not need a separate DataMorph installation.

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

datamorph_python-1.22.1.tar.gz (33.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datamorph_python-1.22.1-cp38-abi3-win_amd64.whl (32.6 MB view details)

Uploaded CPython 3.8+Windows x86-64

File details

Details for the file datamorph_python-1.22.1.tar.gz.

File metadata

  • Download URL: datamorph_python-1.22.1.tar.gz
  • Upload date:
  • Size: 33.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for datamorph_python-1.22.1.tar.gz
Algorithm Hash digest
SHA256 978a79bbc55c04e6e825a19b7c39f9a0346159437d0945ece7f58657c2340f3b
MD5 11410e5ec5a93dc1cf38a11e8f06ec2e
BLAKE2b-256 80b85e1f599c7502554ae4a6264eb9169777d7986f042fd1058e0d59186ad649

See more details on using hashes here.

File details

Details for the file datamorph_python-1.22.1-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for datamorph_python-1.22.1-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d51e4dbf89038d338111a348a8c13a28a9d7d4271708f59e85ef778567dfaca3
MD5 ef983e92c63e37a01b44d3660bde9a46
BLAKE2b-256 6abd58fafc679a09d1a31bf6124f2e0655336f2ec02071d4cbb6b1ea3a6e3e15

See more details on using hashes here.

Supported by

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