Skip to main content

IntentText Python

PyPI

Python API for IntentText with Rust-core parsing by default.

The package uses @intenttext/core (Rust-backed) for parser parity and keeps Python-native rendering/query/validation helpers for Python workflows and AI stacks.

Engine controls:

  • INTENTTEXT_PY_ENGINE=rust (default) to use Rust core through Node.
  • INTENTTEXT_PY_ENGINE=py to force legacy Python parser.
  • INTENTTEXT_PY_FALLBACK=0 to disable automatic fallback to Python parser when Rust core is unavailable.
  • INTENTTEXT_PY_VALIDATE_ENGINE=rust to use Rust semantic validation through Node (default); set py to force Python compatibility mode.
  • INTENTTEXT_PY_QUERY_ENGINE=rust to use Rust-backed query execution (py by default for compatibility with regex property filters).
  • INTENTTEXT_PY_RENDER_ENGINE=rust to use Rust-backed HTML rendering (py by default for compatibility).
  • INTENTTEXT_PY_SOURCE_ENGINE=rust to use Rust-backed to_source conversion (py by default for compatibility).
  • INTENTTEXT_PY_TRUST_ENGINE=rust to use Rust-backed trust helpers (py by default for compatibility).

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

Metadata

Release files for intenttext 3.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for intenttext 3.3.0
File Size Uploaded
intenttext-3.3.0.tar.gz 22.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for intenttext 3.3.0
File Interpreter ABI Platform
intenttext-3.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 45.0 kB

Release files / intenttext-3.3.0.tar.gz

Download URL intenttext-3.3.0.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a92e8271bcf8d45f6ac4cc4c625a9dcedb2b606f3bdf941d8b742732f20a2180
BLAKE2b-256 checksum
How to use checksums
9fd22f68cf2872788c0a70c946a487117e7ed04f44cc8eb99eee4e8c9d1b8396
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / intenttext-3.3.0-py3-none-any.whl

Download URL intenttext-3.3.0-py3-none-any.whl
Size 23.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7405315cfc459454cd479c60969a62f4631daaacdea2ee6f3abb5078e975edf0
BLAKE2b-256 checksum
How to use checksums
63da7d9fe09d3572ea6b1ea655a8758876385096d829eff084d3349a24e23ced
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

3.3.0 This release

2 release files

3.1.0

2 release files

2.12.1

1 release file

2.12.0

1 release file

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page