Package: iiif-prezi3
iiif-prezi3IIIF Presentation API 3 Python LibraryInstallationPyPIThe easiest way to install theiiif-prezi3library is directly from PyPI:pip install iiif-prezi3Manual installationAlternatively, you can clone the repository and runsetup.pylocally:git clone https://github.com/iiif-prezi/iiif-prezi3.gitorgit clone git@github.com:iiif-prezi/iiif-prezi3.gitfollowed by:cd iiif-prezi3
python setup.py installBasic UsageYou can now import the library or individual classes from within Python and start creating your IIIF Presentation 3 objects:Directly creating a Manifest>>> from iiif_prezi3 import Manifest
>>> m = Manifest(id="https://example.com/iiif/manifest.json", label={"en":["Example Manifest"]})
>>> print(m.json(indent=2))
{
  "@context": "http://iiif.io/api/presentation/3/context.json",
  "id": "https://example.com/iiif/manifest.json",
  "type": "Manifest",
  "label": {
    "en": [
      "Example Manifest"
    ]
  }
}Importing an existing IIIF ManifestIf you have an existing IIIF Presentation v3 Manifest, you can load it via the built-injsonmodule and create the objects:>>> from iiif_prezi3 import Manifest
>>> import json
>>> manifest_json = json.load(open("example.json"))
>>> m = Manifest(**manifest_json)
>>> print(m.json(indent=2))
{
  "@context": "http://iiif.io/api/presentation/3/context.json",
  "id": "https://iiif.io/api/cookbook/recipe/0003-mvm-video/manifest.json",
  "type": "Manifest",
  "label": {
    "en": [
      "Video Example 3"
    ]
  },
  "items": [
    {
      "id": "https://iiif.io/api/cookbook/recipe/0003-mvm-video/canvas",
      "type": "Canvas",
      "height": 360,
      "width": 640,
      "duration": 572.034,
      "items": [
        {
          "id": "https://iiif.io/api/cookbook/recipe/0003-mvm-video/canvas/page",
          "type": "AnnotationPage",
          "items": [
            {
              "id": "https://iiif.io/api/cookbook/recipe/0003-mvm-video/canvas/page/annotation",
              "type": "Annotation",
              "motivation": "painting",
              "body": {
                "id": "https://fixtures.iiif.io/video/indiana/lunchroom_manners/high/lunchroom_manners_1024kb.mp4",
                "type": "Video",
                "height": 360,
                "width": 480,
                "duration": 572.034,
                "format": "video/mp4"
              },
              "target": "https://iiif.io/api/cookbook/recipe/0003-mvm-video/canvas"
            }
          ]
        }
      ]
    }
  ]
}Extensionsiiif-prezi3includes the capability to load extensions to the IIIF Presentation schema (e.gnavPlace) and modify the library's Python classes to include extra properties, validation, helper methods, etc.Published extensions from theIIIF Registry of Extensionsare included with the package, and can be loaded using theiiif_prezi3.load_bundled_extensions()method.Called without argument, this method will load all bundled extensions listed in theiiif_prezi3/config/extensions.jsonfile. If you wish to only load selected extensions from those available bundled with the library, you can pass either the path to a JSON file, or a list of extension names as an argument to the function:>>> import iiif_prezi3
>>> iiif_prezi3.load_bundled_extensions(extensions="/path/to/chosen_extensions.json")>>> import iiif_prezi3
>>> iiif_prezi3.load_bundled_extensions(extensions=['example_extension'])Extensions work in much the same way as helper methods, and are monkeypatched into the relevant objects in theiiif_prezi3.skeletonclass, from which everything is loaded.
For a simple example, please see theextensions/example_extension.pyfile, and thedocumentation on writing a helper method.Local DevelopmentFor developingiiif-prezi3locally, clone the repo and then install it and the development dependencies using pip's "editable mode":gitclonegit@github.com:iiif-prezi/iiif-prezi3.gitcdiiif-prezi3
pipinstall-e.[dev]Running TestsTests (including linting) can be run usingtox. First, install tox withpip install tox, then typetox.Versioningiiif-prezi3broadly followsSemantic Versioning. Patch releases are used for bug fixes, minor releases add new functionality and maintain backwards compatibility, and major versions contain breaking changes to the public API of the library. Links to the changes between individual versions can be found on thereleasespage.Get InvolvedTheiiif-prezi3maintainers welcome contributions from the community - issues, pull requests, use cases, etc. We have aguideline document for contributionsand a channel#iiif-prezi3on the IIIF Slack workspace, which can be joined from theIIIF website's Get Involved page.