Skip to main content

IntentText - the semantic document format that is natively JSON

Project description

IntentText Python

PyPI

Python implementation of the IntentText parser and renderer.

Independent implementation (not a Node.js wrapper), designed for Python workflows and AI stacks.

Install

pip install intenttext

Quick Start

from intenttext import parse, render_html, merge_data, validate, query

# Parse a document
source = """
title: Sprint Planning
section: Tasks
task: Write tests | owner: Ahmed | due: Friday
task: Deploy to staging | owner: Sarah | due: Monday
gate: Final approval | approver: Lead | timeout: 24h
""".strip()

doc = parse(source)

# Query for tasks
tasks = query(doc, type="task")
for task in tasks:
    print(f"{task.content} -> {task.properties.get('owner', 'unassigned')}")

# Validate workflow semantics
result = validate(doc)
if not result.valid:
    for issue in result.issues:
        print(f"[{issue.type.upper()}] {issue.message}")

# Render to HTML
html = render_html(doc)

API

  • parse(source: str) -> IntentDocument
  • parse_safe(source: str, ...) -> ParseResult
  • render_html(doc: IntentDocument, include_css: bool = True) -> str
  • render_print(doc: IntentDocument) -> str
  • render_markdown(doc: IntentDocument) -> str
  • merge_data(template: IntentDocument, data: dict) -> IntentDocument
  • parse_and_merge(template_source: str, data: dict) -> IntentDocument
  • validate(doc: IntentDocument) -> ValidationResult
  • query(doc: IntentDocument, ...) -> list[IntentBlock]
  • to_source(doc: IntentDocument) -> str

Development

pip install -e .[dev]
pytest

Release (PyPI)

# 1) Ensure tests pass
python3 -m pytest -q

# 2) Build source + wheel
python3 -m pip install -U hatch twine
hatch build

# 3) Validate package metadata and long description
twine check dist/*

# 4) Upload (interactive)
twine upload dist/*

Tag-based release flow:

git tag v1.0.0
git push origin v1.0.0

GitHub Action publish workflow uses PYPI_API_TOKEN for automated release on v* tags.

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

intenttext-2.11.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

intenttext-2.11.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file intenttext-2.11.0.tar.gz.

File metadata

  • Download URL: intenttext-2.11.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for intenttext-2.11.0.tar.gz
Algorithm Hash digest
SHA256 2a60fc5c06db971743e264f681ec8488a65c7b7346bf4aff27aedc3efa9a22ed
MD5 5f7a25038a74f7662ccd17914491eed9
BLAKE2b-256 ee4539a18e37453a07c4768b3db65ec36cc9c2fe27bd4198ec12d11e2af93ea8

See more details on using hashes here.

File details

Details for the file intenttext-2.11.0-py3-none-any.whl.

File metadata

  • Download URL: intenttext-2.11.0-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for intenttext-2.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5264e428d681f8816f7168d924eb1c96f434e2cef413a740c0c6744f2bace412
MD5 81b26f756fa304ea7d9c9eb4b3436597
BLAKE2b-256 8998514aeb9fc654f876d193c5e0ad47f392d0c7972ad248cae0b8e5b42b0414

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