USFMTC Module
Introduction
The USFMTC module is a module for reading and writing USFM scripture files in all their formats: USFM, USX and USJ. It is designed to be a reference implementation of the standard. It also has support for Scripture References.
import sys, usfmtc
from usfmtc.versification import cached_versification
from usfmtc.reference import Ref, RefList
engvrs = cached_versification("eng") # can also be a path to a .vrs file
usxdoc = usfmtc.readFile(sys.argv[1])
usxdoc.canonicalise()
# usxdoc.reversify(engvrs, None)
usxdoc.saveAs(sys.argv[2])
r = Ref("ISA 9:1-4") # returns a RefRange
canr = engvrs.remap(r, None) # one way conversion
print(canr) # prints "ISA 8:23-9:3"
rlist = RefList("JHN 3:16, GEN 1:1, PSA 23, ISA 53, PSA 23:1")
print(rlist.simplify()) # GEN 1:1; PSA 23; ISA 53; JHN 3:16
print(Ref("PSA 23").end()) # PSA 23:6
print(Ref("PSA 23:10").isvalid()) # False
newdoc = usxdoc.getrefs(Ref("PSA 23:2-4"))
print(newdoc.outUsfm(None)) # A new doc of just PSA 23:2-4
The internal representation of the data is as an ElementTree structure conforming to the USX standard.
See the tests/test_\*.py files for more examples. See also pydoc usfmtc.
Utilities
usfmtc comes with a few utilities:
- usfmconv: Converts from one serialisation to another, optionally extracting
references and changing the versification (
-f,-t) - usfmmodule: Flattens a Paratext module into plain USFM/USX
- urnc2rng: Convert to relax-NG
Installation
python3 -m venv venv
source venv/bin/activate
pip install .
To install the dev profile with extra optional dependencies:
pip install .[dev]
Metadata
Release files for usfmtc 0.4.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| usfmtc-0.4.11.tar.gz | 177.1 kB | Without provenance | Details for usfmtc-0.4.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| usfmtc-0.4.11-py3-none-any.whl | Python 3 | none | any | Details for usfmtc-0.4.11-py3-none-any.whl |
Total release size: 321.8 kB
Release files / usfmtc-0.4.11.tar.gz
| Download URL | usfmtc-0.4.11.tar.gz |
|---|---|
| Size | 177.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e846ffefb72d112a4e3aa4e8d0cb3d3d1e5829f98afe2d4bc400387a1c83c2d5
|
|
BLAKE2b-256 checksum How to use checksums |
e08a6ec09b939d3c0987ed50d7fe4d5671d48ac305b1fd2791a99adaf112aa5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / usfmtc-0.4.11-py3-none-any.whl
| Download URL | usfmtc-0.4.11-py3-none-any.whl |
|---|---|
| Size | 144.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d719b63ecfc8d9bcaa8b19b86c381120ff0e40b7d73b2ceab0be0da9293cdb36
|
|
BLAKE2b-256 checksum How to use checksums |
b2d72a64f9cd5314ad234c832a587aad0fb71f4e93d7d8e6a24061e191f17588
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for usfmtc 0.4.11
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.