Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomomarchioro committed Aug 2, 2024
2 parents 21b4ad5 + 8be0bb6 commit 633ebc8
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python package

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install orjson
python -m pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with unittest
run: |
python -m unittest discover -s tests/
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Development :

## Basic usage
The module maps the API structure to Python classes. The user `set_` objects that can have only one value (e.g. `id`) and `add_` objects that can have multiple entities (e.g. `labels`).
As an example, we will execute the [Simple Manifest - Book recipe](https://iiif.io/api/cookbook/recipe/0009-book-1/) from the IIIF cookbook. More examples from the [cookbook](https://iiif.io/api/cookbook/) in the examples folder of this repository.
As an example, we will execute the [Simple Manifest - Book recipe](https://iiif.io/api/cookbook/recipe/0009-book-1/) from the IIIF cookbook. More examples from the [cookbook](https://iiif.io/api/cookbook/) are in the examples folder of this repository.

```python
from IIIFpres import iiifpapi3
Expand Down Expand Up @@ -59,7 +59,7 @@ manifest.json_save("manifest.json")
```

## Debug the manifest
When you are populating a new IIIF type from scratch some helpful function can be
When you are populating a new IIIF type from scratch some helpful functions can be
used for spotting errors.

`.inspect()` method returns a JSON representation of the object where the
Expand All @@ -71,15 +71,15 @@ manifest = iiifpapi3.Manifest()
manifest.inspect()
```

`.show_errors_in_browser()` method open a new browser tab highlighting the
`.show_errors_in_browser()` method opens a new browser tab highlighting the
required and recommended fields.

```python
manifest.show_errors_in_browser()
```

## Reading the manifest (experimental)
A json file compliant with presentation API3 can be read as follow:
A JSON file compliant with presentation API3 can be read as follows:
```python
from IIIFpres.utilities import read_API3_json
mymanifest = read_API3_json('manifest.json')
Expand All @@ -95,4 +95,4 @@ The package is provided by the [Laboratorio di Studi Medievali e Danteschi](http
<img src="https://i.ibb.co/tcTNXRP/layerlores.png" alt="LaMeDan Logo" width="250">


Bisides contributors, I would like to thank [dnoneill](https://github.com/dnoneill) for suggestions , and IIIF community and coordinators.
Besides contributors, I would like to thank [dnoneill](https://github.com/dnoneill) for suggestions, and IIIF community and coordinators.

0 comments on commit 633ebc8

Please sign in to comment.