# How to Check Installed Extractors and Get Install Commands in book-to-skill

> Learn how to check installed extractors in book-to-skill using the --check flag. Get precise pip and system commands to install missing components for PDF, EPUB, DOCX, and more.

- Repository: [Virgilio Junior/book-to-skill](https://github.com/virgiliojr94/book-to-skill)
- Tags: how-to-guide
- Published: 2026-09-01

---

**Use the `--check` CLI flag to run a pre-flight dependency scan that reports which optional extractors (PDF, EPUB, DOCX, HTML, RTF, MOBI/AZW) are available and prints the exact `pip` or system commands needed to install any missing components.**

The `book-to-skill` repository provides a built-in diagnostic command for verifying extractor availability. This guide explains how to run the check, interpret the output, and automate missing dependency installation based on the source code in `virgiliojr94/book-to-skill`.

## Running the Dependency Check

### Basic Check Command

The fastest way to verify installed extractors is through the CLI entry point:

```bash
book-to-skill --check

```

Alternatively, use the repository wrapper script when working from source:

```bash
python3 scripts/extract.py --check

```

### How the Check Is Processed

The `--check` flag is intercepted early in [`book_to_skill/utils.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/book_to_skill/utils.py) at lines 73-75. When detected, it immediately calls `run_dependency_check()` from [`dependencies.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/dependencies.py) and exits without processing any files.

This short-circuit design ensures you get instant feedback without triggering the full extraction pipeline.

## What the Check Detects

The `run_dependency_check()` function (lines 52-58 in [`book_to_skill/dependencies.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/book_to_skill/dependencies.py)) iterates over the `DEPENDENCY_GROUPS` definition to evaluate each extractor category.

### Detection Categories

For every format group, the check evaluates:

- **Python modules** — tests importability via `python_module_available`
- **External binaries** — verifies presence on `PATH`
- **Fallback status** — indicates whether the format can use lower-quality parsing

### Report Output Structure

The diagnostic prints a ✔︎/✘ status line for each dependency. Missing Python packages are aggregated into a single install command, while missing system binaries receive commented hints.

Example output:

```

book-to-skill — dependency check

  PDF (smart inspection / native Markdown)
    ✗ python: pdf_inspector
      ↳ a `pdf_inspector` command exists at /usr/local/bin/pdf_inspector...

  PDF (text-heavy)
    ✗ python: pypdf
    ✗ python: pdfminer
    ✗ system: pdftotext (poppler-utils)  # sudo apt install poppler-utils

  → fallback available (install for best quality) — any one of pdftotext / pypdf / pdfminer is enough

...

To enable the best extractor for every format, install the missing pieces:

  /usr/bin/python3 -m pip install pypdf pdfminer
  # poppler-utils: sudo apt install poppler-utils

```

The **"→" indicator** reveals three states per format:

| Indicator | Meaning |
|-----------|---------|
| ✔︎ all green | Best-quality extractor ready |
| → fallback available | Functional but lower quality |
| ✗ required missing | Cannot process this format (e.g., Calibre for MOBI) |

## Automating Missing Dependency Installation

### Automatic Python Package Installation

Enable auto-installation with the `--install-missing` flag:

```bash
book-to-skill --install-missing=yes --check

```

This triggers `offer_dependency_install()` in [`dependencies.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/dependencies.py), which attempts to `pip install` missing Python wheels before falling back to stdlib parsers.

You can also set the environment variable:

```bash
export BOOK_SKILL_INSTALL_MISSING=yes
book-to-skill --check

```

## Programmatic Access

Capture the dependency report in Python scripts:

```python
import subprocess
import sys

result = subprocess.run(
    [sys.executable, "-m", "book_to_skill", "--check"],
    capture_output=True,
    text=True,
)

print("Dependency report:")
print(result.stdout)

```

This approach is useful for CI/CD pipelines or environment validation scripts.

## Core Implementation Details

| File | Key Function | Purpose |
|------|--------------|---------|
| [`book_to_skill/dependencies.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/book_to_skill/dependencies.py) | `run_dependency_check()` | Defines `DEPENDENCY_GROUPS`, probes modules, builds install commands (lines 18-27, 60-84) |
| [`book_to_skill/utils.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/book_to_skill/utils.py) | CLI argument parsing | Detects `--check` flag and routes to dependency check (lines 73-75) |
| [`book_to_skill/cli.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/book_to_skill/cli.py) | `main()` entry point | UTF-8 stream setup and PDF-inspector hook loading |
| [`scripts/extract.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/scripts/extract.py) | Wrapper script | Alternative invocation path for repository users |

The install-command generation logic (lines 18-27 in [`dependencies.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/dependencies.py)) aggregates all missing Python packages into one `pip install` line and provides shell-commented hints for system packages like `poppler-utils` or `calibre`.

## Summary

- **Run `book-to-skill --check`** to scan all optional extractors and see exact install commands
- **Check output** shows ✔︎/✘ status per dependency with fallback indicators
- **Copy-paste the final command block** to install missing Python packages; follow commented hints for system binaries
- **Use `--install-missing=yes`** for automatic Python package installation
- **Key source files**: [`dependencies.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/dependencies.py) for detection logic, [`utils.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/utils.py) for CLI flag handling

Run the check after any environment change to ensure optimal extraction quality without manually consulting documentation.

## Frequently Asked Questions

### How do I check if PDF extraction will work in book-to-skill?

Run `book-to-skill --check` and examine the "PDF" section. The tool reports three detection paths: smart inspection via `pdf_inspector`, text-heavy parsing via `pypdf`/`pdfminer`/`pdftotext`, and fallback availability. Any one working dependency enables PDF processing, though quality varies by source document structure.

### What if the check reports "required missing" for a format?

This indicates no fallback parser exists for that format—install the specified dependency before proceeding. For MOBI/AZW files, the check requires Calibre's `ebook-convert` binary and will not proceed without it, unlike PDF or EPUB which offer stdlib fallbacks.

### Can I suppress the install hints and just see status?

The `--check` flag always produces the full report including install suggestions. To parse status programmatically, capture stdout and filter lines containing "✔︎" or "✗" indicators. The structured output format remains consistent across versions for reliable parsing.

### Where does book-to-skill look for external binaries like pdftotext?

The `python_module_available` helper and binary detection routines scan the current `PATH` environment variable. Binaries installed via package managers (`apt`, `brew`, `choco`) are detected automatically when their installation directory appears in `PATH` before running the check.