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.13 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 = {v2.0.0},
  year    = {2026},
  month   = nov,
  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

Author Lists

InspireHEP and NASA ADS truncate long author lists in their BibTeX (Abac, A. G. and others, ... and et al.). Citation styles that treat others as a name, such as the one JOSS uses, then print "Abac & others" instead of "Abac et al.". Add --full-author-lists to fetch the complete list from the provider:

bibsync --fix paper.md --full-author-lists

Papers with more than 100 authors that name a collaboration are credited to the collaboration(s) instead, as one brace-protected corporate author, for example {LIGO Scientific Collaboration, VIRGO Collaboration and KAGRA Collaboration}. The option is off by default, costs one extra provider request per truncated entry, and, like --full-journal-names, applies only to entries resolved from a provider in that run (use --force-regenerate once to convert an existing file). An entry whose provider has no full list is left truncated and reported.

Journal Names

Providers abbreviate journal names: InspireHEP writes Phys. Rev. D and NASA ADS writes AAS macros such as \prd. Some venues, including JOSS, require full names. Add --full-journal-names to write them in full:

bibsync --fix paper.md --full-journal-names

This applies to entries resolved from a provider in that run (new entries, refreshed preprints, and everything with --update-all or --force-regenerate); entries already in the bibliography are not rewritten, so run once with --force-regenerate to convert an existing file. The full names come from a table maintained in bibsync (src/journals.rs), which also lists journals whose short title is already their full name (Nature, SoftwareX). Any other journal is left unchanged and reported, never guessed, so you can check it by hand:

bibsync: journal "Phys. Rev. Z" in 2001.00001 is not in bibsync's journal table; left unchanged, check that it is the full name

To catch abbreviations that --full-journal-names cannot fix (journals missing from the table, and hand-written or ignored entries), add --check-venue-names. It checks the journal and booktitle of every entry in the bibliography, including entries listed in the ignore file, names each one that is or looks abbreviated, and makes the run fail:

bibsync: journal in smith2024 is abbreviated: "Phys. Rev. D"; write "Physical Review D"

A name in bibsync's journal table is judged by the table: its abbreviations are always reported, with the full name to write, and its full names never are, even when written with a period where the table has a colon (Journal of Physics. Conference Series). Any other name is reported as looking abbreviated when it contains a word cut short with a period (Phys., J.Phys.; St., Ste., Mt. and Ft. are allowed), or is a single short word with two or more capitals (JCAP). The parts of a concatenation are joined first, so "Physical Review" # " D" passes. A macro reference (journal = prd) is always reported, because bibsync cannot see the name it stands for, and so is an entry whose fields bibsync cannot read.

The rule for names outside the table is a heuristic, so a real full title such as RNA can be reported. List the venue names to accept, one per line, in a file and pass it with --accepted-venues:

# accepted-venues.txt
RNA
bibsync paper.md --check-venue-names --accepted-venues accepted-venues.txt

The file only accepts names the heuristic flags: listing an abbreviation from the journal table does not stop it being reported.

For a JOSS paper's pre-commit hook, use both options together.

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: v2.0.0
      hooks:
          - id: bibsync-bin
            files: ^paper\.(md|bib)$
            pass_filenames: false
            args:
                [
                    --fix,
                    --cache,
                    --provider,
                    inspire,
                    --full-author-lists,
                    --full-journal-names,
                    --output,
                    paper.bib,
                    paper.md,
                ]

--full-author-lists and --full-journal-names make the bibliography meet JOSS's reference rules: in-text citations read "et al." rather than "& others", and journal names are written in full (see Author Lists and Journal Names). Both options need bibsync 2.0.0 or later.

Name the citing document in args and set pass_filenames: false. pre-commit passes the hook only the staged files that match. When a commit changes paper.bib but not paper.md, bibsync would receive only paper.bib; it then checks that file's own entries and never reads which keys paper.md cites, so deleting a cited entry from paper.bib would pass. With pass_filenames: false the hook always scans paper.md, and files: makes it run whenever either file changes. For a LaTeX project, list the .tex files that cite (for example main.tex) in args and match them and the .bib file in files:.

Every configuration needs both settings. The examples below use a LaTeX project whose main.tex cites into references.bib; replace those names with your own citing files and bibliography in both files: and args.

Use the pre-built binary hook for faster installs:

repos:
    - repo: https://github.com/isaac-cf-wong/bibsync
      rev: v2.0.0
      hooks:
          - id: bibsync-bin
            files: ^(main\.tex|references\.bib)$
            pass_filenames: false
            args: [--cache, --provider, inspire, --output, references.bib, main.tex]

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: v2.0.0
      hooks:
          - id: bibsync
            files: ^(main\.tex|references\.bib)$
            pass_filenames: false
            args: [--provider, inspire, --output, references.bib, main.tex]

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: v2.0.0
      hooks:
          - id: bibsync-bin
            files: ^(main\.tex|references\.bib)$
            pass_filenames: false
            args: [--fix, --cache, --provider, inspire, --output, references.bib, main.tex]

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

repos:
    - repo: https://github.com/isaac-cf-wong/bibsync
      rev: v2.0.0
      hooks:
          - id: bibsync-bin
            files: ^(main\.tex|references\.bib)$
            pass_filenames: false
            args:
                [
                    --fix,
                    --cache,
                    --provider,
                    inspire,
                    --output,
                    references.bib,
                    --ignore-file,
                    .bibsyncignore,
                    main.tex,
                ]

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 main.tex
            language: system
            files: ^(main\.tex|references\.bib)$
            pass_filenames: false

Metadata

Release files for bibsync 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bibsync 2.0.0
File Size Uploaded Provenance Actions
bibsync-2.0.0.tar.gz 100.6 kB Without provenance Details for bibsync-2.0.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for bibsync 2.0.0
File Actions
bibsync-2.0.0-cp313-abi3-win_amd64.whl CPython 3.13 abi3 Windows x86-64 Details for bibsync-2.0.0-cp313-abi3-win_amd64.whl
bibsync-2.0.0-cp313-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.13 abi3 Linux glibc 2.17+ x86-64 Details for bibsync-2.0.0-cp313-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
bibsync-2.0.0-cp313-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.13 abi3 Linux glibc 2.17+ ARM64 Details for bibsync-2.0.0-cp313-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
bibsync-2.0.0-cp313-abi3-macosx_11_0_arm64.whl CPython 3.13 abi3 macOS 11.0+ ARM64 Details for bibsync-2.0.0-cp313-abi3-macosx_11_0_arm64.whl
bibsync-2.0.0-cp313-abi3-macosx_10_12_x86_64.whl CPython 3.13 abi3 macOS 10.12+ x86-64 Details for bibsync-2.0.0-cp313-abi3-macosx_10_12_x86_64.whl

Total release size: 16.3 MB

Release files / bibsync-2.0.0.tar.gz

Download URL bibsync-2.0.0.tar.gz
Size 100.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e305956810ff1c1c06c79a3b375bca06eff0199b6118a270569e88b6c05c3f3e
BLAKE2b-256 checksum
How to use checksums
82514d4959dcbc50bb7079c44fafbbd61a338ba5ec3cf67a4d26d8b46fc134b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bibsync-2.0.0-cp313-abi3-win_amd64.whl

Download URL bibsync-2.0.0-cp313-abi3-win_amd64.whl
Size 3.1 MB
Tags CPython 3.13 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b4f68d45dc2cd5d0b8b109d841aebeb22c9dba61eb3fca2bfc61f02d8d7c34ca
BLAKE2b-256 checksum
How to use checksums
b5a69c7bb7ab672ba5f1771ac55e7ffa47b2d035b3ae84c1c8a2e013170c996f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bibsync-2.0.0-cp313-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL bibsync-2.0.0-cp313-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 3.5 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
3223b4ab729a256b93a9826b39f57a9ab4f3e12ab8ac69450d90f801298e05d1
BLAKE2b-256 checksum
How to use checksums
1ae68edc43f0feb09f8ab26626cf68b93e29c424ccc236892cbb3016d8387b86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bibsync-2.0.0-cp313-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL bibsync-2.0.0-cp313-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 3.2 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
deae514a1bcf4bf8a8d93a502605115edb5cd9ddb8e1e469bd7cdbcaff6a5d02
BLAKE2b-256 checksum
How to use checksums
14b4e81937fa923033dd2138404e431060e3e12353d504710393e3598fda164a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bibsync-2.0.0-cp313-abi3-macosx_11_0_arm64.whl

Download URL bibsync-2.0.0-cp313-abi3-macosx_11_0_arm64.whl
Size 3.1 MB
Tags CPython 3.13 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b45806cc9da969393552e4a840bcf5468274864db3de38914b0128eda46103f7
BLAKE2b-256 checksum
How to use checksums
e63ee1b6d5138ac97f4f1158ee12c15a803f844d8dcae211254addd8c36c9007
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bibsync-2.0.0-cp313-abi3-macosx_10_12_x86_64.whl

Download URL bibsync-2.0.0-cp313-abi3-macosx_10_12_x86_64.whl
Size 3.3 MB
Tags CPython 3.13 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
25c1c4bd747bd13dc9be646c20f872a917e77ae78ef76e66f55c3d3eefe5f1d8
BLAKE2b-256 checksum
How to use checksums
58ff4f33d706972b30301304633fe72e23227719a74e51896c2aa34076d6380f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for bibsync 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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