Skip to main content

iiif-fsspec

iiif-fsspec is a read-only fsspec plugin for IIIF resources.

It lets you treat IIIF manifests like directories and canvas images like files, so you can use familiar filesystem operations such as ls, open, and cat_file.

What You Can Do

  • List canvases in a IIIF manifest
  • Read full images or byte ranges
  • Browse IIIF collections
  • Use either raw manifest URLs as input or tokenized paths returned by the filesystem

Supported versions:

  • IIIF Presentation API v2
  • IIIF Presentation API v3

Installation

pip install iiif-fsspec

Or with uv:

uv add iiif-fsspec

Quick Start

import fsspec

fs = fsspec.filesystem("iiif")

manifest_url = "https://example.org/iiif/manifest.json"
entries = fs.ls(manifest_url, detail=True)

print(entries[0]["name"])
# manifest--<token>.json/canvas-one.jpg
print(entries[0]["iiif_label"])
# "Canvas 1"

with fs.open(entries[0]["name"], "rb") as handle:
    first_kb = handle.read(1024)

print(len(first_kb))

Common Usage

List canvas paths:

from iiif_fsspec import IIIFFileSystem

fs = IIIFFileSystem()
paths = fs.ls("https://example.org/iiif/manifest.json")
print(paths)

Read a byte range:

# Assuming paths[0] is a canvas image path
chunk = fs.cat_file(paths[0], start=0, end=1024)
print(len(chunk))

Examples

Runnable scripts are in examples:

uv run python examples/browse_manifest.py
uv run python examples/browse_download_cli.py
uv run python examples/read_first_canvas.py
uv run python examples/download_canvas.py --index 1 --output /tmp/canvas-1.jpg

Use a different manifest:

uv run python examples/browse_manifest.py --manifest-url https://example.org/iiif/manifest.json

Path Format

Returned paths are protocol-free tokenized names that are safe to reuse with open and ls:

  • Manifest path: manifest--<token>.json
  • Canvas path: manifest--<token>.json/canvas-one.jpg
  • Collection child: collection--<token>.json/manifest-book-1--<token>.json

Raw https:// and http:// manifest URLs are accepted as entry inputs.

Security Notes

iiif-fsspec fetches remote manifests and image resources. Treat manifest content as untrusted network input.

  • Only http and https resource URLs are accepted
  • http -> https redirects are allowed
  • https -> http redirects are rejected
  • Non-HTTP(S) redirect targets are rejected

If you run in a sensitive environment, add your own outbound network controls (for example, allowlists or egress filtering).

Development

uv sync --dev
uv run ruff check src/ tests/
uv run ruff format --check src/ tests/
uv run mypy src/ tests/
uv run pytest

Live integration tests are opt-in:

uv run pytest -m integration -v

Releasing a new version

Publishing is automated via GitHub Actions using trusted OIDC publishing. The workflow triggers on v* tags, builds the package, and publishes first to TestPyPI then to PyPI.

Steps to release a new version (e.g. X.Y.Z):

  1. Bump the version in pyproject.toml:

    version = "X.Y.Z"
    
  2. Commit and push the version bump:

    git add pyproject.toml
    git commit -m "Version X.Y.Z"
    git push
    
  3. Create and push an annotated tag:

    git tag -a vX.Y.Z -m "Release vX.Y.Z"
    git push origin vX.Y.Z
    
  4. GitHub Actions picks up the tag, builds the distribution, and publishes it to TestPyPI first. After that job succeeds the package is published to PyPI automatically. Monitor the run in the Actions tab of the repository.

Note: The testpypi and pypi GitHub Actions environments must be configured in the repository settings with OIDC trusted publishing enabled.

License

MIT. See LICENSE.

Metadata

Release files for iiif-fsspec 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iiif-fsspec 0.1.1
File Size Uploaded
iiif_fsspec-0.1.1.tar.gz 14.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iiif-fsspec 0.1.1
File Interpreter ABI Platform
iiif_fsspec-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 31.8 kB

Release files / iiif_fsspec-0.1.1.tar.gz

Download URL iiif_fsspec-0.1.1.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ea7033eed23141386b3312ff3baa7d5aa1ae5f099b3546ab444426ab4b492c3d
BLAKE2b-256 checksum
How to use checksums
02f4cc841115b5291b75f30e4da53c1f2fbea13ee6b0ae78a563529b2c8d1bd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 7, 2026.

Transparency log

Release files / iiif_fsspec-0.1.1-py3-none-any.whl

Download URL iiif_fsspec-0.1.1-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c441d1a181eb9d0e0ede8e56b96c5f3b80f3db27960e5975784f1c5174185891
BLAKE2b-256 checksum
How to use checksums
29ef1dc7136ecf770b1bc89ae3e8ab9bc9c1a8ea1491c124abc80dbf3c3b3fb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page