Catalog PyPI
Back to packageRELEASE DETAILS

0.3.0

PyPI

agentmark-templatedx

Python implementation of the AgentMark templatedx transformer

agentmarkmdxtemplatetemplatedxtransformer
Published11 Jun 2026
Direct dependencies4
Transitive dependenciesNot calculated

README

Version 0.3.0 documentation

AgentMark TemplateDX (Python)

Python implementation of the AgentMark templatedx transformer.

Installation

pip install agentmark-templatedx

Usage

This package transforms pre-parsed MDX AST trees. The AST is typically obtained by:

  • Parsing MDX with the TypeScript @agentmark-ai/templatedx package
  • Loading a pre-parsed AST from a JSON file
  • Receiving an AST from the AgentMark runtime
import asyncio
import json
from templatedx import TemplateDX

async def main():
    engine = TemplateDX()

    # Load a pre-parsed MDX AST (from TypeScript parser or JSON file)
    with open("template.ast.json") as f:
        ast = json.load(f)

    # Transform the AST with props
    result = await engine.transform(
        ast,
        props={"name": "Alice", "items": [1, 2, 3]}
    )

    print(result)

asyncio.run(main())

Custom Plugins

from templatedx import TagPlugin, PluginContext

class MyPlugin(TagPlugin):
    async def transform(self, props, children, context):
        # Transform children and return result
        transformer = context.create_node_transformer(context.scope)
        return await transformer.transform_children(children)

engine = TemplateDX()
engine.register_tag_plugin(MyPlugin(), ["MyTag"])

Custom Filters

engine = TemplateDX()
engine.register_filter("double", lambda x: x * 2)

Built-in Filters

  • capitalize(str) - Capitalize first character
  • upper(str) - Uppercase string
  • lower(str) - Lowercase string
  • truncate(str, length) - Truncate with ellipsis
  • abs(num) - Absolute value
  • join(arr, separator) - Join array elements
  • round(num, decimals) - Round number
  • replace(str, search, replacement) - Replace occurrences
  • urlencode(str) - URL encode string
  • dump(any) - JSON stringify

Built-in Tags

  • <If condition={...}> / <ElseIf condition={...}> / <Else> - Conditional rendering
  • <ForEach arr={...}>{(item, index) => ...}</ForEach> - Array iteration
  • <Raw>...</Raw> - Raw content passthrough

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 4

Native requirements
4 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
mypy
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.12",
  "evaluation": "NOT_EVALUATED"
}
mypy>=1.0; extra == "dev"runtime
pytest-asyncio
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.12",
  "evaluation": "NOT_EVALUATED"
}
pytest-asyncio>=0.21; extra == "dev"runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.12",
  "evaluation": "NOT_EVALUATED"
}
pytest>=7.0; extra == "dev"runtime
ruff
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.12",
  "evaluation": "NOT_EVALUATED"
}
ruff>=0.1.0; extra == "dev"runtime

Distribution files

2 collected
agentmark_templatedx-0.3.0-py3-none-any.whl

bdist_wheel · 25.45 KB · Python py3

Source file
agentmark_templatedx-0.3.0.tar.gz

sdist · 45.96 KB · Python source

Source file

Repository

PENDING
agentmark/agentmark

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:39 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:697d49fe62f9595d8d03e8fd4e12bc73ffaed2ef2b5bcc4e2f81aadfc9f5efa9

Other collected versions

View all collected versions →