Skip to main content

bibleverseparser

A small Python library that parses Bible verse references (like Gen 1:1) into a canonical form (Genesis 1:1).

Supports English, Dutch, Turkish, and Spanish book names, with many common abbreviations.

Installation

pip install bibleverseparser

Quick start

from bibleverseparser import parse_unvalidated_localized_reference

# Parse loose user input
ref = parse_unvalidated_localized_reference("en", "Gen 1:1")
print(ref.canonical_form())  # "Genesis 1:1"

# Handles abbreviations, spacing variations, and different separators
ref = parse_unvalidated_localized_reference("en", "1 Cor 13:4-7")
print(ref.canonical_form())  # "1 Corinthians 13:4-7"

# Returns None for unparseable input
result = parse_unvalidated_localized_reference("en", "not a verse")
assert result is None

Features

  • Loose parsing: accepts common abbreviations (Gen, Gen., Ge., etc.), flexible whitespace, and alternative verse/chapter separators (:, v, .)
  • Strict parsing: validates that a reference is already in canonical form
  • Multi-language: English (en), Dutch (nl), Turkish (tr), Spanish (es)
  • Verse ranges: Genesis 1:1-3, Genesis 1:2-3:4
  • Whole chapters: Genesis 1
  • Whole books: Genesis
  • Validation: checks chapter/verse bounds, correct ordering
  • Translation: convert references between languages
  • Fully typed: includes py.typed marker and type hints throughout

API

parse_unvalidated_localized_reference(language_code, reference, *, allow_whole_book=True, allow_whole_chapter=True)

Parse user input. Returns a ParsedReference or None if it doesn't look like a reference. Raises InvalidVerseReference if it parses but is invalid (e.g. end verse before start verse).

parse_validated_localized_reference(language_code, reference)

Parse a reference that is expected to be in canonical form. Raises InvalidVerseReference on any error.

ParsedReference

Dataclass with fields:

  • language_code: str
  • book_name: str (canonical form)
  • start_chapter: int | None
  • start_verse: int | None
  • end_chapter: int | None
  • end_verse: int | None

Key methods:

  • canonical_form() -> str
  • translate_to(language_code) -> ParsedReference
  • to_internal() -> ParsedReference
  • is_single_verse() -> bool
  • is_whole_chapter() -> bool
  • is_whole_book() -> bool
  • is_in_bounds() -> bool
  • get_start() -> ParsedReference
  • get_end() -> ParsedReference
  • to_list() -> list[ParsedReference]

localize_internal_reference(language_code, internal_reference) -> str

Convert an internal reference to a localized canonical string.

internalize_localized_reference(language_code, localized_reference) -> str

Convert a localized reference to an internal canonical string.

Supported languages

Code Language
en English
nl Dutch
tr Turkish
es Spanish

Origin

Extracted from learnscripture.net.

License

MIT

Metadata

Release files for bibleverseparser 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bibleverseparser 0.2
File Size Uploaded Provenance Actions
bibleverseparser-0.2.tar.gz 43.6 kB Without provenance Details for bibleverseparser-0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bibleverseparser 0.2
File Interpreter ABI Platform Actions
bibleverseparser-0.2-py3-none-any.whl Python 3 none any Details for bibleverseparser-0.2-py3-none-any.whl

Total release size: 63.7 kB

Release files / bibleverseparser-0.2.tar.gz

Download URL bibleverseparser-0.2.tar.gz
Size 43.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8042503bf98544a0470abb366f5eef747cc33b33c071a60b20dcffd061b6fe2b
BLAKE2b-256 checksum
How to use checksums
2fde23a395cf973cd3ba5d9c71862d7973ec68f57a03822fcb5d8e3d3c95688c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.6

Release files / bibleverseparser-0.2-py3-none-any.whl

Download URL bibleverseparser-0.2-py3-none-any.whl
Size 20.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
626e0c4c25d2756c17b5743041e824312935b5843ac3d3aea1822214cd4729c3
BLAKE2b-256 checksum
How to use checksums
f147d88538b91bd076d1b68e20cb63844ca0ade4a4bd41e9158dff640305cdfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.6

Security for bibleverseparser 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page