Skip to main content

Tools to work with USFM references

Project description

USFM-References

Build Status Coverage Status

A validator for USFM (Unified Standard Format Markers) Biblical references

Requirements

This project requires Python 3.5 or higher

Installation

To install use

pip install usfm-references

Usage

Import one of the methods like

from usfm_references import valid_chapter, valid_chapter_or_intro, valid_usfm, valid_verse

The validation methods all start with valid_. They take a single parameter which should be a string representation of a USMF reference. And they all return a boolean value representing whether the string was valid for the type that the method is validating against.

For example, if you have a string my_reference with a reference of Genesis 1:1, the appropriate USFM reference would be GEN.1.1. You could use the valid_verse method to ensure it is correct like

if valid_verse(my_reference):
    # do stuff

NOTE: These validators match a regular expression pattern. That conforms to the general USFM standard. They do NOT ensure that the USFM actually exists in any particular Bible version.

The currently supported validators are:

  • valid_chapter - Ensures the passed string is a valid USFM chapter reference
  • valid_chapter_or_intro - Ensures the passed string is either a valid USFM chapter or intro reference
  • valid_usfm - Ensures the passed string is a valid USFM reference (can be verse, chapter, or intro)
  • valid_verse - Ensures the passed string is a valid USFM verse reference

Development

This project was written with Python 3.6 and is tested in CI with Python 3.5-3.6. One of these must be installed before developing and testing locally.

On a mac you can use the following commands to get up and running.

brew install python3.6

otherwise run

brew upgrade python3.6

to make sure you have an up to date version.

This project uses pipenv for dependency management. Install pipenv

pip3 install pipenv

setup the project env

pipenv install --three --dev

create a .env file using this sample

export PYTHONPATH=`pwd`

now load virtualenv and any .env file

pipenv shell

Running tests

./linters.sh && pytest --cov=usfm_references tests/

Before committing any code

We have a pre-commit hook which should be setup. You can symlink it to run before each commit by changing directory to the repo and running

cd .git/hooks
ln -s ../../pre-commit pre-commit

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

USFM References-1.0.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

USFM_References-1.0.2-py2.py3-none-any.whl (3.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file USFM References-1.0.2.tar.gz.

File metadata

  • Download URL: USFM References-1.0.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5

File hashes

Hashes for USFM References-1.0.2.tar.gz
Algorithm Hash digest
SHA256 84f9311b5bcd504d1b823da4f4c7b86ce81956613ce64cdd400f244fe30c995f
MD5 cebd9e81fd797274a17f24acf0f4d36f
BLAKE2b-256 f5414b26d2545733cd02b5942e463c868a9eb78a08770f2e6c8514bb3b5c1c56

See more details on using hashes here.

File details

Details for the file USFM_References-1.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: USFM_References-1.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5

File hashes

Hashes for USFM_References-1.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fec2ba5843cfce31cd7fb0ecb9b8d26a31cd972f47bef11e1cc5abea62287b2b
MD5 2486bea52929b29ee733c14cfad3a345
BLAKE2b-256 db7d7632926380fe1cf1b3468b22c80a0aef2ee56a050442c008587be3df1838

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