Skip to main content

ssmdconvert

ssmdconvert is a deterministic, local ingestion library and CLI that converts common documents and EPUB books into valid SSMD 0.9. It supports combined document conversion and ordered, standalone SSMD chapters in directory or ZIP book bundles.

SSMD ownership boundary

ssmdconvert owns source ingestion, canonical SSMD conversion, chapter identity, .ssmdbook integrity, SSMD analysis/reporting, and safe write-back. A directory .ssmdbook/ is the editable canonical workspace; .ssmdbook.zip is an immutable portable artifact.

Conceptually, the layers are:

spokenform → ttsready → ssmdconvert

spokenform handles linguistic normalization; ttsready supplies generic preparation and QA through its public Python API; ssmdconvert owns the SSMD application semantics and user-facing workflows. ssmdconvert depends directly on ttsready, not on spokenform. Reports, context, TXT projection, and speech audit/annotate/freeze share one analysis pipeline. The ttsready CLI is not used or re-exported.

Install

python -m pip install ssmdconvert

The base install supports text, Markdown, HTML, EPUB, SSMD analysis, and speech audit/annotation. ttsready>=0.2.2,<0.3 is a core dependency; PDF, DOCX, and spaCy are optional extras:

python -m pip install "ssmdconvert[pdf]"
python -m pip install "ssmdconvert[docx]"
python -m pip install "ssmdconvert[spacy]" # optional local spaCy enrichment
python -m pip install "ssmdconvert[all]"

The spacy extra installs spaCy but no language model. Install a model explicitly, for example:

python -m spacy download en_core_web_sm

SSMDConvert never downloads spaCy or models during conversion. The default is --spacy off; auto uses compatible local models, preferring sm, then md, lg, and trf, and warns/falls back to no hints if none is available. Explicit tiers require the corresponding local model.

Python 3.10 or newer is required. Conversion, analysis, and EPUB extraction run locally. EPUB book conversion freezes safe automatic speech decisions by default; speech audit/annotate/freeze remain available for existing SSMD artifacts and review workflows.

Convert a document

ssmdconvert convert manuscript.txt -o manuscript.ssmd
ssmdconvert convert novel.md -o novel.ssmd
ssmdconvert inspect manuscript.md --json

PDF and DOCX conversion require their corresponding optional extras. Writes are atomic, refuse existing destinations by default, and support --force to replace an existing output. The input file is never a valid output destination, even with --force.

Both convert and book convert accept --sequence-fallback-mode spell|preserve. New conversions default to preserve; spell remains available explicitly. The effective value is stored in standalone SSMD front matter, book manifest metadata, and each generated chapter. The writer default does not change how consumers interpret legacy files or bundles that omit the field.

Use --metadata-file PATH on either conversion command for nested SSMD metadata and bibliographic overrides from a UTF-8 YAML mapping. Source metadata is overridden by the file, explicit CLI values override the file, and the effective sequence fallback option is applied last.

language: de-DE
voice_defaults:
  narrator:
    rate: slow
ssmdconvert convert manuscript.md -o manuscript.ssmd
ssmdconvert book convert novel.epub --language de-DE --metadata-file book-metadata.yaml -o novel.ssmdbook

Create a single-document workspace

Keep an SSMD document in an editable .ssmdoc workspace or a portable ZIP without changing the existing standalone convert command:

ssmdconvert document convert story.ssmd.md
ssmdconvert document validate story.ssmdoc
ssmdconvert document pack story.ssmdoc -o story.ssmdoc.zip
ssmdconvert report story.ssmdoc
ssmdconvert speech freeze story.ssmdoc -o frozen.ssmdoc.zip

A valid SSMD source is copied losslessly when no metadata override is supplied. Dirty workspaces use their current valid text for analysis; refresh is explicit, and speech write-back publishes a new bundle rather than mutating the source. See the single-document workspace guide and document bundle format.

Convert an EPUB book

ssmdconvert book inspect novel.epub --json
ssmdconvert book convert novel.epub --chapters 2-20 -l de-DE -o selected.ssmdbook
ssmdconvert book convert novel.epub -o novel.ssmdbook.zip
ssmdconvert book validate novel.ssmdbook.zip --json
ssmdconvert book metadata novel.ssmdbook.zip
ssmdconvert book metadata novel.ssmdbook.zip --json

Chapter selectors use original 1-based source numbers. Selected chapters remain in source order. Use --format directory or --format zip when the output name does not end in .ssmdbook or .ssmdbook.zip. Bundle destinations are not overwritten unless --force is given; forced directory writes replace the complete prior directory rather than merging files.

Book conversion defaults to --speech-semantics freeze, which materializes safe automatic speech decisions from ttsready/spokenform as explicit SSMD sub annotations without changing visible text. Freeze requires an effective language; use --language to set the base for unscoped text or select --speech-semantics preserve for structural-only conversion. Inline SSMD language spans and existing author-owned speech annotations remain authoritative.

Editing a referenced chapter makes the directory workspace dirty, but workspace loading returns the actual valid SSMD instead of failing on a stale hash. book metadata reports clean/dirty status and dirty chapter count. Use book refresh to update manifest digests and character counts explicitly; book refresh --check does not mutate and exits non-zero when dirty or invalid. book pack creates a strict ZIP from current valid workspace contents without changing the source manifest. The reserved .readio/ directory is downstream local state: it is ignored by validation and never included in ZIP output.

ssmdconvert book refresh novel.ssmdbook --check
ssmdconvert book refresh novel.ssmdbook
ssmdconvert book pack novel.ssmdbook -o novel.ssmdbook.zip

Readio can consume the public load_book_workspace() API directly. Neither loading nor metadata inspection automatically refreshes the manifest or adds Readio-specific manifest fields.

SSMD analysis and speech workflows

Local spaCy and progress

book convert, report, txt, and speech preparation commands accept --spacy off|auto|sm|md|lg|trf; the default is off, so spaCy is never loaded unless selected. auto resolves locally installed models for each effective language; explicit tiers fail clearly if the requested package is missing. SSMDConvert does not download models. Cache identity includes the selected provider/model and their versions, and compatible cache hits skip NLP inference.

Language is resolved per prose run: the innermost inline SSMD language scope wins over the CLI/base-language override, which takes precedence over section/source language and fallback. Thus --language de-DE sets unscoped text to German without erasing an inline French span.

Long-running commands accept --progress / --no-progress. Progress is automatic only when stderr is a TTY; Rich UI is used on a capable terminal, with plain stderr messages otherwise. Explicit --progress enables plain stderr events in non-TTY runs. Progress and warnings never pollute machine-readable stdout; --no-progress disables rendering.

ssmdconvert report novel.ssmdbook.zip --chapters 2-20
ssmdconvert context novel.ssmdbook.zip chg:v1:0123456789abcdef0123456789abcdef
ssmdconvert txt novel.ssmdbook.zip -o prepared.txt
ssmdconvert speech audit novel.ssmdbook.zip --json
ssmdconvert speech annotate chapter.ssmd -o annotated.ssmd
ssmdconvert speech freeze novel.ssmdbook.zip -o frozen.ssmdbook.zip

Reports, context lookup, TXT projection, and speech audit/annotate/freeze use one SSMD-aware analysis pipeline backed by the public ttsready Python API. Speech write-back preserves visible text, requires a new destination by default, and never modifies a directory workspace in place. Cache details, safe write policy, all command options, and migration from the removed ttsready CLI are in the analysis workflow guide.

Python API

The v0.2 facade uses immutable options and typed results. convert_book() returns a BookConversionResult; publication is explicit.

from ssmdconvert import (
    AnalysisOptions,
    BookConversionOptions,
    DocumentConversionOptions,
    SpeechOptions,
    analyze_ssmd,
    convert_book,
    convert_content,
    convert_document,
    inspect_book,
    load_book_bundle,
    write_book_bundle,
)

document = convert_document(
    "manuscript.md",
    options=DocumentConversionOptions(language="en-US"),
)
content = convert_content("# Notes", input_format="markdown", source_name="notes.md")
inspection = inspect_book("novel.epub")
book_result = convert_book(
    "novel.epub",
    options=BookConversionOptions(speech=SpeechOptions(mode="preserve")),
)
analysis = analyze_ssmd(book_result, options=AnalysisOptions(spacy="off"))
write_book_bundle(book_result.book, "novel.ssmdbook", format="directory")
loaded = load_book_bundle("novel.ssmdbook")

The root-level convert() alias was removed. See the Python API reference and v0.2 migration guide for option mappings, analysis/report/TXT workflows, explicit cache behavior, and bundle/workspace APIs.

See the documentation for supported inputs, CLI options, book models, and bundle validation details.

Metadata

Release files for ssmdconvert 0.2.1

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

Source distribution (sdist)

Source distribution for ssmdconvert 0.2.1
File Size Uploaded Provenance Actions
ssmdconvert-0.2.1.tar.gz 188.7 kB Without provenance Details for ssmdconvert-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 310.2 kB

Release files / ssmdconvert-0.2.1.tar.gz

Download URL ssmdconvert-0.2.1.tar.gz
Size 188.7 kB
Tags Source
SHA-256 checksum
How to use checksums
00cdc7147f83736633bc05e3371ab07c25b6b24d33d08b5e8016cbaa5a7fe779
BLAKE2b-256 checksum
How to use checksums
7148dbab243c96efc4c331b9cf6d301776ebdc24c5eebb97aa0e1da9dc2135f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / ssmdconvert-0.2.1-py3-none-any.whl

Download URL ssmdconvert-0.2.1-py3-none-any.whl
Size 121.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
845507696ae22ddfa99e808c04a108d9ad4a82df173a470e7c140ae66bd449bd
BLAKE2b-256 checksum
How to use checksums
c92b2b35ee39158dcf2b6dd025f5630e01b596ce3943a68b82e5b04415525a96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Security for ssmdconvert 0.2.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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