diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..823ff50 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -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/ diff --git a/README.md b/README.md index f03db1e..fa14521 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 @@ -71,7 +71,7 @@ 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 @@ -79,7 +79,7 @@ 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') @@ -95,4 +95,4 @@ The package is provided by the [Laboratorio di Studi Medievali e Danteschi](http LaMeDan Logo -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.