Skip to main content

MMIF Storage API

Code to interact with a set of MMIF files via a FastAPI web service or a Flask web server. It is built upon the Python interface to MMIF files at https://github.com/clamsproject/mmif-storage, see the README file in that repository for a short description of what a MMIF Storage directory looks like.

Requirements and installation

This requires Python version 3.12 or higher. Installation is a simple pip-install:

pip install mmif-storage-api

The examples below assume you have a MMIF storage directory conveniently laying around. If you do not, you can create an example directory with a script from the mmif-storage package:

create-storage-example -d DIRECTORY

Web API

To start the FastAPI web service:

start_api --dir DIRECTORY --host HOSTNAME --port PORT

All options are optional, the default directory is your current working directory and the default host and port are 0.0.0.0 and 8000. You get erratic behavior including perhaps some server errors if you start the API from a directory that is not a MMIF Storage directory or when the argument that you hand in is not a MMIF Storage directory.

Once started, the root of the API is available at http://127.0.0.1:8000. You can also load the page with all available routes at http://127.0.0.1:8000/routes and access the Swagger UI interface at http://127.0.0.1:8000/docs.

See the API examples document for example API calls.

Web Browser

To start the MMIF Storage browser do:

start_www --dir DIRECTORY --host HOSTNAME --port PORT

The defaults are the same except that the default port is 5000. As with the web service API, expect weird behavior if you use a directory that is not a MMIF Storage directory.

With the default settings, point your browser at http://127.0.0.1:5000.

Containerization

This requires access to the source code and Docker or Podman to build the image:

docker build -f Containerfile -t mmif-storage-api .

You probably want to add a version number and use something like -t mmif-storage-api:0.1.0 to make the version explicit.

Starting the container:

docker run --rm -d -v DIRECTORY:/data -p 8000:8000 mmif-storage-api

The value for DIRECTORY has to be an absolute path, the example below uses the example storage and the $PWD shell environment variable:

create-storage-example -d tmp-storage
docker run --rm -d -v $PWD/data/tmp-storage:/data -p 8000:8000 mmif-storage-api

It is the responsibilty of the developer to use the correct local storage directory so it can be used in the container. Also, the developer may have to replace the first port in the port mapping depending on local circumstances.

Metadata

Release files for mmif-storage-api 0.1.0

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

Source distribution (sdist)

Source distribution for mmif-storage-api 0.1.0
File Size Uploaded
mmif_storage_api-0.1.0.tar.gz 28.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mmif-storage-api 0.1.0
File Interpreter ABI Platform
mmif_storage_api-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 59.0 kB

Release files / mmif_storage_api-0.1.0.tar.gz

Download URL mmif_storage_api-0.1.0.tar.gz
Size 28.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6c88a8f863d6162193a6e65950f8c2068d5fb5d96bc689dc1d1a9d2f6a5f03cf
BLAKE2b-256 checksum
How to use checksums
8d169541105f27d59314fb586111ed0c266b3aa268a3581f47644fa9d658e6cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / mmif_storage_api-0.1.0-py3-none-any.whl

Download URL mmif_storage_api-0.1.0-py3-none-any.whl
Size 30.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47c57bf4e6e77f62f1194026c7da4eceb4886d1cf1c85f13ed8f999ba223b7ba
BLAKE2b-256 checksum
How to use checksums
5705b58aa159a188e5b4218d7a52df09f01b787ef558682f800c4e7bc1b1b28b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

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