pax_global_header 0000666 0000000 0000000 00000000064 14244502461 0014514 g ustar 00root root 0000000 0000000 52 comment=042546096fbd987af9d93a21ebede132954fffc0
pysword-0.2.8/ 0000775 0000000 0000000 00000000000 14244502461 0013232 5 ustar 00root root 0000000 0000000 pysword-0.2.8/.gitignore 0000664 0000000 0000000 00000000140 14244502461 0015215 0 ustar 00root root 0000000 0000000 *.pyc
__pycache__/
.idea/
tests/resources/mods.d
tests/resources/modules
tests/resources/*.zip
pysword-0.2.8/.gitlab-ci.yml 0000664 0000000 0000000 00000001026 14244502461 0015665 0 ustar 00root root 0000000 0000000 test:
script:
- apt-get update -qy
- apt-get install -y python-pytest python3-pytest python-mock python3-mock python3-pep8
- python3 tests/resources/download_bibles.py
- python2 -m pytest -v tests/
- python3 -m pytest -v tests/
- python3 -m pep8 --max-line-length=120 tests/ pysword/
pages:
script:
- apt-get update -qy
- apt-get install -y python-sphinx python-sphinx-rtd-theme
- cp README.rst docs/
- cd docs
- make html
- mv _build/html/ ../public
artifacts:
paths:
- public
only:
- tags
pysword-0.2.8/LICENSE 0000664 0000000 0000000 00000002214 14244502461 0014236 0 ustar 00root root 0000000 0000000 Copyright (c) 2008-2019 Various PySword developers:
Kenneth Arnold, Joshua Gross, Tomas Groth, Ryan Hiebert, Philip Ridout,
Matthew Wardrop
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
pysword-0.2.8/MANIFEST.in 0000664 0000000 0000000 00000000020 14244502461 0014760 0 ustar 00root root 0000000 0000000 include LICENSE
pysword-0.2.8/README.rst 0000664 0000000 0000000 00000004647 14244502461 0014734 0 ustar 00root root 0000000 0000000 .. image:: https://gitlab.com/tgc-dk/pysword/badges/master/build.svg
:target: https://gitlab.com/tgc-dk/pysword/pipelines
.. image:: https://ci.appveyor.com/api/projects/status/7n8848av82arr9xv?svg=true
:target: (https://ci.appveyor.com/project/OpenLP/pysword
A native Python reader of the SWORD Project Bible Modules
This project is **not** an official `CrossWire `_
project. It merely provides an alternative way to read the bible modules
created by CrossWires `SWORD `_ project.
Features
--------
- Read SWORD bibles (not commentaries etc.)
- Detection of locally installed bible modules.
- Supports all known SWORD module formats (ztext, ztext4, rawtext,
rawtext4)
- Read from zipped modules, like those available from
http://www.crosswire.org/sword/modules/ModDisp.jsp?modType=Bibles
- Clean text of OSIS, GBF or ThML tags.
- Supports both python 2.7 and 3.3+ [*]_ (CI tested with 2.7 to 3.10)
.. [*] pysword makes use of io.open (introduced in python 2.6 and the unicode literal (available in pyhton 2 and
reintroduced in python 3.3 - PEP 414)
License
-------
PySword is and can be distributed under the `MIT license `_
Installation
------------
PySwords source code can be downloaded from PySwords `release list `_,
but it is also available from `PyPI `_
for install using ``pip``::
pip install pysword
It also available for `ArchLinux (AUR) `_ and
`Fedora `_ and
`Debian `_.
Run tests
---------
To run the testsuite, first run the script that download the files used
for testing, and then use pytest to run the testsuite:
.. code:: sh
$ python tests/resources/download_bibles.py
$ pytest -v tests/
The tests should run and pass using both python 2 and 3.
Using PySword
-------------
Read the `documentation `_ for how to use pysword and to see the API docs.
Contributing
------------
If you want to contribute, you are most welcome to do so!
Feel free to report issues and create merge request at https://gitlab.com/tgc-dk/pysword
If you create a merge request please include a test the proves that your code actually works.
pysword-0.2.8/appveyor.yml 0000664 0000000 0000000 00000001761 14244502461 0015627 0 ustar 00root root 0000000 0000000 image: Visual Studio 2022
install:
- c:\\python27\\Scripts\\pip.exe install pytest mock
- c:\\python34\\python.exe -m pip install pytest
- c:\\python35\\python.exe -m pip install pytest
- c:\\python36\\python.exe -m pip install pytest
- c:\\python37\\python.exe -m pip install pytest
- c:\\python38\\python.exe -m pip install pytest
- c:\\python39\\python.exe -m pip install pytest
- c:\\python310\\python.exe -m pip install pytest
build: off
test_script:
- cd c:\\projects\\pysword
# Download modules used for testing
- c:\\python38\\python.exe tests/resources/download_bibles.py
# Run the tests
- c:\\python27\\python.exe -m pytest -v tests
- c:\\python34\\python.exe -m pytest -v tests
- c:\\python35\\python.exe -m pytest -v tests
- c:\\python36\\python.exe -m pytest -v tests
- c:\\python37\\python.exe -m pytest -v tests
- c:\\python38\\python.exe -m pytest -v tests
- c:\\python39\\python.exe -m pytest -v tests
- c:\\python310\\python.exe -m pytest -v tests
pysword-0.2.8/docs/ 0000775 0000000 0000000 00000000000 14244502461 0014162 5 ustar 00root root 0000000 0000000 pysword-0.2.8/docs/Makefile 0000664 0000000 0000000 00000001134 14244502461 0015621 0 ustar 00root root 0000000 0000000 # Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = pysword
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) pysword-0.2.8/docs/conf.py 0000664 0000000 0000000 00000012670 14244502461 0015467 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, '../')
from pysword import __version__ as pysword_version
# -- Project information -----------------------------------------------------
project = 'pysword'
copyright = '2019, Various Authors'
author = 'Various Authors'
# The short X.Y version
version = pysword_version
# The full version, including alpha/beta/rc tags
release = pysword_version
# -- General configuration ---------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'pysworddoc'
# -- Options for LaTeX output ------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'pysword.tex', 'pysword Documentation',
'Author', 'manual'),
]
# -- Options for manual page output ------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'pysword', 'pysword Documentation',
[author], 1)
]
# -- Options for Texinfo output ----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'pysword', 'pysword Documentation',
author, 'pysword', 'One line description of project.',
'Miscellaneous'),
]
# -- Options for Epub output -------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
epub_author = author
epub_publisher = author
epub_copyright = copyright
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ''
# A unique identification for the text.
#
# epub_uid = ''
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# -- Extension configuration -------------------------------------------------
# -- Options for todo extension ----------------------------------------------
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
pysword-0.2.8/docs/examples.rst 0000664 0000000 0000000 00000003523 14244502461 0016535 0 ustar 00root root 0000000 0000000 Example code
------------
Use modules from default datapath
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: python
from pysword.modules import SwordModules
# Find available modules/bibles in standard data path.
# For non-standard data path, pass it as an argument to the SwordModules constructor.
modules = SwordModules()
# In this case we'll assume the modules found is something like:
# {'KJV': {'description': 'KingJamesVersion(1769)withStrongsNumbersandMorphology', 'encoding': 'UTF-8', ...}}
found_modules = modules.parse_modules()
bible = modules.get_bible_from_module(u'KJV')
# Get John chapter 3 verse 16
output = bible.get(books=[u'john'], chapters=[3], verses=[16])
Load module from zip-file
~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: python
from pysword.modules import SwordModules
# Load module in zip
# NB: the zip content is only available as long as the SwordModules object exists
modules = SwordModules(u'KJV.zip')
# In this case the module found is:
# {'KJV': {'description': 'KingJamesVersion(1769)withStrongsNumbersandMorphology', 'encoding': 'UTF-8', ...}}
found_modules = modules.parse_modules()
bible = modules.get_bible_from_module(u'KJV')
# Get John chapter 3 verse 16
output = bible.get(books=[u'john'], chapters=[3], verses=[16])
Manually create bible
~~~~~~~~~~~~~~~~~~~~~
.. code:: python
from pysword.bible import SwordBible
# Create the bible. The arguments are:
# SwordBible(, , , , )
# Only the first is required, the rest have default values which should work in most cases.
bible = SwordBible(u'/home/me/.sword/modules/texts/ztext/kjv/', u'ztext', u'kjv', u'utf8', u'OSIS')
# Get John chapter 3 verse 16
output = bible.get(books=[u'john'], chapters=[3], verses=[16])
pysword-0.2.8/docs/index.rst 0000664 0000000 0000000 00000000747 14244502461 0016033 0 ustar 00root root 0000000 0000000 .. pysword documentation master file, created by
sphinx-quickstart on Wed Mar 21 14:25:58 2018.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to pysword's documentation!
===================================
.. toctree::
:maxdepth: 4
:caption: Contents:
README
examples
module-format
pysword
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
pysword-0.2.8/docs/make.bat 0000664 0000000 0000000 00000001453 14244502461 0015572 0 ustar 00root root 0000000 0000000 @ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
set SPHINXPROJ=pysword
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
:end
popd
pysword-0.2.8/docs/module-format.rst 0000664 0000000 0000000 00000004275 14244502461 0017477 0 ustar 00root root 0000000 0000000 Module formats
--------------
I'll use Python's struct module's format strings to describe byte
formatting. See https://docs.python.org/3/library/struct.html
There are current 4 formats for bible modules in SWORD.
ztext format documentation
~~~~~~~~~~~~~~~~~~~~~~~~~~
Take the Old Testament (OT) for example. Three files:
- ot.bzv: Maps verses to character ranges in compressed buffers. 10
bytes ('