Filesystem Spec (fsspec) plugin for IIIF (International Image Interoperability Framework) resources
Project description
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
httpandhttpsresource URLs are accepted http -> httpsredirects are allowedhttps -> httpredirects 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):
-
Bump the version in
pyproject.toml:version = "X.Y.Z"
-
Commit and push the version bump:
git add pyproject.toml git commit -m "Version X.Y.Z" git push
-
Create and push an annotated tag:
git tag -a vX.Y.Z -m "Release vX.Y.Z" git push origin vX.Y.Z
-
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
testpypiandpypiGitHub Actions environments must be configured in the repository settings with OIDC trusted publishing enabled.
License
MIT. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iiif_fsspec-0.1.1.tar.gz.
File metadata
- Download URL: iiif_fsspec-0.1.1.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea7033eed23141386b3312ff3baa7d5aa1ae5f099b3546ab444426ab4b492c3d
|
|
| MD5 |
53d9bde82e92f9f6cf28bad2ff753430
|
|
| BLAKE2b-256 |
02f4cc841115b5291b75f30e4da53c1f2fbea13ee6b0ae78a563529b2c8d1bd5
|
Provenance
The following attestation bundles were made for iiif_fsspec-0.1.1.tar.gz:
Publisher:
publish.yml on davelopez/iiif-fsspec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iiif_fsspec-0.1.1.tar.gz -
Subject digest:
ea7033eed23141386b3312ff3baa7d5aa1ae5f099b3546ab444426ab4b492c3d - Sigstore transparency entry: 1247591674
- Sigstore integration time:
-
Permalink:
davelopez/iiif-fsspec@3f1839d482c4845eab4739c345a5035455265417 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/davelopez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3f1839d482c4845eab4739c345a5035455265417 -
Trigger Event:
push
-
Statement type:
File details
Details for the file iiif_fsspec-0.1.1-py3-none-any.whl.
File metadata
- Download URL: iiif_fsspec-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c441d1a181eb9d0e0ede8e56b96c5f3b80f3db27960e5975784f1c5174185891
|
|
| MD5 |
20b68f9f00542245b02751a85d2906aa
|
|
| BLAKE2b-256 |
29ef1dc7136ecf770b1bc89ae3e8ab9bc9c1a8ea1491c124abc80dbf3c3b3fb8
|
Provenance
The following attestation bundles were made for iiif_fsspec-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on davelopez/iiif-fsspec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iiif_fsspec-0.1.1-py3-none-any.whl -
Subject digest:
c441d1a181eb9d0e0ede8e56b96c5f3b80f3db27960e5975784f1c5174185891 - Sigstore transparency entry: 1247591677
- Sigstore integration time:
-
Permalink:
davelopez/iiif-fsspec@3f1839d482c4845eab4739c345a5035455265417 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/davelopez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3f1839d482c4845eab4739c345a5035455265417 -
Trigger Event:
push
-
Statement type: