/loris-redux

A rewrite of loris using CherryPy and Python >= 3.7.

Primary LanguagePythonOtherNOASSERTION

loris-redux

Build Status Coverage Status Maintainability Requirements Status License: New BSD Python 3.7 Python 3.8 Python Nightly Code style: black

A rewrite of loris using CherryPy and Python >= 3.7.

Running the Application and Tests

Not for Production! Also, this assumes you have pipenv installed.

Install the Appllication

$ brew install libmagic # on macOS only
$ pipenv install --dev --python [path to python >=3.7.0]  # --dev assumes you'll want to run tests

Run the Server in debug mode

$ pipenv run python run.py
  • Info: http://localhost:5004/loris:sample.jp2/info.json
  • Pixels: http://localhost:5004/loris:sample.jp2/full/800,/0/default.jpg

There is also an extension service, /resolvers.json that lists the available resolvers. This is still WIP (see #101), but the concept is there.

Run tests

$ pipenv run pytest

If you want to see logging output while running the tests, run them with pytest:

$ pipenv run py.test -s <optional/path/to/test/file.py>

You can also add -v to see the names of the tests being run. Pytest has a lot of options.

To check test coverage locally:

pipenv run pytest --cov=loris --cov-report html:cov_html

IIIF Compliance

All IIIF Image API 3.0 features are implemented. These can be enabled and disabled in loris/config.yaml. The server will set the compliance level accordingly, and raise exceptions/sent the appropriate HTTP error responses for the disabled features. Level 0 is always supported.

There is a non-standard option to support just tiles and scale factors at an otherwise level 0 compliance. This is enabled and configured in the application section of loris/config.yaml.

JPEG2000 Support

Kakadu binaries are included in this repository for testing purposes, however, JPEG2000 support is provided using OpenJpeg by default. This results considerably worse performance, but clearer licensing terms. Please review the Kakadu Downloadable Executables Copyright and Disclaimer and the licensing terms for OpenJPEG. To configure Kakadu, acquire and install the Kakadu binaries, and replace the OpenJpeg transcoder configuration in the application config with:

transcoders:
 # ....
  - class: loris.transcoders.kakadu_jp2_transcoder.KakaduJp2Transcoder
    bin: /absolute/path/to/kdu_expand
    lib: /absolute/path/to/THE_DIRECTORY_THAT_CONTAINS_libkdu_vXX.so
    src_format: jp2

Style

pipenv run black -t py37 -l 99 loris tests