Skip to main content

bibsync

CI Documentation Status Crates.io Docs.rs PyPI Version Python Versions License Ruff DOI SPEC 0 — Minimum Supported Dependencies

bibsync synchronizes BibTeX files from citation keys in LaTeX sources. It is inspired by adstex, with provider support for both NASA ADS and InspireHEP.

The primary workflow is to cite papers by identifier, especially arXiv ID:

\citep{2404.14498}
\citet{arXiv:2312.00752}

Then check the bibliography:

bibsync main.tex -o references.bib

To update the file, add --fix:

bibsync --fix main.tex -o references.bib

bibsync scans the TeX file, resolves missing identifier-like citekeys through NASA ADS and/or InspireHEP, rewrites provider BibTeX entries so the citekey stays the key used in TeX, and reports whether the output .bib file is current. With --fix, it writes the merged bibliography.

Markdown sources are supported too, including Journal of Open Source Software paper.md files. bibsync reads pandoc citations and the bibliography field from the YAML frontmatter:

---
bibliography: paper.bib
---

Prior work [@1602.03837; @10.1103/PhysRevLett.116.061102].
bibsync --fix paper.md

When a citekey cannot be resolved, the command prints the key together with a reason and the likely fix. For example, an unsupported citekey is reported as an identifier-format problem, while an arXiv ID or DOI that the provider cannot find is reported as a provider miss.

Installation

Install the Rust CLI from crates.io:

cargo install bibsync

Install the Python package from PyPI:

pip install bibsync

The PyPI package includes Python bindings and installs the bibsync command. Python 3.12 or newer is required.

You can also download a pre-built binary from the GitHub releases page. Pick the archive for your platform, extract it, and place the bibsync executable somewhere on your PATH.

To compile from source:

git clone https://github.com/isaac-cf-wong/bibsync.git
cd bibsync
cargo build --release

The compiled binary is written to target/release/bibsync on Unix-like systems or target\release\bibsync.exe on Windows.

Citing

If bibsync contributes to a scientific publication, please cite it using the Zenodo record:

https://doi.org/10.5281/zenodo.20422622

Citation formats including BibTeX can be exported directly from the Zenodo page. For convenience, you can also use:

@software{wong2026bibsync,
  author  = {Wong, Isaac C. F.},
  title   = {bibsync: A Rust package to automatically resolve, synchronize, and validate LaTeX citations across BibTeX databases},
  version = {v0.4.6},
  year    = {2026},
  month   = jul,
  doi     = {10.5281/zenodo.20422622},
  url     = {https://doi.org/10.5281/zenodo.20422622}
}

Providers

By default bibsync tries NASA ADS first and InspireHEP second:

bibsync --fix main.tex -o references.bib --provider auto

NASA ADS requires an API token:

export ADS_API_TOKEN="..."

You can choose a single provider:

bibsync --fix main.tex -o references.bib --provider ads
bibsync --fix main.tex -o references.bib --provider inspire

InspireHEP supports arXiv IDs and DOIs. NASA ADS supports arXiv IDs, DOIs, and ADS bibcodes.

Python API

bibsync can also be installed from PyPI:

pip install bibsync

The PyPI package provides Python bindings backed by the Rust implementation:

import bibsync

report = bibsync.sync_files(
    ["main.tex"],
    output="references.bib",
    provider="inspire",
    check=True,
)

It also installs the bibsync command. The command delegates to the same Rust CLI implementation as the Cargo-installed binary, so command-line behavior is kept in one place.

Existing Bibliographies

If the TeX source contains \bibliography{references}, bibsync can discover references.bib automatically:

bibsync --fix main.tex

Additional read-only bibliographies can be used to avoid duplicating entries:

bibsync --fix main.tex -o references.bib -r shared.bib software.bib

Use --merge-other to copy matching entries from those read-only files into the main output file.

To update a bibliography in place, pass a single .bib file:

bibsync --fix references.bib --force-regenerate

Existing input files are validated before resolution. A missing single .bib input, --other bibliography, or --ignore-file is reported as an error with the path that could not be read. Existing bibliography files are also parsed strictly, so malformed BibTeX reports the file and the approximate failing entry instead of being treated as an empty or partial bibliography.

Update Behavior

By default bibsync leaves published entries untouched. Only entries that look like unpublished preprints — those with an archivePrefix or eprinttype field but no journal field — are re-queried to check whether they have been published. If so, the entry is updated; otherwise it is preserved.

Flag Behavior
(default) Re-check preprints; skip published entries
--no-update Skip all existing entries
--update-all Re-resolve all existing entries
--force-regenerate Re-resolve and overwrite all existing entries

Ignoring Entries

To exclude specific entries from all resolution — for example, books or theses you have curated by hand — list their citekeys in a .bibsyncignore file:

# .bibsyncignore
knuth1997art
smith2024thesis

Pass the file with --ignore-file:

bibsync --fix main.tex -o references.bib --ignore-file .bibsyncignore

Cache

Use --cache to avoid repeated provider API calls:

bibsync --cache main.tex -o references.bib
bibsync --fix --cache main.tex -o references.bib

The cache stores provider records and mappings from arXiv IDs or DOIs to the provider's canonical record ID. Preprint entries that are re-checked for publication always bypass the cache and fetch a fresh result, then write it back. Use --refresh-cache to force a fresh fetch for all entries:

bibsync --fix --refresh-cache main.tex -o references.bib

Override the cache location with --cache-dir DIR.

If a cache file is corrupt, bibsync reports the exact cache path and asks you to refresh or remove the bad cache entry. Provider request failures include the provider and citekey or batch being resolved.

Pre-commit

The repository includes .pre-commit-hooks.yaml, so other projects can use bibsync as a pre-commit hook.

Both hooks run on TeX (.tex), BibTeX (.bib), and Markdown (.md) files. Every @key in a scanned file is treated as a citation, so scanning unrelated Markdown can raise false positives — for example a README.md that uses GitHub @mentions. The recommended setup is to scope the hook to your citation sources with files: rather than relying on the default file matching.

For a JOSS paper (paper.md + paper.bib):

repos:
    - repo: https://github.com/isaac-cf-wong/bibsync
      rev: v0.4.6
      hooks:
          - id: bibsync-bin
            files: ^paper\.md$
            args: [--fix, --cache, --provider, inspire, --output, paper.bib]

The --output bibliography is read and written even when it is not itself matched by files:, so scoping to paper.md still keeps paper.bib in sync.

The remaining examples below omit files: for brevity; add it to match your project layout.

Use the pre-built binary hook for faster installs:

repos:
    - repo: https://github.com/isaac-cf-wong/bibsync
      rev: v0.4.6
      hooks:
          - id: bibsync-bin
            args: [--cache, --provider, inspire, --output, references.bib]

The binary hook downloads a platform-specific archive from the GitHub release matching rev and caches it under pre-commit's cache directory. The source hook is available for Linux x86_64/aarch64, macOS x86_64/aarch64, and Windows x86_64. The source hook is still available, but it compiles the Rust crate during hook installation:

repos:
    - repo: https://github.com/isaac-cf-wong/bibsync
      rev: v0.4.6
      hooks:
          - id: bibsync
            args: [--provider, inspire, --output, references.bib]

By default, the hook checks whether the bibliography is current and fails without writing changes. To let the hook update files, add --fix to the hook args:

repos:
    - repo: https://github.com/isaac-cf-wong/bibsync
      rev: v0.4.6
      hooks:
          - id: bibsync-bin
            args: [--fix, --cache, --provider, inspire, --output, references.bib]

To skip manually curated entries, add --ignore-file:

repos:
    - repo: https://github.com/isaac-cf-wong/bibsync
      rev: v0.4.6
      hooks:
          - id: bibsync-bin
            args:
                [
                    --fix,
                    --cache,
                    --provider,
                    inspire,
                    --output,
                    references.bib,
                    --ignore-file,
                    .bibsyncignore,
                ]

For a project-local hook while developing bibsync itself:

repos:
    - repo: local
      hooks:
          - id: bibsync
            name: bibsync
            entry: cargo run -- --fix --provider inspire --output references.bib
            language: system
            files: \.tex$

Download files

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

Source Distribution

bibsync-0.4.6.tar.gz (73.0 kB view details)

Uploaded Source

Built Distributions

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

bibsync-0.4.6-cp312-abi3-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.12+Windows x86-64

bibsync-0.4.6-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ x86-64

bibsync-0.4.6-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ ARM64

bibsync-0.4.6-cp312-abi3-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

bibsync-0.4.6-cp312-abi3-macosx_10_12_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.12+macOS 10.12+ x86-64

File details

Details for the file bibsync-0.4.6.tar.gz.

File metadata

  • Download URL: bibsync-0.4.6.tar.gz
  • Upload date:
  • Size: 73.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for bibsync-0.4.6.tar.gz
Algorithm Hash digest
SHA256 3639214fcd8aeaccb235772db9e9725dc862f29b0d54acf20b834e9f9c311cd0
MD5 dad4be7382cfc5c93ebfb40c311d2e80
BLAKE2b-256 be70d7ca9dd68c9e3110b797162af5fd0241a44ef809d827d75ebda68cfb1caa

See more details on using hashes here.

File details

Details for the file bibsync-0.4.6-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: bibsync-0.4.6-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for bibsync-0.4.6-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d9cba328912caeb77197fc93cce8f92525865fabafc733ade66e5b241f605150
MD5 af820bdbaed83a51a7bc92fee9c5ca97
BLAKE2b-256 a5b962469f00ee9772788b591fef3f38b12f73e20c75d5c167a74fc4a8a52ccd

See more details on using hashes here.

File details

Details for the file bibsync-0.4.6-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: bibsync-0.4.6-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 3.4 MB
  • Tags: CPython 3.12+, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for bibsync-0.4.6-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 144a4e80383a17eb48e2b74681239fa8cca2f66b1c4b6dcb65c5090ad85cdfe2
MD5 d2bcd2eaff6440a01ce9aa3e3ea9f4e9
BLAKE2b-256 38ba045605e0800ff6cefd6c3f2a06215f16ad87256742a1a498e46d7073c45f

See more details on using hashes here.

File details

Details for the file bibsync-0.4.6-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

  • Download URL: bibsync-0.4.6-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.12+, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for bibsync-0.4.6-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2273ab9cd50d17d08b0799b779d5c7df281b5edb5f0bfa3bfa564d508c5b10ad
MD5 bc58d5a869eb11e7eac9a9d42aed4266
BLAKE2b-256 2d2e2dcb3d0f733bd8d649bb3dc3a5b63637ad0066a8e87f1c96a6855fd95ee5

See more details on using hashes here.

File details

Details for the file bibsync-0.4.6-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: bibsync-0.4.6-cp312-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.12+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for bibsync-0.4.6-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fe0f073fdda2a496cc01615cc39035c979c7a76627fa696f7ce67e78d2f96ef3
MD5 59a5f572b8ee2d189593539b2213387f
BLAKE2b-256 50e06728eaef472dd8380918f9905b4e5cdf93ce56a33ab49442210a46c94b89

See more details on using hashes here.

File details

Details for the file bibsync-0.4.6-cp312-abi3-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: bibsync-0.4.6-cp312-abi3-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.12+, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for bibsync-0.4.6-cp312-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3db0ca3a89460bd206f87b9bec1ffcb6a919ec7265f5bf2707bd384b4b700f3b
MD5 0a3a12e4bbbc77cb83fa23ff579ea8af
BLAKE2b-256 e38ff7dad5d867407dc64cfb42920cb3a953632ae7fc9f305e37d08d14bc1582

See more details on using hashes here.

Release history Release notifications | RSS feed

0.4.11

6 files

0.4.10

6 files

0.4.9

6 files

0.4.8

6 files

0.4.7

6 files

This release

0.4.6 This release

6 files

0.4.5

6 files

0.4.4

6 files

0.4.3

6 files

0.4.2

6 files

0.4.1

6 files

0.4.0

6 files

0.3.5

6 files

0.3.4

6 files

0.3.3

6 files

0.3.2

6 files

0.3.1

6 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