How to Check Dependencies in Book-to-Skill: The Complete Verification Guide

Run python3 scripts/extract.py --check from the repository root to verify that all external extraction tools are installed and available on your system.

Book-to-Skill is an open-source document conversion utility that relies on external binaries and Python packages to parse complex formats like PDF and EPUB. Before processing your first document, you should check dependencies in Book-to-Skill to ensure your environment meets all requirements. The repository includes a built-in health-check system that probes for required extractors and reports exactly what needs to be installed.

Using the Built-in Dependency Check Command

The fastest way to validate your environment is through the command-line interface provided in scripts/extract.py. This wrapper forwards arguments to the book_to_skill.cli module and triggers the verification routine when passed the --check flag.

Running the CLI Health Check

Execute the following command from the repository root (or from an installed copy of the package):

python3 scripts/extract.py --check

This invokes book_to_skill.dependencies.check() and prints a formatted table showing the status of each supported document format. The command returns exit code 0 if all critical tools are found, making it suitable for automation scripts and CI/CD pipelines.

Understanding the Output Format

The health-check displays each document format alongside the external tool required to parse it. A indicates the tool is present on your PATH (or the Python package is importable), while a signals a missing dependency followed by the exact installation command.

Typical output looks like this:


PDF → pdftotext      ✓
PDF → docling        ✗  pip3 install docling
EPUB → ebooklib      ✓
DOCX → python-docx   ✗  pip3 install python-docx
HTML → beautifulsoup ✓
RTF → striprtf       ✗  pip3 install striprtf
MOBI → calibre       ✗  https://calibre-ebook.com/download

How the Dependency Verification Works

The verification system is modular, separating CLI argument parsing from the actual probing logic. This design allows you to check dependencies in Book-to-Skill either via command line or programmatically within Python scripts.

The CLI Entry Point in extract.py

The file scripts/extract.py serves as the main entry point for command-line operations. When you append the --check argument, the CLI delegates to the dependency verification module before any document processing begins. This ensures early failure with helpful diagnostics rather than cryptic runtime errors during conversion.

The Core Check Logic in dependencies.py

The actual probing occurs in book_to_skill/dependencies.py. This module maintains a registry that maps each supported format to its preferred external tool:

  • PDF: pdftotext (poppler-utils) or docling
  • EPUB: ebooklib
  • DOCX: python-docx
  • HTML: beautifulsoup4
  • RTF: striprtf
  • MOBI: calibre binaries

For each entry, the code executes the following steps:

  1. Attempts to locate the executable on the system PATH or imports the Python module
  2. Records a boolean success flag indicating presence or absence
  3. On failure, composes a platform-specific installation command (e.g., sudo apt install poppler-utils for missing PDF tools)
  4. Returns a structured dictionary that the CLI renders into the human-readable table

The design keeps dependency probing optional for basic functionality. The core Python package handles plain text, Markdown, reStructuredText, and AsciiDoc without any external binaries. Only heavy-processing formats like PDF, EPUB, and DOCX trigger the requirement for third-party tools.

Programmatic Dependency Checks

You can also verify dependencies from within your own Python code by importing the check function directly. This is useful for building custom preprocessing workflows or environment setup scripts.

from book_to_skill.dependencies import check

# Returns a structured status dictionary

status = check()

for fmt, info in status.items():
    symbol = '✓' if info['found'] else '✗'
    print(f"{fmt}: {info['tool']}{symbol}")
    
    if not info['found']:
        print(f"  Install: {info['install_cmd']}")

The check() function returns a mapping where each key is a format identifier, and each value contains:

  • tool: The name of the required executable or package
  • found: Boolean indicating availability
  • install_cmd: Specific command to install the missing dependency

Supported Formats and Tool Requirements

When you check dependencies in Book-to-Skill, you are effectively auditing the following format support matrix:

  • Plain Text / Markdown / reStructuredText / AsciiDoc: No external dependencies required; these work with the standard library
  • PDF: Requires pdftotext (from poppler-utils) or the docling Python package
  • EPUB: Requires the ebooklib Python package
  • DOCX: Requires python-docx
  • HTML: Requires beautifulsoup4
  • RTF: Requires striprtf
  • MOBI: Requires Calibre's ebook-convert binary

The quick-start documentation in docs/install.md references the same --check command as the canonical way to verify your setup before attempting conversions.

Summary

  • Run python3 scripts/extract.py --check to execute the built-in health check and see which document extractors are available on your system.
  • The verification logic lives in book_to_skill/dependencies.py, specifically within the check() function, which probes for executables and Python packages.
  • Core functionality for plain text and markup formats requires no external tools, while PDF, EPUB, DOCX, HTML, RTF, and MOBI processing depends on specific third-party binaries.
  • The command outputs actionable installation commands for any missing dependencies, making environment setup straightforward.

Frequently Asked Questions

What command checks Book-to-Skill dependencies?

Run python3 scripts/extract.py --check from the repository root. This executes the health-check routine defined in book_to_skill/dependencies.py and prints a table showing which external tools are installed and which are missing.

Where is the dependency check implemented?

The implementation spans two key files: scripts/extract.py handles CLI argument parsing and delegates to book_to_skill/dependencies.py, where the check() function performs the actual probing of system executables and Python packages.

Do I need external tools for all document formats?

No. Book-to-Skill processes plain text, Markdown, reStructuredText, and AsciiDoc using only the Python standard library. External dependencies are required only for binary or complex formats such as PDF, EPUB, DOCX, HTML, RTF, and MOBI.

How do I install missing dependencies identified by the check?

The --check command output includes the exact installation command for each missing tool. For example, it will suggest pip3 install docling for missing Python packages or sudo apt install poppler-utils for system binaries like pdftotext. Follow the specific command listed next to the ✗ marker in the output table.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →