A Python package to retrieving Bible references with ease.
Project description
getBible Librarian
The getBible
Librarian package is a Python library designed for efficiently retrieving the scripture reference across various translations.
Installation
pip install getbible
see package on pypi
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:
- Go to the
data
directory in the package. - Each JSON file in this directory corresponds to a different translation.
- 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
Built Distribution
File details
Details for the file getbible-1.1.2.tar.gz
.
File metadata
- Download URL: getbible-1.1.2.tar.gz
- Upload date:
- Size: 78.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ab8cd391b6c2c2790ced85adb2f0ae9b58b4f9825e0eb83f380599d49835d06 |
|
MD5 | 05a8afdc4cc3a1dd0edb3742403d15ef |
|
BLAKE2b-256 | 409b566aa0d1b95c3f9b93d40e8fb422c1b00fcab2d4abfe3fab64ce49ee8959 |
File details
Details for the file getbible-1.1.2-py3-none-any.whl
.
File metadata
- Download URL: getbible-1.1.2-py3-none-any.whl
- Upload date:
- Size: 92.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4bec044ac9966c7520ab0d05d14b688497212ab4aec42c53d91fb6b37e742c0 |
|
MD5 | be894c2cb6f2f7d084b30bdeddd72996 |
|
BLAKE2b-256 | ce3560f8ba7d3d967ab3c79c9cb9566eb3f39f5b5235ee936f1cb3654820f677 |