Skip to main content

CLI Application

Python CLI for source extraction, detector execution, and batched output delivery.

Setup

cd /unstructured/apps/cli
uv sync
# Optional if you want an activated shell instead of `uv run ...`:
source .venv/bin/activate

Optional detector groups:

uv sync --group detectors
# or specific groups: --group secrets --group pii --group threat ...

System dependency: LibreOffice

Legacy Office formats (.doc, .xls, .ppt) have no usable pure-Python parser, so src/utils/legacy_office.py shells out to soffice --headless --convert-to docx|xlsx|pptx and feeds the result through the normal OOXML extractors. Without it those files scan as "no content available" — a silent coverage gap, not an error.

  • Kubernetes and the all-in-one Docker image: installed in the image (libreoffice-*-nogui), so this works out of the box.
  • Local dev: install it yourself — brew install --cask libreoffice (macOS), apt install libreoffice-writer libreoffice-calc libreoffice-impress (Debian/Ubuntu), or libreoffice.org on Windows.
  • Non-standard install: set CLASSIFYRE_SOFFICE_PATH to the binary. The CLI checks that first, then PATH, then the standard macOS, Windows, and Linux-tarball install locations.

When no binary is found the file is not silently reported as empty. The scan raises an ENGINE_UNAVAILABLE text-extraction coverage error that fails that asset's text scan, lands in scan_stats.errors and the run's text-coverage counters, and carries a platform-specific message telling the user how to install LibreOffice.

tests/utils/test_legacy_office.py skips its round-trip tests when no LibreOffice is found, so a green local run does not by itself prove this path works.

Command Syntax

Use the thin wrapper:

uv run main.py <command> <recipe.json> [options]

Or direct module entrypoint:

uv run python -m src.main <command> <recipe.json> [options]

Commands:

  • test - test source connection.
  • discover - discover source resources.
  • extract - run extraction and emit batched output.
  • evaluate-file - internally evaluate detectors against one local file.

Extract Output Model

Extraction always emits in batches. Recipes do not contain output configuration; output is controlled by CLI flags and environment variables.

Output types:

  • console - emits NDJSON envelopes to stdout.
  • file - appends NDJSON envelopes to a file.
  • rest - pushes batches to API endpoints and finalizes run.

Default behavior:

  • If source_id is present (--source-id or SOURCE_ID env), default output is rest.
  • Otherwise default output is console.
  • Default batch size is 20.

CLI Options

Global/common:

  • --debug - enable debug logging.
  • --detectors-file <path> - file evaluation only.

Extract output options:

  • --output-type rest|file|console
  • --output-batch-size <int>
  • --output-rest-url <url> (complete API base, including the namespace path)
  • --output-file-path <path>
  • --source-id <uuid>
  • --runner-id <uuid>
  • --managed-runner (REST only; runner lifecycle managed by API orchestrator)

Environment fallbacks:

  • SOURCE_ID, RUNNER_ID
  • CLASSIFYRE_OUTPUT_TYPE, CLASSIFYRE_OUTPUT_BATCH_SIZE
  • CLASSIFYRE_OUTPUT_REST_URL, CLASSIFYRE_OUTPUT_REST_TIMEOUT_SEC
  • CLASSIFYRE_OUTPUT_FILE_PATH
  • API_URL (fallback base URL for REST output)

Practical Examples

1) Console output (quick local test)

uv run main.py extract ./wordpress-recipe.json --output-type console --output-batch-size 1

You will see NDJSON lines like:

  • {"event":"batch", ...}
  • {"event":"finish", ...}

2) File output

uv run main.py extract ./wordpress-recipe.json \
  --output-type file \
  --output-file-path /tmp/classifyre-assets.ndjson \
  --output-batch-size 20

3) REST output (manual CLI to backend)

uv run main.py extract ./wordpress-recipe.json \
  --output-type rest \
  --source-id <source_uuid>

Notes:

  • --runner-id optional for manual runs. If omitted, CLI creates external runner automatically.
  • --output-rest-url is optional. If omitted, CLI uses CLASSIFYRE_OUTPUT_REST_URL, then API_URL, then http://localhost:8000. In a namespaced deployment, pass the complete base (for example https://api.example/ns-id); the CLI appends all asset, finding, runner, and source endpoints beneath it.
  • --managed-runner should be used only for API-orchestrated runs where runner already exists.

4) REST output with explicit runner (managed/orchestrated style)

uv run main.py extract ./wordpress-recipe.json \
  --output-type rest \
  --source-id <source_uuid> \
  --runner-id <runner_uuid> \
  --managed-runner

5) Full extract command with all output flags

uv run main.py extract ./wordpress-recipe.json \
  --output-type rest \
  --output-batch-size 20 \
  --output-rest-url http://localhost:8000 \
  --output-file-path /tmp/classifyre-assets.ndjson \
  --source-id <source_uuid> \
  --runner-id <runner_uuid> \
  --managed-runner

Use --output-file-path only when --output-type file.

Dev Scripts

  • bun run dev - run CLI quickly.
  • bun run lint - ruff format/check.
  • bun run check-types - mypy.
  • bun run test - pytest suite.

Release files for classifyre-cli 0.5.10

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

Source distribution (sdist)

Source distribution for classifyre-cli 0.5.10
File Size Uploaded
classifyre_cli-0.5.10.tar.gz 1.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for classifyre-cli 0.5.10
File Interpreter ABI Platform
classifyre_cli-0.5.10-py3-none-any.whl Python 3 none any Details

Total release size: 1.9 MB

Release files / classifyre_cli-0.5.10.tar.gz

Download URL classifyre_cli-0.5.10.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
bae0ab19e08e3d491f947e4d9584b9bfd44caa5ccebe1d338e29e288380ca553
BLAKE2b-256 checksum
How to use checksums
ce1539cb3d7b6693587015ae60b3ab1be18527641e8330c89ef1c0252d4fd4a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / classifyre_cli-0.5.10-py3-none-any.whl

Download URL classifyre_cli-0.5.10-py3-none-any.whl
Size 672.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2c990364c3b41f950162be8b7c870564583935310207184844547c86e5c47ae
BLAKE2b-256 checksum
How to use checksums
32c6b171e176a10d5c38d9c13875278ae82e9af9c849c1b2e086e5633da4eeb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.6.0

2 release files

0.5.13

2 release files

0.5.12

2 release files

0.5.11

2 release files

This release

0.5.10 This release

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.80

2 release files

0.4.79

2 release files

0.4.78

2 release files

0.4.77

2 release files

0.4.76

2 release files

0.4.75

2 release files

0.4.74

2 release files

0.4.73

2 release files

0.4.72

2 release files

0.4.71

2 release files

0.4.70

2 release files

0.4.69

2 release files

0.4.68

2 release files

0.4.67

2 release files

0.4.66

2 release files

0.4.65

2 release files

0.4.64

2 release files

0.4.63

2 release files

0.4.62

2 release files

0.4.61

2 release files

0.4.60

2 release files

0.4.59

2 release files

0.4.58

2 release files

0.4.57

2 release files

0.4.56

2 release files

0.4.55

2 release files

0.4.54

2 release files

0.4.53

2 release files

0.4.52

2 release files

0.4.51

2 release files

0.4.50

2 release files

0.4.49

2 release files

0.4.48

2 release files

0.4.47

2 release files

0.4.46

2 release files

0.4.45

2 release files

0.4.44

2 release files

0.4.43

2 release files

0.4.33

2 release files

0.4.32

2 release files

0.4.31

2 release files

0.4.30

2 release files

0.4.29

2 release files

0.4.28

2 release files

0.4.27

2 release files

0.4.26

2 release files

0.4.25

2 release files

0.4.24

2 release files

0.4.23

2 release files

0.4.22

2 release files

0.4.21

2 release files

0.4.20

2 release files

0.4.19

2 release files

0.4.18

2 release files

0.4.17

2 release files

0.4.16

2 release files

0.4.15

2 release files

0.4.10

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

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