Skip to main content

A CLI tool for sanity checking BibTeX entries

Project description

BibSanity

Experimental note: This project started as a one-day, vibe-coded experiment. Expect rough edges.

A CLI tool to sanity-check BibTeX entries and flag likely invalid citations or inconsistent metadata.

Features

  • Hybrid Verification Logic: DOI lookup via Crossref API, falling back to title search via OpenAlex API
  • Multiple Report Formats: Terminal output (Rich tables), JSON, and HTML reports
  • Organized Output: Reports are saved in Sanity_Report next to the input file
  • Caching: Caches API responses to reduce redundant requests
  • Concurrent Processing: Verifies multiple entries in parallel
  • Conservative Language: Uses FAIL/WARN/OK statuses with clear reasons

Installation

From PyPI:

pip install bibsanity

From source:

git clone https://github.com/<your-username>/<repo>.git
cd BibSanity
python -m venv .venv
source .venv/bin/activate
pip install -e .

Quickstart

bibsanity examples/test_refs.bib

Options

  • --format, -f FORMAT: Output format: json, html, or all (default: json)
  • --json, -j PATH: Custom path for JSON report (default: saved in Sanity_Report)
  • --out, -o PATH: Custom path for HTML report (deprecated; use --format instead)
  • --max-workers, -w N: Maximum concurrent workers (default: 6)
  • --strict, -s: Use strict verification mode (treats warnings as failures)
  • --no-cache: Disable caching

Examples

# Basic check (generates JSON report in Sanity_Report folder)
bibsanity examples/test_refs.bib

# Generate HTML report
bibsanity references.bib --format html

# Generate all formats (JSON + HTML)
bibsanity references.bib --format all

# Custom JSON report path
bibsanity references.bib --json custom_report.json

# Strict mode with more workers
bibsanity references.bib --strict --max-workers 10

Report Location

Reports are automatically saved in a Sanity_Report folder next to your input file:

references.bib
Sanity_Report/
  ├── references_report.json
  └── references_report.html

Verification Logic

  1. DOI-based verification (if DOI is present):

    • Looks up the DOI in Crossref API
    • Compares title, year, and authors
    • Returns OK if metadata matches, WARN/FAIL if inconsistencies found
  2. Title-based verification (if no DOI or DOI lookup fails):

    • Searches OpenAlex API by title
    • Uses fuzzy matching to find best match
    • Compares year and authors
    • Returns OK if good match found, WARN/FAIL if inconsistencies found
  3. Failure cases:

    • No DOI and no title match found
    • Metadata inconsistencies (year, authors, title mismatch)

Known Limitations / Possible False Positives

  1. Old papers published in conferences and journals with highly similar titles.
  2. Titles with special characters such as $$ or LaTeX equations.
  3. Non-English papers or journals that are not indexed in Crossref or OpenAlex.

Report Formats

Terminal Report

Rich-formatted table showing entry ID, status, and reason.

JSON Report

Structured JSON with summary statistics and detailed results for each entry.

HTML Report

Styled HTML report with summary cards and detailed table (generated when --format html or --format all is used).

Status Codes

  • OK: Entry verified successfully with matching metadata
  • WARN: Entry found but metadata inconsistencies detected
  • FAIL: Entry could not be verified or strict mode violations

Exit Codes

  • 0: Completed with no FAIL results
  • 1: Errors or one or more FAIL results

Requirements

  • Python 3.9+
  • Internet connection (for API calls to Crossref and OpenAlex)

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bibsanity-0.1.1.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bibsanity-0.1.1-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file bibsanity-0.1.1.tar.gz.

File metadata

  • Download URL: bibsanity-0.1.1.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bibsanity-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dbbb1d155c49258b40a7ac4a2390761fe6fedb59027eb6ef3d3f994926b3d92c
MD5 9fcc2e11760390485d71d4dbaa2dee4b
BLAKE2b-256 99daf4a73503c2fb29d3b1ae14d38ab7b2a9014f02443111fcc5eda632c3c799

See more details on using hashes here.

Provenance

The following attestation bundles were made for bibsanity-0.1.1.tar.gz:

Publisher: pypi-publish.yml on Y1kee/BibSanity

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bibsanity-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bibsanity-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bibsanity-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0428119d20ba7e77a050a9baa8f5f4a54e9cc9aacf981aa20761483a4aa92fa8
MD5 52daca77cfd4264f81ff528d61d36a4d
BLAKE2b-256 64b4d02a98dda524d9a58cfc4414815cf2ef86cad7bf3499fcbe863dbd2c2961

See more details on using hashes here.

Provenance

The following attestation bundles were made for bibsanity-0.1.1-py3-none-any.whl:

Publisher: pypi-publish.yml on Y1kee/BibSanity

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page