Commit 5522e6e1 authored by Mickaël Desfrênes's avatar Mickaël Desfrênes
Browse files

better pypi presentation

parent ddb0ac63
Loading
Loading
Loading
Loading
+177 −25
Changes for pypi.md: 177 added lines, 25 removed lines.
Original line number Diff line number Diff line
# Jama
# Jamā (जमा)

Jama is a [Django](https://www.djangoproject.com/) application that exposes APIs and UIs that allow users to organize collections of resources.
Jamā is a Django-based media repository application developed at CERTIC,
Université de Caen Normandie. It provides APIs and user interfaces for storing,
organizing, enriching, and serving collections of media resources.

Knowledge of the Django framework is expected and the Jama documentation is, to put it midly, a work in progress.
It is packaged as `jama-CERTIC` and installs a `jama` command, which behaves
like a standard Django management command entry point.

## Install
## Features

    pip install jama-CERTIC
- Projects, collections, resources, files, metadata, and access control.
- JSON-RPC API and web UI.
- Chunked file uploads and hash-based source-file storage.
- Background media processing with Django Tasks and `django-tasks-db`.
- IIIF tiled image generation for image and document resources.
- HLS generation for videos.
- OCR and ExifTool metadata extraction.
- Optional ARK identifier integration.
- Project snapshot export and restore commands.
- Optional PostgreSQL/PostGIS deployment; SQLite is available for small or test
  instances.

## Usage
## Requirements

Jama behaves like a normal Django app except the management script is not called `manage.py` but `jama`.
Jamā requires Python 3.13 and Django 6.

List of commands:
Some features depend on external command-line tools that must be installed on
the host system:

    jama --help
- ImageMagick (`convert`) for image conversion.
- Poppler (`pdftoppm`, `pdftotext`) for PDF processing.
- libvips (`vips`) for IIIF tiled image generation.
- Tesseract for OCR.
- ExifTool for technical metadata extraction.
- FFmpeg/FFprobe for video processing and HLS generation.

For production deployments, use a real web server, a separate task worker, and
PostgreSQL when the instance will handle significant traffic or concurrent use.

Upon first run, Jama creates a `$HOME/.jama/` directory where it stores all its data.
## Installation

```bash
pip install jama-CERTIC
```

Development server:
Initialize the database and create an administrator account:

```bash
jama migrate
jama createsuperuser
```

Start a development server:

```bash
jama runserver
```

By default, Jamā stores persistent data under `$HOME/.jama/`.

## Background Tasks

Background tasks:
Jamā uses Django Tasks with the database backend provided by
`django-tasks-db`. Start at least one worker to process media jobs such as IIIF
tiling, OCR, HLS generation, ExifTool extraction, ARK assignment, and bulk
metadata updates:

    jama run_huey
```bash
jama db_worker
```

Recurring tasks are registered and run through `django-crontask`:

```bash
jama crontask --no-heartbeat
```

In production, run the web process, one or more `db_worker` processes, and the
cron process separately, for example with systemd.

## Configuration

Configuration can be changed by adding environment variables the usual way or by adding them to your
`$HOME/.jama/env` configuration file
At startup, Jamā reads environment variables and also loads an `env` file from
`JAMA_VAR_DIR`. If the file does not exist, Jamā creates it automatically with
documented defaults.

Available variables:
Important variables include:

    JAMA_DEBUG="0"
    JAMA_APPS="ui"
    JAMA_IIIF_ENDPOINT="http://localhost/iip/IIIF="  # base URL for the IIIF server (use IIP server or Cantaloupe)
    JAMA_IIIF_UPSCALING_PREFIX="^"
    JAMA_SECRET="7d*_8c!d$vv963qpr45_x)@f2t-x6fu2&yi+m+d6s!p!lt+_j+"
```bash
JAMA_VAR_DIR="$HOME/.jama"
JAMA_SECRET="change-me"
JAMA_SITE="http://localhost:8000/"
    JAMA_STATIC_ROOT="var/static"  # where to put files when using "jama collectstatic"
    JAMA_USE_MODSHIB="1"
    MODSHIB_SHOW_LOCAL_LOGIN="1"
    MODSHIB_SHOW_SSO_LOGIN="0"
JAMA_STATIC_ROOT="$HOME/.jama/static"

JAMA_DB_ADAPTER="sqlite"          # use another value for PostgreSQL
JAMA_SQLITE_DB_PATH="$HOME/.jama/db.sqlite3"
JAMA_DB_HOST="localhost"
JAMA_DB_PORT="5432"
JAMA_DB_NAME="django"
JAMA_DB_USER="django"
JAMA_DB_PASSWORD="django"

JAMA_FILES_DIR="$HOME/.jama/media_source_files"
JAMA_IIIF_DIR="$HOME/.jama/iiif"
JAMA_IIIF_PROCESSING_DIR="$HOME/.jama/processing"
JAMA_IIIF_ENDPOINT="http://localhost/iip/IIIF="
JAMA_HLS_DIR="$HOME/.jama/hls"
JAMA_HLS_ENDPOINT="http://localhost:8000/hls/"
```

See `configuration.md` in the source repository for the complete list of
supported settings.

## Useful Commands

```bash
jama --help
jama collectstatic
jama listprojects
jama newjamaproject "Project title"
jama addlocalfiles /path/to/files username PROJECT_ID --extensions .jpg .tif
jama ensureiiif
jama snapshotproject PROJECT_ID /path/to/snapshot --include-files
jama restoreproject /path/to/snapshot "Restored project"
```

The `jama repl` command starts a Django-aware interactive shell with commonly
used Jamā models and helpers imported.

## Project Snapshots

Jamā can export a project as a restorable snapshot. A snapshot is a directory
containing NDJSON data files and a `manifest.json` file.

List projects and their identifiers:

```bash
jama listprojects
```

Export database data only:

```bash
jama snapshotproject PROJECT_ID /path/to/snapshot
```

Export database data and original source files:

```bash
jama snapshotproject PROJECT_ID /path/to/snapshot --include-files
```

Restore a snapshot into a new project:

```bash
jama restoreproject /path/to/snapshot "Restored project"
```

Replace an existing project while keeping its identifier:

```bash
jama restoreproject /path/to/snapshot "Existing project" --replace-in-place
```

When `--replace-in-place` is used, Jamā creates a safety snapshot before
replacing the project. Source files are optional in snapshots; without
`--include-files`, the database rows are restored but the original files must
already be present in Jamā storage for media resources to be fully usable.

Derived IIIF and HLS files are not included in snapshots. They are regenerated
after restore when the source files are available. Annotations are not included
in the current snapshot format.

## IIIF Notes

Jamā generates tiled image files and expects an IIIF-compatible image server to
serve them. IIPImage and Cantaloupe are typical choices. The exact
`JAMA_IIIF_ENDPOINT`, path separator, and WebP settings depend on the chosen
server.

For Cantaloupe 5.x, a common configuration is:

```bash
JAMA_USE_WEBP=0
JAMA_IIIF_PATH_SEPARATOR="%2F"
JAMA_IIIF_ENDPOINT="http://localhost:8182/iiif/2/"
```

## Documentation and Source

The project repository is:

<https://git.unicaen.fr/certic/jama>

The source repository contains additional documentation, configuration details,
and example systemd units.
+1 −1
Changes for src/jama/__init__.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
__version__ = "0.6.0"
__version__ = "0.6.1"