5
0
Fork 0

Adds getBible to the https://pypi.org/project/getbible/ project, and updated all documentation and workflows to now point to this package.

This commit is contained in:
Llewellyn van der Merwe 2023-11-14 18:15:36 +02:00
parent a2b95224b1
commit 7d945d1331
Signed by: Llewellyn
GPG Key ID: A9201372263741E7
7 changed files with 114 additions and 345 deletions

View File

@ -54,14 +54,10 @@ jobs:
run: |
python -m build
- name: Configure .pypirc
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
echo "[distutils]" > ~/.pypirc
echo "index-servers = getbible" >> ~/.pypirc
echo "[getbible]" >> ~/.pypirc
echo "repository = https://${{ secrets.GITEA_URL }}/api/packages/${{ github.repository_owner }}/pypi" >> ~/.pypirc
echo "username = ${{ secrets.GITEA_USERNAME }}" >> ~/.pypirc
echo "password = ${{ secrets.GITEA_TOKEN }}" >> ~/.pypirc
twine upload dist/*
- name: Push to Gitea
run: python3 -m twine upload --repository getbible dist/*

116
README.md
View File

@ -2,21 +2,119 @@
[![Stable Librarian](https://github.com/getbible/librarian/actions/workflows/stable-librarian.yml/badge.svg)](https://github.com/getbible/librarian/actions/workflows/stable-librarian.yml)
The `getBible Librarian` package is a Python library designed for efficiently retrieving the scripture reference across various translations.
The `getBible` Librarian package is a Python library designed for efficiently retrieving the scripture reference across various translations.
## Installation
```bash
pip install getbible
```
## Features
- [Get Scripture](https://git.vdm.dev/getBible/librarian/src/branch/master/docs/getbible_scripture.md)
- [Get Reference](https://git.vdm.dev/getBible/librarian/src/branch/master/docs/getbible_reference.md)
- [Get Book Number](https://git.vdm.dev/getBible/librarian/src/branch/master/docs/getbible_book_number.md)
### Get Scripture
## Installation (pip)
```python
import json
from getbible import GetBible
To install the package using pip, see [the documentation](https://git.vdm.dev/getBible/-/packages/pypi/getbible-librarian).
# Initialize the class
getbible = GetBible()
## Installation (git)
# Get the scripture as JSON
scripture_json = getbible.scripture("Genesis 1:1")
print(scripture_json) # Outputs the JSON scripture as a string.
To install `getBible-Librarian`, you need to clone the repository and install the package manually. Ensure you have Python 3.7 or higher installed.
# 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:
```python
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
```python
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:
```python
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
```python
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](https://git.vdm.dev/getBible/librarian/src/branch/master/src/getbible/data).
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:
```python
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.
```bash
git clone https://git.vdm.dev/getBible/librarian.git
@ -44,7 +142,7 @@ 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.
Contributions to the `getbible` Librarian package are welcome. Please ensure to follow the coding standards and write tests for new features.
## License

View File

@ -1,90 +0,0 @@
# getBible Book Number
The `GetBibleBookNumber` package is a Python library designed for efficiently retrieving the book number of Bible references across various translations. It utilizes a Trie data structure to store and search through a comprehensive list of book references. This package is particularly useful for applications dealing with biblical texts where quick and accurate reference to book numbers is needed.
## Features
- Supports multiple Bible translations. (57)
- Efficient search using Trie data structure.
- Dynamically loads translation data from JSON files.
- Provides functionality to dump Trie data into a JSON file for review.
- Fallback search mechanisms for comprehensive reference coverage.
## Installation (pip)
To install the package using pip, see [the documentation](https://git.vdm.dev/getBible/-/packages/pypi/getbible-librarian).
## Installation (git)
To install `GetBibleBookNumber`, you need to clone the repository and install the package manually. Ensure you have Python 3.7 or higher installed.
```bash
git clone https://git.vdm.dev/getBible/booknumber.git
cd booknumber
pip install .
```
## Usage
### Basic Usage
```python
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"
```
## 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:
```python
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.
## Development and Testing
To contribute or run tests, clone the repository and set up a virtual environment:
```bash
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:
```bash
python -m unittest tests.test_getbible_book_number
```
## Contributing
Contributions to the `GetBibleBookNumber` class is 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.

View File

@ -1,79 +0,0 @@
# Guide to Building and Deploying a GetBible Package to Our Gitea's PyPI Package Registry
This guide focuses on building your Python package and deploying it to your Gitea system's PyPI package registry. The provided documentation gives a clear outline of the requirements and steps needed.
## Prerequisites
- Python and necessary build tools installed.
- `pip` for package installation.
- `twine` for package uploading.
## Step 1: Building the Python Package
### 1.1 Create a Source Distribution
Navigate to your package directory and run:
```bash
python setup.py sdist
```
This creates a source distribution in the `dist/` folder.
### 1.2 Create a Wheel Distribution
For a wheel (`.whl`) distribution:
```bash
python setup.py bdist_wheel
```
This places a wheel file in the `dist/` folder.
## Step 2: Configuring the Package Registry
### 2.1 Edit `~/.pypirc`
Add the following to your `~/.pypirc` file:
```ini
[distutils]
index-servers = getbible
[getbible]
repository = https://git.vdm.dev/api/packages/getbible/pypi
username = {username}
password = {token}
```
Replace `{owner}`, `{username}`, and `{token}` with your Gitea details.
For more information on the PyPI registry, [see the documentation](https://docs.gitea.com/usage/packages/pypi/).
## Step 3: Publish the Package
### 3.1 Upload Package
Run the following command to upload your package:
```bash
python3 -m twine upload --repository getbible dist/*
```
This uploads all files in the `dist/` directory (`.tar.gz` and `.whl`).
**Note:** You cannot publish a package if a package of the same name and version already exists.
## Step 4: Install the Package
### 4.1 Install Using pip
To install a package from the Gitea package registry:
```bash
pip install --index-url https://git.vdm.dev/api/packages/getBible/pypi/simple/ getBible-librarian
```
## Conclusion
You now have a straightforward process for building and deploying a Python package to your Gitea system's PyPI package registry. This setup ensures a seamless workflow for managing and distributing Python packages within your organization or for personal use.

View File

@ -1,72 +0,0 @@
# GetBible Reference
The `GetBibleReference` package is a Python library designed for efficiently retrieving the book number, chapter and verses of Bible reference across various translations.
## Features
- Returns well formed book-number, chatper-number, and verse array when given any scripture text reference.
## Installation (pip)
To install the package using pip, see [the documentation](https://git.vdm.dev/getBible/-/packages/pypi/getbible-librarian).
## Installation (git)
To install `GetBibleReference`, you need to clone the repository and install the package manually. Ensure you have Python 3.7 or higher installed.
```bash
git clone https://git.vdm.dev/getBible/librarian.git
cd librarian
pip install .
```
## Usage
### Basic Usage
```python
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:
```python
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.
## Development and Testing
To contribute or run tests, clone the repository and set up a virtual environment:
```bash
git clone https://git.vdm.dev/getBible/librarian.git
cd reference
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
pip install -e .
```
Run tests using the standard unittest framework:
```bash
python -m unittest tests.test_getbible_reference
```
## Contributing
Contributions to the `GetBibleReference` class is 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.

View File

@ -1,84 +0,0 @@
# GetBible Scripture
The `GetBible` package is a Python library designed for efficiently retrieving scripture across various translations.
## Features
- Returns a selected range of referenced scripture passages.
## Installation (pip)
To install the package using pip, see [the documentation](https://git.vdm.dev/getBible/-/packages/pypi/getbible-librarian).
## Installation (git)
To install `GetBible`, you need to clone the repository and install the package manually. Ensure you have Python 3.7 or higher installed.
```bash
git clone https://git.vdm.dev/getBible/librarian.git
cd librarian
pip install .
```
## Usage
### Basic Usage
```python
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:
```python
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.
## Development and Testing
To contribute or run tests, clone the repository and set up a virtual environment:
```bash
git clone https://git.vdm.dev/getBible/librarian.git
cd reference
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
pip install -e .
```
Run tests using the standard unittest framework:
```bash
python -m unittest tests.test_getbible
```
## Contributing
Contributions to the `GetBible` class is 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.

View File

@ -4,8 +4,8 @@ with open('README.md', 'r', encoding='utf-8') as f:
long_description = f.read()
setup(
name="getBible-librarian",
version="0.2.2",
name="getbible",
version="1.0.0",
author="Llewellyn van der Merwe",
author_email="getbible@vdm.io",
description="A Python package to retrieving Bible references with ease.",