{"id":13740811,"url":"https://github.com/Princeton-CDH/piffle","last_synced_at":"2025-05-08T20:32:44.925Z","repository":{"id":50957912,"uuid":"64334467","full_name":"Princeton-CDH/piffle","owner":"Princeton-CDH","description":"python library for working with IIIF Image and Presentation APIs","archived":false,"fork":false,"pushed_at":"2025-01-27T18:16:48.000Z","size":149,"stargazers_count":20,"open_issues_count":2,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-14T23:46:34.992Z","etag":null,"topics":["iiif-image","python","python-library","python27","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Princeton-CDH.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-07-27T19:01:39.000Z","updated_at":"2025-03-19T07:00:37.000Z","dependencies_parsed_at":"2024-11-15T10:33:22.812Z","dependency_job_id":"e3811477-f1b7-4dfa-b635-4e6d2fe9373a","html_url":"https://github.com/Princeton-CDH/piffle","commit_stats":{"total_commits":69,"total_committers":4,"mean_commits":17.25,"dds":0.536231884057971,"last_synced_commit":"c3514ac9eaf5bce9feac12daf030e1ed9d016dcc"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Princeton-CDH%2Fpiffle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Princeton-CDH%2Fpiffle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Princeton-CDH%2Fpiffle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Princeton-CDH%2Fpiffle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Princeton-CDH","download_url":"https://codeload.github.com/Princeton-CDH/piffle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253145078,"owners_count":21861184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["iiif-image","python","python-library","python27","python3"],"created_at":"2024-08-03T04:00:52.429Z","updated_at":"2025-05-08T20:32:44.636Z","avatar_url":"https://github.com/Princeton-CDH.png","language":"Python","funding_links":[],"categories":["Image API Libraries"],"sub_categories":["Image viewers (Image API only)"],"readme":"# piffle\n\nPython library for generating and parsing [IIIF Image API](http://iiif.io/api/image/2.1/) URLs in an\nobject-oriented, pythonic fashion.\n\n[![unit tests](https://github.com/Princeton-CDH/piffle/actions/workflows/unit_tests.yml/badge.svg)](https://github.com/Princeton-CDH/piffle/actions/workflows/unit_tests.yml)\n[![codecov](https://codecov.io/gh/Princeton-CDH/piffle/branch/main/graph/badge.svg)](https://codecov.io/gh/Princeton-CDH/piffle)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d37850d90592f9d628df/maintainability)](https://codeclimate.com/github/Princeton-CDH/piffle/maintainability)\n\n\nPiffle is tested on Python 3.8—3.12.\n\nPiffle was originally developed by Rebecca Sutton Koeser at Emory University as a part of [Readux](https://github.com/ecds/readux) and forked as a separate project under [emory-lits-labs](https://github.com/emory-lits-labs/). It was later transferred to Rebecca Sutton Koeser at the Center for Digital Humanities at Princeton.\n\n## Installation and example use:\n\n`pip install piffle`\n\nExample use for generating an IIIF image url:\n\n```\n\u003e\u003e\u003e from piffle.image import IIIFImageClient\n\u003e\u003e\u003e myimg = IIIFImageClient('http://image.server/path/', 'myimgid')\n\u003e\u003e\u003e print myimg\nhttp://image.server/path/myimgid/full/full/0/default.jpg\n\u003e\u003e\u003e print myimg.info()\nhttp://image.server/path/myimgid/info.json\"\n\u003e\u003e\u003e print myimg.size(width=120).format('png')\nhttp://image.server/path/myimgid/full/120,/0/default.png\n```\n\nExample use for parsing an IIIF image url:\n\n```\n\u003e\u003e\u003e from piffle.image import IIIFImageClient\n\u003e\u003e\u003e myimg = IIIFImageClient.init_from_url('http://www.example.org/image-service/abcd1234/full/full/0/default.jpg')\n\u003e\u003e\u003e print myimg\nhttp://www.example.org/image-service/abcd1234/full/full/0/default.jpg\n\u003e\u003e\u003e print myimg.info()\nhttp://www.example.org/image-service/abcd1234/info.json\n\u003e\u003e\u003e myimg.as_dict()['size']['full']\nTrue\n\u003e\u003e\u003e myimg.as_dict()['size']['exact']\nFalse\n\u003e\u003e\u003e myimg.as_dict()['rotation']['degrees']\n0.0\n```\n\nExample use for reading a IIIF manifest:\n\n```\n\u003e\u003e\u003e from piffle.image import IIIFImageClient\n\u003e\u003e\u003e from piffle.presentation import IIIFPresentation\n\u003e\u003e\u003e  manifest = IIIFPresentation.from_url('https://iiif.bodleian.ox.ac.uk/iiif/manifest/60834383-7146-41ab-bfe1-48ee97bc04be.json')\n\u003e\u003e\u003e manifest.label\n'Bodleian Library MS. Bodl. 264'\n\u003e\u003e\u003e manifest.id\n'https://iiif.bodleian.ox.ac.uk/iiif/manifest/60834383-7146-41ab-bfe1-48ee97bc04be.json'\n\u003e\u003e\u003e manifest.type\n'sc:Manifest'\n\u003e\u003e\u003e for canvas in manifest.sequences[0].canvases[:5]:\n...     image_id = canvas.images[0].resource.id\n...     iiif_img = IIIFImageClient(*image_id.rsplit('/', 1))\n...     print(str(iiif_img.size(height=250)))\n...\nhttps://iiif.bodleian.ox.ac.uk/iiif/image/90701d49-5e0c-4fb5-9c7d-45af96565468/full/,250/0/default.jpg\nhttps://iiif.bodleian.ox.ac.uk/iiif/image/e878cc78-acd3-43ca-ba6e-90a392f15891/full/,250/0/default.jpg\nhttps://iiif.bodleian.ox.ac.uk/iiif/image/0f1ed064-a972-4215-b884-d8d658acefc5/full/,250/0/default.jpg\nhttps://iiif.bodleian.ox.ac.uk/iiif/image/6fe52b9a-5bb7-4b5b-bbcd-ad0489fcad2a/full/,250/0/default.jpg\nhttps://iiif.bodleian.ox.ac.uk/iiif/image/483ff8ec-347d-4070-8442-dbc15bc7b4de/full/,250/0/default.jpg\n```\n\n## Development and Testing\n\nThis project uses [git-flow](https://github.com/nvie/gitflow) branching conventions.\n\nInstall locally for development (the use of a python virtualenv is recommended):\n\n`pip install -e .`\n\nInstall test dependencies:\n\n`pip install -e \".[dev]\"`\n\nRun unit tests: `py.test` or `python setup.py test`\n\n### Install pre-commit hooks\n\nAnyone who wants to contribute to this codebase should install the configured pre-commit hooks:\n\n```\npre-commit install\n```\n\nThis will configure a pre-commit hooks to automatically lint and format python code with [ruff](https://github.com/astral-sh/ruff) and [black](https://github.com/psf/black).\n\nPre-commit hooks and formatting conventions were added at version 0.5, so ``git blame`` may not reflect the true author of a given change. To make ``git blame`` more accurate, ignore formatting revisions:\n\n```\ngit blame \u003cFILE\u003e --ignore-revs-file .git-blame-ignore-revs\n```\n\nOr configure your git to always ignore styling revision commits:\n```\ngit config blame.ignoreRevsFile .git-blame-ignore-revs\n```\n\n## Publishing python packages\n\nA new python package is automatically built and published to [PyPI](https://pypi.python.org/pypi) using a GitHub Actions workflow when a new release is created on GitHub.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPrinceton-CDH%2Fpiffle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPrinceton-CDH%2Fpiffle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPrinceton-CDH%2Fpiffle/lists"}