Skip to main content

OCR-D/core

Python modules implementing OCR-D specs and related tools

image Docker Image CI Unit Test CI image image image

Gitter chat

Introduction

This repository contains the python packages that form the base for tools within the OCR-D ecosphere.

All packages are also published to PyPI.

Installation

NOTE Unless you want to contribute to OCR-D/core, we recommend installation as part of ocrd_all which installs a complete stack of OCR-D-related software.

The easiest way to install is via pip:

pip install ocrd

# or just the functionality you need, e.g.

pip install ocrd_modelfactory

All Python software released by OCR-D requires Python 3.8 or higher.

NOTE Some OCR-D-Tools (or even test cases) might reveal an unintended behavior if you have specific environment modifications, like:

  • using a custom build of ImageMagick, whose format delegates are different from what OCR-D supposes
  • custom Python logging configurations in your personal account

Command line tools

NOTE: All OCR-D CLI tools support a --help flag which shows usage and supported flags, options and arguments.

ocrd CLI

ocrd-dummy CLI

A minimal OCR-D processor that copies from -I/-input-file-grp to -O/-output-file-grp

Configuration

Almost all behaviour of the OCR-D/core software is configured via CLI options and flags, which can be listed with the --help flag that all CLI support.

Some parts of the software are configured via environment variables:

  • OCRD_METS_CACHING: If set to true, access to the METS file is cached, speeding in-memory search and modification.

  • OCRD_PROFILE: This variable configures the built-in CPU and memory profiling. If empty, no profiling is done. Otherwise expected to contain any of the following tokens:

    • CPU: Enable CPU profiling of processor runs
    • RSS: Enable RSS memory profiling
    • PSS: Enable proportionate memory profiling
  • OCRD_PROFILE_FILE: If set, then the CPU profile is written to this file for later peruse with a analysis tools like snakeviz

  • PATH: Search path for processor executables (affects ocrd process and ocrd resmgr).

  • HOME: Directory to look for ocrd_logging.conf, fallback for unset XDG variables (see below).

  • XDG_CONFIG_HOME: Directory to look for ./ocrd/resources.yml (i.e. ocrd resmgr user database) – defaults to $HOME/.config.

  • XDG_DATA_HOME: Directory to look for ./ocrd-resources/* (i.e. ocrd resmgr data location) – defaults to $HOME/.local/share.

  • OCRD_DOWNLOAD_RETRIES: Number of times to retry failed attempts for downloads of workspace files.

  • OCRD_DOWNLOAD_TIMEOUT: Timeout in seconds for connecting or reading (comma-separated) when downloading.

  • OCRD_METS_CACHING: Whether to enable in-memory storage of OcrdMets data structures for speedup during processing or workspace operations.

  • OCRD_MAX_PROCESSOR_CACHE: Maximum number of processor instances (for each set of parameters) to be kept in memory (including loaded models) for processing workers or processor servers.

  • OCRD_NETWORK_SERVER_ADDR_PROCESSING: Default address of Processing Server to connect to (for ocrd network client processing).

  • OCRD_NETWORK_SERVER_ADDR_WORKFLOW: Default address of Workflow Server to connect to (for ocrd network client workflow).

  • OCRD_NETWORK_SERVER_ADDR_WORKSPACE: Default address of Workspace Server to connect to (for ocrd network client workspace).

  • OCRD_NETWORK_RABBITMQ_CLIENT_CONNECT_ATTEMPTS: Number of attempts for a worker to create its queue. Helpful if the rabbitmq-server needs time to be fully started.

Packages

ocrd_utils

Contains utilities and constants, e.g. for logging, path normalization, coordinate calculation etc.

See README for ocrd_utils for further information.

ocrd_models

Contains file format wrappers for PAGE-XML, METS, EXIF metadata etc.

See README for ocrd_models for further information.

ocrd_modelfactory

Code to instantiate models from existing data.

See README for ocrd_modelfactory for further information.

ocrd_validators

Schemas and routines for validating BagIt, ocrd-tool.json, workspaces, METS, page, CLI parameters etc.

See README for ocrd_validators for further information.

ocrd_network

Components related to OCR-D Web API

See README for ocrd_network for further information.

ocrd

Depends on all of the above, also contains decorators and classes for creating OCR-D processors and CLIs.

Also contains the command line tool ocrd.

See README for ocrd for further information.

bash library

Builds a bash script that can be sourced by other bash scripts to create OCRD-compliant CLI.

See README for bashlib for further information.

Testing

Download assets (make assets)

Test with local files: make test

  • Test with remote assets:
    • make test OCRD_BASEURL='https://github.com/OCR-D/assets/raw/master/data/'

See Also

Metadata

Release files for ocrd-validators 2.67.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 ocrd-validators 2.67.1
File Size Uploaded
ocrd_validators-2.67.1.tar.gz 332.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ocrd-validators 2.67.1
File Interpreter ABI Platform
ocrd_validators-2.67.1-py3-none-any.whl Python 3 none any Details

Total release size: 675.6 kB

Release files / ocrd_validators-2.67.1.tar.gz

Download URL ocrd_validators-2.67.1.tar.gz
Size 332.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7aaf9d77d5ac06a5bc8597622df1c8ef620b5813eb0095e4244814d2e5a8faa4
BLAKE2b-256 checksum
How to use checksums
f8a179f2f31b65d579883f948ae7e61173a404f956d877cd0b39619187bb4d07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19+

Release files / ocrd_validators-2.67.1-py3-none-any.whl

Download URL ocrd_validators-2.67.1-py3-none-any.whl
Size 342.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8684266aca7a88b0efd857ff250a8518d6e72d2dacc03cf42c8dac81f3176c1
BLAKE2b-256 checksum
How to use checksums
ac73c89dfd96a3691a9a52975b5f5d763e44c1f3b4835410ee5c10c92f43b58a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19+

Release history Release notifications | RSS feed

This release

2.67.1 This release

2 release files

2.64.0

2 release files

2.63.0

2 release files

2.62.0

2 release files

2.61.2

2 release files

2.61.1

2 release files

2.61.0

2 release files

2.60.3

2 release files

2.60.1

2 release files

2.60.0

2 release files

2.59.0

2 release files

2.58.1

2 release files

2.58.0

2 release files

2.57.2

2 release files

2.57.0

2 release files

2.56.0

2 release files

2.55.2

2 release files

2.55.1

2 release files

2.55.0

2 release files

2.53.0

2 release files

2.52.0

2 release files

2.50.0

2 release files

2.49.0

2 release files

2.48.1

2 release files

2.48.0

2 release files

2.47.4

2 release files

2.47.3

2 release files

2.47.2

2 release files

2.47.1

2 release files

2.47.0

2 release files

2.46.0

2 release files

2.45.1

2 release files

2.45.0

2 release files

2.42.0

2 release files

2.40.0

2 release files

2.39.0

2 release files

2.38.0

2 release files

2.37.0

2 release files

2.36.0

2 release files

2.34.0

2 release files

2.32.0

2 release files

2.31.0

2 release files

2.28.0

2 release files

2.26.1

2 release files

2.26.0

2 release files

2.25.1

2 release files

2.25.0

2 release files

2.24.0

2 release files

2.23.3

2 release files

2.23.2

2 release files

2.23.0

2 release files

2.22.4

2 release files

2.22.3

2 release files

2.22.2

2 release files

2.22.1

2 release files

2.22.0

2 release files

2.21.0

2 release files

2.20.2

2 release files

2.20.1

2 release files

2.19.0

2 release files

2.18.1

2 release files

2.18.0

2 release files

2.17.0

2 release files

2.16.3

2 release files

2.16.2

2 release files

2.15.0

2 release files

2.14.0

2 release files

2.13.2

2 release files

2.12.7

2 release files

2.12.6

2 release files

2.12.5

2 release files

2.12.4

2 release files

2.12.3

2 release files

2.12.2

2 release files

2.12.1

2 release files

2.12.0

2 release files

2.11.0

2 release files

2.10.5

2 release files

2.10.4

2 release files

2.10.3

2 release files

2.10.2

2 release files

2.10.1

2 release files

2.10.0

2 release files

2.9.0

2 release files

2.8.3

2 release files

2.8.2

2 release files

2.8.1

2 release files

2.8.0

2 release files

2.7.1

2 release files

2.7.0

2 release files

2.6.1

2 release files

2.6.0

2 release files

2.5.3

2 release files

2.5.2

2 release files

2.5.1

2 release files

2.5.0

2 release files

2.4.4

2 release files

2.4.3

2 release files

2.4.2

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.1

2 release files

1.0.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