Skip to main content

Bible Organisational System — load, check, and/or export Bible files/folders

Project description

Bible Organisational System / BibleOrgSys / BOS

A library of modules for importing and processing various book/chapter/verse (BCV) texts, including Bibles of course, but also other related BCV materials like Bible commentaries. Multiprocessing is used by default to load Bibles that have separate books in separate files.

This library also includes one app (similar to the demo app below) named Bible2USX which can be run with: Bible2USX path/to/BibleFileOrFolder or to view all the available options: Bible2USX --help You can discover the version with: Bible2USX --version

The BibleOrgSys reads or creates a BibleOrgSysData folder in your home folder. Log files are stored in a subfolder there and may be useful for reporting errors. Output files will also be written by default into a sub-folder there.

NOTE: This packaging is still being tested following massive restructuring, and is not necessarily fully functional until it is marked as v0.1.0 or higher. We also have hopes to improve documentation before v0.2.0.

A future package of apps that use the BOS is also planned for release. After that point, we also hope to release Docker and Snap versions.

This software has been developed in small chunks of spare time since 2010 (so it's not necessarily well-thought out, and definitely not polished). However, it has been tested on hundreds of Bible filesets, including USFM, OSIS, USX, USFX, and many other import formats.

This library forms the basis of the online Bible Drop Box service hosted at http://Freely-Given.org/Software/BibleDropBox/.

This package will not reach v1.0.0 until versification mapping is added.

The API will not become fixed/stable until the v1.0.0 release.

Other than the multiprocessing mentioned above, no attempt at all has been made at memory or speed optimisations and this is not planned until after the release of v1.0.0.

Here is the code for a simple Bible (e.g., USFM) to USX converter using BibleOrgSys:

#!/usr/bin/env python3
#
# myBible2USX.py (minimal version)
#
# Command-line app to export a USX (XML) Bible.
#
# Copyright (C) 2019-2020 Robert Hunt
# Author: Robert Hunt <Freely.Given.org+BOS@gmail.com>
# License: See gpl-3.0.txt
#
'''
A short command-line app as part of BOS (Bible Organisational System) demos.
This app inputs any known type of Bible file(s) from disk
    and then exports a USX version in the (default) BOSOutputFiles folder
        (inside the BibleOrgSys folder in your home folder).

Note that this app can be run from using the command:
        myBible2USX.py path/to/BibleFileOrFolder

You can discover the version with
        myBible2USX.py --version

You can discover the available command line parameters with
        myBible2USX.py --help

    e.g., for verbose mode
        myBible2USX.py --verbose path/to/BibleFileOrFolder
    or using the abbreviated option
        myBible2USX.py -v path/to/BibleFileOrFolder

This app also demonstrates how little code is required to use the BOS
    to load a Bible (in any of a large range of formats — see UnknownBible.py)
    and then to export it in your desired format (see options in BibleWriter.py).
'''
from BibleOrgSys import BibleOrgSysGlobals
from BibleOrgSys.BibleOrgSysGlobals import vPrint
from BibleOrgSys.UnknownBible import UnknownBible

PROGRAM_NAME = "Bible to USX (minimal)"
PROGRAM_VERSION = '0.09'

# Configure basic Bible Organisational System (BOS) set-up
parser = BibleOrgSysGlobals.setup( PROGRAM_NAME, PROGRAM_VERSION )
parser.add_argument( "inputBibleFileOrFolder", help="path/to/BibleFileOrFolder" )
BibleOrgSysGlobals.addStandardOptionsAndProcess( parser )

# Search for a Bible and attempt to load it
unknownBible = UnknownBible( BibleOrgSysGlobals.commandLineArguments.inputBibleFileOrFolder )
loadedBible = unknownBible.search( autoLoadAlways=True, autoLoadBooks=True ) # Load all the books if we find any

# See if we were successful at loading one (and only one), and if so, do the export
if not isinstance( loadedBible, str ): # i.e., not an error message
    loadedBible.toUSXXML() # Export as USX files (USFM inside XML)
    vPrint( 'Quiet', False, f"\nOutput should be in {BibleOrgSysGlobals.DEFAULT_WRITEABLE_OUTPUT_FOLDERPATH.joinpath( 'BOS_USX2_Export/' )}/ folder." )

# Do the BOS close-down stuff
BibleOrgSysGlobals.closedown( PROGRAM_NAME, PROGRAM_VERSION )

The BOS is developed and well-tested on Linux (Ubuntu) but also runs on Windows (although not so well tested).

See https://ubsicap.github.io/usfm/ for more information about USFM.

See https://ubsicap.github.io/usx/ for more information about USX.

This library forms the basis of the experimental Biblelator Bible translation editor.

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

BibleOrgSys-0.0.13.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

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

BibleOrgSys-0.0.13-py3-none-any.whl (1.8 MB view details)

Uploaded Python 3

File details

Details for the file BibleOrgSys-0.0.13.tar.gz.

File metadata

  • Download URL: BibleOrgSys-0.0.13.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for BibleOrgSys-0.0.13.tar.gz
Algorithm Hash digest
SHA256 0521ca61101484a627dbf433110f78628a33f28d20368a67c4d7ea7298c5543d
MD5 e3e69821f6d90eedac4bbbf0282fbcbd
BLAKE2b-256 b5e25b42231162547e2f0bd7ad8d179755ccfde0fead744fd38b1efdcf86944e

See more details on using hashes here.

File details

Details for the file BibleOrgSys-0.0.13-py3-none-any.whl.

File metadata

  • Download URL: BibleOrgSys-0.0.13-py3-none-any.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for BibleOrgSys-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 b98bd9b99d1f0568eab9a4a49ec1cc5dec80b5cb7fb9f3de6c7e95a33f016cd0
MD5 916a2fc9d8eacc232f10ab660d961edf
BLAKE2b-256 d7f50751e683c25aa3b3859ef27f5e8fe2e1a888512d63dbb03a3e381f495288

See more details on using hashes here.

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