Skip to main content

Command line tools for building and modifying stenography dictionary files.

Project description

stenodict-cli

Tools for building and modifying stenography dictionary files, with Plover-focused workflows.

CLI

Install from PyPI:

pip install stenodict-cli

Commands:

  • convert - Convert Markdown dictionaries to JSON.
  • expand - Expand a template using entry sources to create a JSON dictionary that contains all combinations.
  • remap - Remap strokes in JSON dictionaries to exclude strokes that appear in given Markdown dictionaries.
  • merge - Merge Markdown and JSON dictionaries into one JSON output.

convert

Converts one or more Markdown sources into JSON. If --output is a .json file, all inputs are merged into that file. If --output is a directory, each source is converted to a separate JSON file preserving its relative path. Use --exclude to skip files or folders by regex.

stenodict convert \
  --input /path/to/md/sources \
  --input /path/to/extra/md \
  --output /path/to/output/json \
  --exclude "modifier-keys" \
  --quiet
stenodict convert \
  --input /path/to/md/sources \
  --output /path/to/output/combined.json

Input Format

Source files are Markdown documents that contain YAML code blocks:

# Navigation

## Navigation Keys

```yaml
-FPL: '{}{#up}' # Up
-RBG: '{}{#down}' # Down
-FR: '{}{#left}' # Left
-LG: '{}{#right}' # Right
```

expand

Expands template entries into a JSON dictionary that contains all combinations. Each template line defines an outline pattern and translation pattern using <outline> and <translation> placeholders. Each entry file provides outline → translation mappings that are substituted into the template to produce final dictionary entries. If --output is a .json file, the result is written there. If --output is a directory, the output filename matches the template source filename with a .json extension.

Templates and entries are Markdown files that contain YAML code blocks. You can also pass an inline template string. See the file format examples below.

stenodict expand \
  --template /path/to/modifier-keys.md \
  --entries /path/to/entries.md \
  --entries /path/to/extra-entries.md \
  --output /path/to/output/directory/ \
  --quiet
stenodict expand \
  --template /path/to/modifier-keys.md \
  --entries /path/to/entries.md \
  --output /path/to/output/modifier-keys.json
stenodict expand \
  --template "<outline>: '{^}<translation>'" \
  --entries /path/to/entries.md \
  --output /path/to/output/inline.json

Template Format

Use <outline> and <translation> placeholders in your template. Each entry in the entry files supplies both parts and will be expanded into a full stroke/translation pair.

# Modifier Keys

```yaml
PWA/<outline>: '{#option(<translation>)}' # Option
KPWA/<outline>: '{#option(control(<translation>))}' # Option+Control
SKPWA/<outline>: '{#option(control(shift(<translation>)))}' # Option+Control+Shift
```

Entries Format

Entry files are plain YAML mappings from outline to translation. These are the values substituted into <outline> and <translation> in the template.

# Keys

```yaml
A: '{^}a' # a
TPW-R: '{#F1}' # F1
-FRPB: '{}{#backspace}' # Backspace
K-BG: '{^,}' # Comma
KW-PL: '{?}' # Question Mark (Leading space)
```

remap

Remaps strokes in JSON dictionaries using stroke lists from .md files. --input and --entries accept a file or directory and can be repeated. If --output is a .json file, all inputs are merged into it. If --output is a directory, each input file is written to a corresponding output path. Use --exclude to skip stroke list files by regex.

stenodict remap \
  --input /path/to/input.json \
  --input /path/to/more/input.json \
  --entries /path/to/remap-md \
  --output /path/to/output.json \
  --quiet

Remap Entries Format

The remap entries inputs are Markdown documents that contain YAML code blocks.

# Keys

## Letters

```yaml
A: '{^}a' # a
AP: '{^}A' # A
-B: '{^}b' # b
P-B: '{^}B' # B
KR: '{^}c' # c
KR-P: '{^}C' # C
```

merge

Merges Markdown and JSON dictionaries into a single JSON output. Inputs can be .md or .json files, or directories that contain them. Use --exclude to skip files by regex. Use --on-conflict to control duplicate strokes (error, error-delete-output, keep-first, or keep-last). error-delete-output removes the output file before raising.

stenodict merge \
  --input /path/to/md \
  --input /path/to/dicts.json \
  --output /path/to/merged.json \
  --on-conflict keep-last \
  --quiet

Development

Set up a local environment with uv and run from source:

uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"
stenodict --help

Install the pre-commit hook and run checks:

pre-commit install
pre-commit run --all-files

Testing

Run the test suite with pytest:

pytest

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

stenodict_cli-0.1.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

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

stenodict_cli-0.1.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file stenodict_cli-0.1.0.tar.gz.

File metadata

  • Download URL: stenodict_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for stenodict_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 939026b9c951d60abbd6906317305d534128e670ba06e4822fcd4a3e747c51e7
MD5 dc98e035c9c70da3f7c02ce708b1ceaa
BLAKE2b-256 a548e8d9fa7a151d66153af2cd9a226bbcdfcbc1c0dccd83e39fcf2a715d93e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for stenodict_cli-0.1.0.tar.gz:

Publisher: publish.yml on mkrnr/stenodict-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stenodict_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: stenodict_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for stenodict_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 314b9ec18cf92d1b91d5358f2e99886c6f9a250558d2074078e96a7d29873ef8
MD5 db32546a9ba63f10de1eef81a6bd5367
BLAKE2b-256 7a6d83d048a0b484b55499a327e69d2aa6aab8f4d7b136e57249aadb4bcfdfa7

See more details on using hashes here.

Provenance

The following attestation bundles were made for stenodict_cli-0.1.0-py3-none-any.whl:

Publisher: publish.yml on mkrnr/stenodict-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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