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

> Easily check installed extractors in book-to-skill with book-to-skill --check. Get instant install commands for missing dependencies to streamline your workflow.

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

---

**Run `book-to-skill --check` to audit every optional extraction backend and receive copy-paste installation commands for missing Python packages or system binaries.**

`book-to-skill` is an open-source ebook-to-flashcard converter maintained by virgiliojr94. Before batch-processing your library, you should verify which extractors are present on your system to guarantee the highest quality text extraction. The repository ships with a built-in diagnostic system that identifies gaps in your environment and outputs the exact commands needed to close them.

## Using the CLI `--check` Flag

The fastest way to audit your setup is through the command-line interface. When you append the `--check` flag, the tool invokes the pre-flight diagnostic defined in [`book_to_skill/utils.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/book_to_skill/utils.py) and delegates the actual inspection to `run_dependency_check()` in [`book_to_skill/dependencies.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/book_to_skill/dependencies.py).

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

```

The command iterates over the `DEPENDENCY_GROUPS` structure, testing each declared extractor without attempting actual file conversion. It prints a hierarchical report showing which components are present (✓) or missing (✗), followed by a consolidated list of installation commands at the bottom.

## How the Dependency Check Works

The inspection engine distinguishes between two dependency types to determine extractor availability.

### Python Module Detection

For libraries such as `pypdf`, `pdfminer.six`, `ebooklib`, and `beautifulsoup4`, the script uses `importlib.util.find_spec` to verify whether the package is importable in the current interpreter. This check is performed inside [`book_to_skill/dependencies.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/book_to_skill/dependencies.py) and respects your active virtual environment.

### System Binary Detection

For external tools like `pdftotext` (part of `poppler-utils`) or Calibre’s `ebook-convert`, the tool employs `shutil.which` to confirm the executable exists on your `PATH`. This ensures that system-level utilities are detected regardless of how they were installed (package manager, manual build, or portable archive).

## Interpreting the Output and Install Commands

The diagnostic output groups results by format (PDF, EPUB, DOCX, HTML, RTF, MOBI/AZW). For each missing component, the tool prints a human-readable hint pointing to the installation source.

**Example aggregated output:**

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

  /usr/bin/python3 -m pip install pypdf pdfminer.six ebooklib beautifulsoup4 docx striprtf trafilatura
  # poppler-utils: sudo apt install poppler-utils

  # Calibre: install Calibre: https://calibre-ebook.com/download

```

The Python package list is constructed from the `PYTHON_DEPENDENCIES` mapping defined in [`book_to_skill/config.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/book_to_skill/config.py), ensuring that the suggested `pip install` command uses the exact PyPI names required by the extractors. System hints are OS-agnostic suggestions; you should adapt the package manager command (`apt`, `brew`, `dnf`, etc.) to your platform.

Important: All extractors are optional except Calibre for MOBI/AZW formats. Missing dependencies trigger graceful fallbacks—such as using the standard library `zipfile` parser for EPUB—so the program continues to function but with reduced extraction fidelity.

## Calling the Checker Programmatically

If you are building a wrapper or CI pipeline, you can import the check directly without shelling out to the CLI. The function always returns exit code `0` after printing the report, making it safe to call during setup routines.

```python
from book_to_skill.dependencies import run_dependency_check

# Prints the same report as the CLI and returns 0

run_dependency_check()

```

This entry point is also available when running the standalone extraction script at [`scripts/extract.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/scripts/extract.py), which respects the same `--check` flag implemented in the main CLI.

## Summary

- **Run `book-to-skill --check`** to trigger the diagnostic defined in [`book_to_skill/utils.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/book_to_skill/utils.py) and executed by `run_dependency_check()` in [`book_to_skill/dependencies.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/book_to_skill/dependencies.py).
- **Missing dependencies are optional**; the tool falls back to built-in parsers for most formats, though Calibre is mandatory for MOBI/AZW.
- **Python packages** are verified via `importlib.util.find_spec`, while **system binaries** are located with `shutil.which`.
- **Copy-paste installation commands** are generated from `PYTHON_DEPENDENCIES` in [`book_to_skill/config.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/book_to_skill/config.py) and printed at the end of the report.
- **Programmatic access** is available by importing `run_dependency_check` from the `dependencies` module.

## Frequently Asked Questions

### What extractors does the check validate?

The validator inspects backends for PDF (`pypdf`, `pdfminer.six`, `pdftotext`), EPUB (`ebooklib`, `beautifulsoup4`), DOCX (`python-docx`), RTF (`striprtf`), HTML (`trafilatura`), and MOBI/AZW (Calibre). Each format maps to a specific entry in the `DEPENDENCY_GROUPS` dictionary inside [`book_to_skill/dependencies.py`](https://github.com/virgiliojr94/book-to-skill/blob/main/book_to_skill/dependencies.py).

### Is Calibre required for all operations?

No. Calibre is strictly required only for MOBI and AZW files. For all other formats, missing dependencies simply reduce extraction quality, and the tool relies on standard library fallbacks or lighter Python packages.

### Can I run the check without installing optional dependencies?

Yes. The `--check` routine only tests for presence; it does not attempt to import or use the extractors for actual processing. You can run the diagnostic immediately after cloning the repository or installing the base package.

### Where does the tool look for system executables?

The script uses `shutil.which`, which scans the directories listed in your `PATH` environment variable. If a tool like `pdftotext` is installed in a non-standard location, ensure that directory is exported in your shell environment before running the check.