Skip to main content

A Python package to retrieving Bible references with ease.

Project description

getBible Librarian

Stable Librarian

The getBible Librarian package is a Python library designed for efficiently retrieving the scripture reference across various translations.

Installation

pip install getbible

Features

Get Scripture

import json
from getbible import GetBible

# Initialize the class
getbible = GetBible()

# Get the scripture as JSON
scripture_json = getbible.scripture("Genesis 1:1")
print(scripture_json)  # Outputs the JSON scripture as a string.

# Get the scripture as dictionary
scripture_dict = getbible.select("Genesis 1:1")
print(json.dumps(scripture_dict, indent=4))  # Pretty-prints the dictionary.

Using Translation Abbreviations

When utilizing the GetBible class to look up a reference, you can use the lowercase abbreviations of the target translation:

import json
from getbible import GetBible

# Initialize the class
getbible = GetBible()

scripture = getbible.select("Genesis 1:1-5", 'aov')
print(json.dumps(scripture, indent=4))  # Pretty-prints the dictionary.

In this code snippet, "aov" is used as the abbreviation for the Afrikaans Ou Vertaaling.

Get Reference

from getbible import GetBibleReference

# Initialize the class
get = GetBibleReference()

# Find well form reference
reference = get.ref("Genesis 1:1-5")
print(reference)  # Outputs the dataclass [BookReference] { book: int, chapter: int, verses: list }

Using Translation Abbreviations

When utilizing the GetBibleReference class to look up a reference, you can use the lowercase abbreviations of the target translation:

from getbible import GetBibleReference

# Initialize the class
get = GetBibleReference()

reference = get.ref("Genesis 1:1-5", 'kjv')

In this code snippet, "kjv" is used as the abbreviation for the King James Version to speedup the search.

Get Book Number

from getbible import GetBibleBookNumber

# Initialize the class
get_book = GetBibleBookNumber()

# Find a book number
book_number = get_book.number("Genesis")
print(book_number)  # Outputs the book number of "Genesis" = 1

Available Translations and Abbreviations

The GetBibleBookNumber package supports a range of Bible translations, each identified by a lowercase abbreviation. These abbreviations and the corresponding translation data are stored in the data folder.

Finding Translation Abbreviations

To find the available translation abbreviations:

  1. Go to the data directory in the package.
  2. Each JSON file in this directory corresponds to a different translation.
  3. The file name (without the .json extension) represents the abbreviation for that translation.

For instance, if you find a file named kjv.json, then kjv is the abbreviation for the King James Version translation.

Using Translation Abbreviations

When utilizing the GetBibleBookNumber class to look up a book number, you should use these lowercase abbreviations:

book_number = get_book.number("Gen", "kjv", ["aov", "swahili"])

In this code snippet, "kjv" is used as the abbreviation for the King James Version, "aov" for the Afrikaans Ou Vertaaling, and "swahili" for the Swahili Version.

Source Installation (git)

To install getBible Librarian, you need to clone the repository and install the package manually. Ensure you have Python 3.7 or higher installed.

git clone https://git.vdm.dev/getBible/librarian.git
cd librarian
pip install .

Development and Testing

To contribute or run tests, clone the repository and set up a virtual environment:

git clone https://git.vdm.dev/getBible/librarian.git
cd librarian
python -m venv venv
source venv/bin/activate  # On Windows use `venv\Scripts\activate`
pip install -e .

Run tests using the standard unittest framework:

python -m unittest

Contributing

Contributions to the getbible Librarian package are welcome. Please ensure to follow the coding standards and write tests for new features.

License

This project is licensed under the GNU GPL v2.0. See the LICENSE file for more details.

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

getbible-1.0.1.tar.gz (75.8 kB view details)

Uploaded Source

Built Distribution

getbible-1.0.1-py3-none-any.whl (90.2 kB view details)

Uploaded Python 3

File details

Details for the file getbible-1.0.1.tar.gz.

File metadata

  • Download URL: getbible-1.0.1.tar.gz
  • Upload date:
  • Size: 75.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for getbible-1.0.1.tar.gz
Algorithm Hash digest
SHA256 25f0b9f909ae0f85ddcf2486922a4934030f09d989bf99940b0747651813ce1c
MD5 5868b414cf469ac7db70f10b0f68d8de
BLAKE2b-256 6aa6c815c6897e7ccc0d89295e35c77bce8a0383b0bcb6c0da5d33ab5c6af3d4

See more details on using hashes here.

File details

Details for the file getbible-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: getbible-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 90.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for getbible-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 092b2516e4906ef466c86db3c5137fb5c4368a7fe0ff7dbf02f77f63cd50343b
MD5 66c5355a1b1d617d093ffd3669131e53
BLAKE2b-256 fe009e00d8eabadb91324ab8cf55ac72d9445075e5268ca2529bd4144e796a2b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page