Biblelib
Utilities for working with Bible books, references, pericopes, and other units. Note this does not include any actual Bible texts.
- Github repository: <https://github.com/Clear-Bible/Biblelib
- Documentation may eventually arrive at
https://clear-bible.github.io/Biblelib/ but can be found in the
docsdirectory, and built usingmkdocs.
Installation
$ pip install biblelib
Data
Most data ships inside the package (book metadata, versification vref files and scheme JSON), so the library works offline out of the box.
The two large Macula word-level mapping tables (used by biblelib.word.mappings
and biblelib.word.fromubs) are the exception: they are downloaded on first use
and cached locally, rather than bundled. They are verified against pinned SHA256
hashes.
-
The cache location follows the OS convention (e.g.
~/Library/Caches/biblelibon macOS,~/.cache/biblelibon Linux). Set theBIBLELIB_DATA_DIRenvironment variable to relocate it. -
To pre-populate the cache while online — for offline/air-gapped use, or to avoid concurrent downloads when running a parallel (pytest-xdist) test suite — run the bundled command:
$ biblelib-download-data
Importing biblelib and biblelib.word never triggers a download; data is
fetched only when a mapping is actually used.
Usage
Book metadata
from biblelib.book import Books
books = Books()
books["MRK"] # <Book: MRK>
books["MRK"].name # 'Mark'
books["MRK"].osisID # 'Mark'
books.fromosis("Matt").name # 'Matthew'
books.frombiblia("Mk").usfmname # 'MRK'
books.findbook("Ge") # <Book: GEN> (searches all schemes)
Rendering Bible references
BCVID (book-chapter-verse) and BCVIDRange are the primary reference types. Several rendering methods are available:
from biblelib.word import BCVID, BCVIDRange
ref = BCVID("41004003") # Mark 4:3
ref.to_usfm() # 'MRK 4:3'
ref.to_nameref() # 'Mark 4:3' (full English name)
ref.to_abbrevref() # 'Mk 4:3' (biblia abbreviation)
ref.to_osisID() # 'Mark 4:3'
ref.to_biblia() # 'Mk 4:3'
rng = BCVIDRange(BCVID("41004003"), BCVID("41004008"))
rng.to_nameref() # 'Mark 4:3-4:8'
rng.to_abbrevref() # 'Mk 4:3-4:8'
Localized rendering
to_nameref() and to_abbrevref() accept an optional lang parameter using ISO 639-3 three-letter codes. The following languages are currently bundled:
| Code | Language | Source translation |
|---|---|---|
apd |
Sudanese Arabic | Van Dyck Bible (OT); Biblica Sudanese Arabic NT |
arb |
Arabic | Van Dyck Bible (Smith-Van Dyck, 1865) |
bis |
Bislama | Baibel long Bislama (BSSP, 1995) |
fra |
French | Bible en français courant / Louis Segond |
hau |
Hausa | Littafi Mai Tsarki (Bible Society of Nigeria) |
hin |
Hindi | Bible Society of India Hindi Old Version (Re-edited) |
ibo |
Igbo | Akwụkwọ Nsọ (Bible Society of Nigeria) |
ind |
Indonesian | Terjemahan Baru (LAI, 1974/rev.) |
nep |
Nepali | Pavitra Grantha (Nepal Bible Society) |
nld |
Dutch | Herziene Statenvertaling (HSV, 2010) |
por |
Portuguese | Almeida Revista e Corrigida |
rus |
Russian | Synodal Translation (Синодальный перевод, 1876) |
spa |
Spanish | Reina-Valera / NVI |
swh |
Swahili | Swahili Union Version (Toleo la Umoja) |
tpi |
Tok Pisin | Baibel long Tok Pisin (BSPNG, 1989) |
vie |
Vietnamese | Kinh Thánh Tin Lành 1925 |
zhs |
Chinese (Simplified) | Chinese Union Version Simplified (和合本简体) |
zht |
Chinese (Traditional) | Chinese Union Version Traditional (和合本) |
zlm |
Malay | Alkitab dalam Bahasa Malaysia (BSM/BSS) |
Note: Non-English book names and abbreviations were AI-generated from the named source translations and should be verified by native-language speakers before production use, particularly for deuterocanonical and extended-canon entries.
from biblelib.word import BCVID, BCVIDRange
ref = BCVID("01001001")
ref.to_nameref(lang="fra") # 'Genèse 1.1'
ref.to_abbrevref(lang="fra") # 'Gn 1.1'
ref.to_nameref(lang="nld") # 'Genesis 1:1'
ref.to_abbrevref(lang="hau") # 'Far 1:1'
ref.to_nameref(lang="vie") # 'Sáng Thế Ký 1:1'
ref.to_abbrevref(lang="vie") # 'St 1:1'
rng = BCVIDRange(BCVID("41004003"), BCVID("41004008"))
rng.to_nameref(lang="fra") # 'Marc 4.3-4.8'
rng.to_abbrevref(lang="fra") # 'Mc 4.3-4.8'
Note that the chapter-verse separator is language-specific (English and most languages use :, French uses .).
You can also work with LocalizedBooks directly:
from biblelib.book import get_localized_books
fra = get_localized_books("fra")
fra.get_name("GEN") # 'Genèse'
fra.get_abbrev("GEN") # 'Gn'
fra.cv_sep # '.'
Adding a language
Create biblelib/book/books_<lang>.tsv (e.g. books_spa.tsv for Spanish) with three tab-separated columns and optional metadata comments:
# cv_sep: .
usfmname name abbrev
GEN Génesis Gn
EXO Éxodo Éx
...
Supported metadata comments:
| Key | Description | Default |
|---|---|---|
cv_sep |
Chapter-verse separator character | : |
No code changes are required. The new language is available immediately via lang="spa" (or whatever code you used).
Acknowledgements
- Book abbreviations incorporate public conventions developed by
- Unified Standard Format Markers 3.0.0 (USFM), which is © Copyright 2018, United Bible Societies.
- The Open Scripture Information Standard (OSIS)
- Logos Bible Software
- Versification information included consulting sources from:
- Word-level mapping data (downloaded on demand) comes from:
- Clear-Bible/macula-greek: GNT word-level identifier mappings, © Clear Bible, Inc., CC BY 4.0
- Clear-Bible/macula-hebrew: Macula → MARBLE Hebrew mappings, © Clear Bible, Inc., CC BY 4.0
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file biblelib-0.6.0.tar.gz.
File metadata
- Download URL: biblelib-0.6.0.tar.gz
- Upload date:
- Size: 545.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.4.1 CPython/3.14.7 Darwin/25.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef76b39e64faaaa8fc3995e68ce574b9760a24abb519e158668861320a9328db
|
|
| MD5 |
9327ce58235ea39fa5fe09b76f1e09df
|
|
| BLAKE2b-256 |
70abc4830710d775e97a544fd1adbd964938f0cb49ecb5ccec16d49abdda4def
|
File details
Details for the file biblelib-0.6.0-py3-none-any.whl.
File metadata
- Download URL: biblelib-0.6.0-py3-none-any.whl
- Upload date:
- Size: 561.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.4.1 CPython/3.14.7 Darwin/25.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbd1d4a7197fe896c757f970dc4497dd3fb26da18400d2fbd35678d9be12868a
|
|
| MD5 |
31cc8754a7eba0115f0d8c38b454e9fd
|
|
| BLAKE2b-256 |
3ef8ec00b6ed163f3c27eb496679bd0bdfed158e76569703f08dfdb494a05109
|