Usfm2Dict
A Python package for converting USFM (Unified Standard Format Markers) files to a dictionary format.
Credit
This package was ripped out of https://github.com/sillsdev/machine.py (sil-machine) so that it could function as more of a discreet dependency. machine.py was developed by the SIL International team and is MIT licensed. Thank you for your work!
Installation
pip install usfm2dict
Usage
Command Line
# Convert a single USFM file
usfm2dict path/to/file.usfm
# Convert multiple files
usfm2dict path/to/file1.usfm path/to/file2.usfm
# Use glob patterns
usfm2dict "path/to/*.usfm"
# Output to a file
usfm2dict path/to/file.usfm --output result.json
# Pretty print the output
usfm2dict path/to/file.usfm --pretty
Python API
from usfm2dict import parse_usfm_file, UsfmParser
# Parse a file
verses = parse_usfm_file("path/to/file.usfm")
# Or use the parser directly
parser = UsfmParser()
with open("path/to/file.usfm", "r", encoding="utf-8") as f:
content = f.read()
verses = parser.parse(content)
# Result is a dictionary with verse references as keys
print(verses["GEN 1:1"]) # "In the beginning God created the heavens and the earth."
License
MIT
Metadata
Release files for usfm2dict 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| usfm2dict-0.1.3.tar.gz | 10.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| usfm2dict-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.6 kB
Release files / usfm2dict-0.1.3.tar.gz
| Download URL | usfm2dict-0.1.3.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
28a356f26b6960703e56af467e93e8452183eae9a68ff1612c3d000f1ca84864
|
|
BLAKE2b-256 checksum How to use checksums |
22652804922a46aef826c5fa281d75780e64938e4ce13d931833f418acc92520
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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 May 7, 2025.
Transparency logRelease files / usfm2dict-0.1.3-py3-none-any.whl
| Download URL | usfm2dict-0.1.3-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
081b99bacc62188b3911db78f3139a97a356b7dbcbd4c9734ee7cf03e840b2ad
|
|
BLAKE2b-256 checksum How to use checksums |
a265f59087325c94e3c3bac10bade74effca4a5bffee5a27a6f084f11288277c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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 May 7, 2025.
Transparency log