Skip to main content

doenetml-to-pretext

Python package for converting DoenetML to PreTeXt using Deno.

Requires Deno at runtime. Conversions shell out to Deno, so it must be available on your PATH (or install the deno pip package). pip install doenetml-to-pretext alone does not install Deno.

Installation

pip install doenetml-to-pretext

The wheel bundles the compiled JavaScript converter, but you must supply Deno yourself — either a system install on PATH or pip install deno.

Usage

from doenetml_to_pretext import convert_doenetml_to_pretext

doenetml = '<p>Hello <m>\\frac{1}{2}</m></p>'
pretext_xml = convert_doenetml_to_pretext(doenetml)
print(pretext_xml)

Requirements

  • Python 3.8+
  • Deno

API

convert_doenetml_to_pretext(doenetml: str, timeout: int = 30000) -> str

Converts a DoenetML XML string to PreTeXt XML.

Parameters:

  • doenetml (str): DoenetML XML source code
  • timeout (int): Timeout in milliseconds for conversion (default: 30000)

Returns:

  • str: PreTeXt XML output

Raises:

  • ConversionError: If conversion fails
  • BrowserError: If browser initialization fails
  • TimeoutError: If conversion times out

Examples

Simple conversion

from doenetml_to_pretext import convert_doenetml_to_pretext

xml = '<p>Test</p>'
result = convert_doenetml_to_pretext(xml)

With error handling

from doenetml_to_pretext import convert_doenetml_to_pretext, ConversionError

try:
    result = convert_doenetml_to_pretext('<p>Test</p>')
except ConversionError as e:
    print(f"Conversion failed: {e}")

Development

Install dev dependencies:

pip install -e ".[dev]"

Build a wheel (.whl) (might need pip install build first):

python -m build --wheel

The built wheel will be placed in dist/.

Run tests:

pytest

Publishing

Releases are published to PyPI automatically by the publish-doenetml-to-pretext-python.yml GitHub Actions workflow, using Trusted Publishing (OIDC) — no API token is stored.

  • Version: derived from packages/doenetml/package.json, so it stays in lockstep with @doenet/doenetml. There is no separate version to bump here.
  • Trigger: GitHub release events only (the same trigger as the npm production release), never pushes to main. Cutting a release whose tag matches the doenetml version publishes the matching wheel.
  • Dry run: the workflow can be run manually (workflow_dispatch) targeting TestPyPI to validate packaging before a real release.

The wheel bundles the built JS assets from ../doenetml-to-pretext, so that package must be built first; the workflow (and the npm run build wireit graph) handles this automatically.

License

AGPL-3.0-or-later

Metadata

Release files for doenetml-to-pretext 0.7.29

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

Built distribution (wheel)

Table of built distributions (wheels) for doenetml-to-pretext 0.7.29
File Interpreter ABI Platform Actions
doenetml_to_pretext-0.7.29-py3-none-any.whl Python 3 none any Details for doenetml_to_pretext-0.7.29-py3-none-any.whl

Release files / doenetml_to_pretext-0.7.29-py3-none-any.whl

Download URL doenetml_to_pretext-0.7.29-py3-none-any.whl
Size 3.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
ac38562c43e74936a3b1e8c983542e97550d9290bface2e499b1a6ee01fb5357
BLAKE2b-256 checksum
How to use checksums
12d13be5ad6856e4b0beb2a07d161900a9a981b05654e3649c5d65741250c648
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for doenetml-to-pretext 0.7.29

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 1 file in this release has been uploaded with provenance metadata.

Attestation for doenetml_to_pretext-0.7.29-py3-none-any.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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