Code Monkey home page Code Monkey logo

iiif-prezi3's Introduction

iiif-prezi3

IIIF Presentation API 3 Python Library

PyPI version PyPI — Python versions PyPI - License CI

Installation

PyPI

The easiest way to install the iiif-prezi3 library is directly from PyPI:

pip install iiif-prezi3

Manual installation

Alternatively, you can clone the repository and run setup.py locally:

git clone https://github.com/iiif-prezi/iiif-prezi3.git

or

git clone [email protected]:iiif-prezi/iiif-prezi3.git

followed by:

cd iiif-prezi3
python setup.py install

Basic Usage

You 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 Manifest

If you have an existing IIIF Presentation v3 Manifest, you can load it via the built-in json module 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"
            }
          ]
        }
      ]
    }
  ]
}

Extensions

iiif-prezi3 includes the capability to load extensions to the IIIF Presentation schema (e.g navPlace) and modify the library's Python classes to include extra properties, validation, helper methods, etc.

Published extensions from the IIIF Registry of Extensions are included with the package, and can be loaded using the iiif_prezi3.load_bundled_extensions() method.

Called without argument, this method will load all bundled extensions listed in the iiif_prezi3/config/extensions.json file. 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 the iiif_prezi3.skeleton class, from which everything is loaded. For a simple example, please see the extensions/example_extension.py file, and the documentation on writing a helper method.

Local Development

For developing iiif-prezi3 locally, clone the repo and then install it and the development dependencies using pip's "editable mode":

git clone [email protected]:iiif-prezi/iiif-prezi3.git
cd iiif-prezi3
pip install -e .[dev]

Running Tests

Tests (including linting) can be run using tox. First, install tox with pip install tox, then type tox.

Versioning

iiif-prezi3 broadly follows Semantic 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 the releases page.

Get Involved

The iiif-prezi3 maintainers welcome contributions from the community - issues, pull requests, use cases, etc. We have a guideline document for contributions and a channel #iiif-prezi3 on the IIIF Slack workspace, which can be joined from the IIIF website's Get Involved page.

iiif-prezi3's People

Contributors

azaroth42 avatar dependabot[bot] avatar digitaldogsbody avatar epoz avatar funkydunc avatar giacomomarchioro avatar glenrobson avatar gverm avatar helrond avatar julsraemy avatar martimpassos avatar mbennett-uoe avatar p-galligan avatar rbturnbull avatar rlskoeser avatar robcast avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iiif-prezi3's Issues

Set HWD from IIIF

Description

Retrieve the info.json for a resource, and add height, width, and duration properties to a Canvas or Content Resource object, allowing nulls

Function name / Parameters / Return

Function name: .set_hwd_from_iiif(url)

Parameters: url - the IIIF Image API URL for the resource

Returns: None

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

This will introduce a new dependency for retrieving the info.json file, probably requests. Please discuss before adding.

The URL provided by the user might already be the full path to the info.json file, so the helper should check this and not add it if unnecessary,

For Canvas objects, if height is present, then width must also be set, and vice-versa (https://iiif.io/api/presentation/3.0/#height / https://iiif.io/api/presentation/3.0/#width), Therefore the helper must be type aware, and raise an error if one is set without the other when the target is a Canvas object

Since this helper will be making a request to an external HTTP(S) resource, it should be prepared to gracefully handle errors and 404s etc, raising them to the main library as appropriate.

Working with language strings

I've been looking at language strings particularly with labels e.g.:

manifest = Manifest(id='http://iiif.example.org/prezi/Manifest/0', type='Manifest', label={'en': 'label'})

print (manifest.label)

The problem is the label is empty. This is due to the LngString class in the skeleton only containing pass.

The relevant part of the schema is:

"lngString": {
      "title": "Language string, must have a language and value must be an array.",
      "type": "object",
      "patternProperties": {
                "^[a-zA-Z-][a-zA-Z-]*$": {
               "type": "array",
               "items": { "type": "string"}
            },
            "^none$": {
                "type": "array",
                "items": { "type": "string"}
            }
      },
     "additionalProperties": false
},

from IIIF Schema#L11 and it seems pydantic is struggling with patternProperties and how to convert them into python.

Relevant discussions on pydantics:

Example lngStrings include:

# single language:
{
   'en': 'label'
}

# multiple languages: 
{
   'en': 'label',
   'cy': 'Welsh Label'
}

Automate Skeleton generation and changes

Write a wrapper python script that generates the skeleton file using datamodel-codegen and then applies any necessary changes,

Changes so far:

  • LngString fix
  • Rename _id and _type to id and type in ServiceItem1

Set HWD

Description

Set the height, width, and duration properties of a Canvas or Content Resource object, allowing nulls

Function name / Parameters / Return

Function name: .set_hwd(height, width, duration)

Parameters:

  • height - the height value for the object
  • width - the width value for the object
  • duration - the duration value for the object

Returns: None

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

For Canvas objects, if height is present, then width must also be set, and vice-versa (https://iiif.io/api/presentation/3.0/#height / https://iiif.io/api/presentation/3.0/#width), Therefore the helper must be type aware, and raise an error if one is set without the other when the target is a Canvas object

setup.py build warning

This is the warning I've seen in other projects when running python setup.py test:

WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.

Helper: ID generating methods

We need an easy way to create URIs for objects like Manifests and Canvases

  • Config has default ID generation method
  • It makes ID optional if supplied it is override otherwise it creates a default.
  • Set base_uri

Clarify supported Python versions

Our setup.py says that the library supports python2, but we don't actually test against it.

We should either add testing for Py2 or decide to support Py3 only and update setup,py accordingly

Set accompanying canvas

Description

It adds an accompanying canvas to a IIIF object.

Function name / Parameters / Return

Function name: .set_accompanying_canvas()

Parameters: canvas

Returns: canvas object

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

Note that in the description is written that the object is a special Canvas that:

The object must not have the placeholderCanvas property, nor the accompanyingCanvas property.

But below is also written:

*A Canvas that is the value of a placeholderCanvas or accompanyingCanvas property may not have either of those properties itself.

In case the first is the recommendation true we should create a Canvas class that does not have this method.

Add Annotation

Description

This helper will add an existing Annotation to the object's annotations key

Function name / Parameters / Return

Function name: .add_annotation(annotation)

Parameters: annotation - the Prezi3 Annotation object to be added

Returns: None

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

Annotations must exist within an AnnotationPage object, so the helper must create and add one if one is not already present. Otherwise the Annotation should be added to the first existing AnnotationPage

Duration is forced to be a string

I open an issue to keep it tracked.
It seems that duration is forced to be a string while as @azaroth42 said it should be a float.

from iiif_prezi3 import Canvas
acanvas = Canvas(id=canvasid, type='Canvas', label={'en': ['default lab']})
duration = 300.23
acanvas.duration = duration
acanvas.duration == duration

Add Item

Description

This helper takes a reference to an appropriate object (e.g for a Collection, it would accept a Collection or a Manifest) and adds it to the end of the items property

Function name / Parameters / Return

Function name: .add_item(item)

Parameters: item - the Prezi3 objetc to be added

Returns: None

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

Different objects will have different acceptable inputs (i.e you can't add a Manifest to a Canvas object's items), so this should be validated by the helper code.

Make Manifest

Description

This helper will create a new Manifest object, add it by reference to the items property, and return it

Function name / Parameters / Return

Function name: make_manifest()

Parameters: None

Returns: A Manifest object

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

Manifests must not be embedded inline in a Collection (https://iiif.io/api/presentation/3.0/#51-collection) and therefore this helper must also create a ManifestReference and add that to the items property of the Collection object calling this helper.

Suppress null values in JSON output

The default output includes every possible property with a null value if it is not set.

The presentation spec does not even acknowledge the existence of null (for JSON-LD reasons) and the pattern is to simply omit them.

.json() should be wrapped to strip out null values throughout the resulting structure.

e.g.

m = Manifest(label="Test Manifest")
c = Canvas()
m.items = [c]
m.json()
'{"id": "http://example.org/iiif/3", "type": "Manifest", "label": {"en": ["Test Manifest"]}, "metadata": null, "summary": null, "requiredStatement": null, "rendering": null, "service": null, "services": null, "viewingDirection": null, "rights": null, "start": null, "logo": null, "navDate": null, "provider": null, "seeAlso": null, "thumbnail": null, "homepage": null, "behavior": null, "partOf": null, "items": [{"id": "http://example.org/iiif/4", "type": "Canvas", "label": null, "height": null, "width": null, "duration": null, "metadata": null, "summary": null, "requiredStatement": null, "rights": null, "navDate": null, "provider": null, "seeAlso": null, "thumbnail": null, "homepage": null, "behavior": null, "partOf": null, "items": null, "annotations": null}], "structures": null, "annotations": null}'

Should instead just be

'{"id": "http://example.org/iiif/3", "type": "Manifest", "label": {"en": ["Test Manifest"]},  "items": [{"id": "http://example.org/iiif/4", "type": "Canvas"}]}'

Pinning versions of requirements

Tox has started showing a deprecation warning for part of pydantic:

./home/mike/projects/iiif-prezi3/iiif_prezi3/base.py:35: DeprecationWarning: copy_on_model_validation should be a string: 'deep', 'shallow' or 'none'

However, changing this value to any from the list caused test failures. It turns out tox is installing the requirements each run in a temporary virtual environment, and thus was installing a newer version of Pydantic than my local virtualenv.

This leads to test inconsistencies etc and I think is best resolved by pinning dependency versions in setup.py

Make Canvas

Description

This helper will create a Canvas object, add it to the items property (by calling the add_item helper (#37)), and return it

Function name / Parameters / Return

Function name: .make_canvas()

Parameters: None

Returns: A Canvas object

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

Make Collection

Description

This helper will create a new Collection object, add it to the items property (by calling the add_item helper (#37)), and return the new object

Function name / Parameters / Return

Function name: .make_collection()

Parameters: None

Returns: a Collection object

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

`.json` and `.jsonld` functions can pass invalid keywords to the underlying functions

We use a list to filter the kwargs into those that need to go to Pydantic, and those that need to go to the json module:
https://github.com/iiif-prezi/iiif-prezi3/blob/main/iiif_prezi3/base.py#L55-L57

        pydantic_args = ["include", "exclude", "by_alias", "encoder"]
        dict_kwargs = dict([(arg, kwargs[arg]) for arg in kwargs.keys() if arg in pydantic_args])
        json_kwargs = dict([(arg, kwargs[arg]) for arg in kwargs.keys() if arg not in pydantic_args])

This was fine when we were passing through all valid Pydantic options, but now that we explicitly set exclude_unset, exclude_defaults etc, they have been removed from the list used for filtering.

This means that they now get included on the json_kwargs list instead and thus get passed through to the underlying json.dumps call, causing an error if they are supplied:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mike/projects/iiif-prezi3/iiif_prezi3/base.py", line 56, in jsonld
    dict_kwargs = dict([(arg, kwargs[arg]) for arg in kwargs.keys() if arg in pydantic_args])
  File "/usr/lib/python3.8/json/__init__.py", line 234, in dumps
    return cls(
TypeError: __init__() got an unexpected keyword argument 'exclude_unset'

This is easily solved by having an "excluded kwargs" list and ignoring anything on that list.

Connect Reference to Referenced Resource

In order to have a Manifest in a Collection, the Collection should have a Reference to the Manifest, not the full Manifest resource.
This works as expected, hooray!

But ... if the referenced resource is modified, such as to change its label, then the Reference isn't updated.

e.g.

m = Manifest(label="1")
c = Collection()
c.items = [m]
m.label = {"en": ["2"]}
print(c.items[0].label) # --> 1
print(m.label) # --> 2

Add Range

Description

This helper adds an existing Range object to the structures key

Function name / Parameters / Return

Function name: .add_range(range)

Parameters: range - The Range object to be added

Returns: None

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

We should enforce documentation standards

Discussed in meeting on the 25th of Feb. To help new users of library we should have code documentation. We should add a check to the CI.

@helrond to look at different options for python linters.

We can also look at configuring the data generator to add documentation from the JSON schema into the python files. We may need to add labels to the schema.

Deployment to pypi

We need CI to do:

  • Run tests on pull requests
  • Create deployment to pip on tag creation
  • Need to improve the documentation on pypi

Add Metadata

Description

This helper adds key/value pairs to the metadata property of a Prezi3 object

Function name / Parameters / Return

Function name: .add_metadata(label, value)

Parameters:

  • label - the key to be added the metadata property
  • value - the value(s) for the key, either a string or an array of strings

Returns: None

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

@context not appearing in JSON

Found by @p-galligan when testing the library. Example:

manifest = Manifest(id='http://iiif.example.org/prezi/Manifest/0', type='Manifest', label={'en': ['default label']})
        
canvas = Canvas(id='http://iiif.example.org/prezi/Canvas/0')
canvas.height = 100
canvas.width = 200

canvas2 = Canvas(id='http://iiif.example.org/prezi/Canvas/1')
canvas2.height = 100
canvas2.width = 100

manifest.items = [canvas, canvas2]

data =  json.loads(manifest.json(exclude_unset=True))
print (json.dumps(data, indent=4))

Which gives the following JSON:

{
    "id": "http://iiif.example.org/prezi/Manifest/0",
    "type": "Manifest",
    "label": {},
    "items": [
        {
            "id": "http://iiif.example.org/prezi/Canvas/0",
            "height": 100,
            "width": 200
        },
        {
            "id": "http://iiif.example.org/prezi/Canvas/1",
            "height": 100,
            "width": 100
        }
    ]
}

which is missing the @context (and label which is related to #23)

Add Label

Description

This helper adds a new label to the language map of an existing object

Function name / Parameters / Return

Function name: .add_label(language, value)

Parameters:

  • language - the language code of the new label
  • value - the label string in that language

Returns: None

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

The helper should check if the object has a label property set, and either create a new dictionary with the the parameters as the first entry, or append to the existing dictionary

Add Service

Description

This helper adds an existing Service object to the service key, creating the key if it does not exist

Function name / Parameters / Return

Function name: .add_service(service)

Parameters: service - The Service object to be added

Returns: None

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

This helper is designed to target the service key of an individual object, and does not cover the services object that can additionally exist on a Collection or Manifest object

Make Range

Description

This helper creates a new Range object, adds it to structures or items as appropriate (via the add_range (#44) or add_item (#37) helpers), and returns it

Function name / Parameters / Return

Function name: .make_range()

Parameters: None

Returns: A Range object

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

The helper must be type-aware - Ranges can be added to Manifests, where they live in the structures property, or as part of other Ranges, where they live in the items property.

Make use of JSON default values for avoiding defining the type of the class manually

from iiif_prezi3 import Collection
col = Collection(id="https://test.com")

result in :

ValidationError: 1 validation error for Collection
type
  field required (type=value_error.missing)

Which is correct but requires the user to set the type of object which by default should have the type assigned.
For instance, a Manifest has always type equal to Manifest the same for collection and many other types.

This issue could be solved using the default keyword of JSON shema and then generating the class model using --use-default flag:

datamodel-codegen --input ../generatecodefromschema/iiif_3_0.json --input-file-type jsonschema --use-default --base-class .base.Base --output skeleton.py

Make Annotation

Description

This helper will create an Annotation and add it to the object's annotations key (via the add_annotation (#40) helper), and returns it.

Function name / Parameters / Return

Function name: .make_annotation()

Parameters: None

Returns: An Annotation object

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

Annotations must exist within an AnnotationPage object, so the helper must create and add one if one is not already present. Otherwise the Annotation should be added to the first existing AnnotationPage

Import problem with helpers

When I try to import iiif_prezi3 I get the error:

ModuleNotFoundError: No module named 'iiif_prezi3.helpers'

Python 3.9.9 on macOS 12.1 (M1)

Make Service

Description

This helper creates a new Service object, adds it to service (via the add_service (#57) helper), and returns it

Function name / Parameters / Return

Function name: .make_service()

Parameters: None

Returns: A Service object

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

Update PyPi publish action

The following warning showed up in the logs for the last action that made a release to PyPi:

Warning: You are using "pypa/gh-action-pypi-publish@master". The "master" branch of this project has been sunset and will not receive any updates, not even security bug fixes. Please, make sure to use a supported version. If you want to pin to v1 major version, use "pypa/gh-action-pypi-publish@release/v1". If you feel adventurous, you may opt to use use "pypa/gh-action-pypi-publish@unstable/v1" instead. A more general recommendation is to pin to exact tags or commit shas.

Set placeholder canvas

Description

It adds a placeholder canvas to a IIIF object.

Function name / Parameters / Return

Function name: .set_placeholder_canvas()

Parameters: canvas

Returns: canvas object

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

Note that in the description is written that the object is a special Canvas that:

The object must not have the placeholderCanvas property, nor the accompanyingCanvas property.

But below is also written:

*A Canvas that is the value of a placeholderCanvas or accompanyingCanvas property may not have either of those properties itself.

In case the first is the recommendation true we should create a Canvas class that does not have this method.

developer documentation

Would be nice to have developer docs for people getting started with contributing.

For my local setup, I initially ran:

pip install -e .
pip install tox

but later figured out I should maybe have installed from requirements.dev.txt

Also worth documenting that doc strings should follow google format

Set HWD from file

Description

Introspect a file and set the height, width, and duration properties of a Canvas or Content Resource object, allowing nulls

Function name / Parameters / Return

Function name: .set_hwd_from_file(file)

Parameters: file - the file path or file object to introspect

Returns: None

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

The helper should be able to work with either a file path or an already open file object, so type checking on the parameter will be required.
This helper will introduce new dependencies - probably Pillow for Images and ??? for Audio and Video resources. Please discuss in the ticket or Slack before adding.

For Canvas objects, if height is present, then width must also be set, and vice-versa (https://iiif.io/api/presentation/3.0/#height / https://iiif.io/api/presentation/3.0/#width), Therefore the helper must be type aware, and raise an error if one is set without the other when the target is a Canvas object

Get Reference

Description

This helper takes a Manifest and returns a Reference that points to it

Function name / Parameters / Return

Function name: .get_reference()

Parameters: None

Returns: A Reference object

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.