fetchbib
A command-line tool to resolve DOIs and free-text search queries into formatted BibTeX entries. Powered by doi.org, arXiv, and the OpenAlex API.
Features
- Resolve DOIs to formatted BibTeX (bare DOIs or full URLs)
- Search by paper title via OpenAlex API
- Native arXiv support (arXiv DOIs route to arxiv.org)
- Batch processing from file or command line
- Write output to file (overwrite or append)
- Configurable: exclude ISSN/DOI fields, protect title capitalization
Quick Start
Fetch BibTeX by DOI (bare or full URL, including arXiv):
fbib 10.1073/pnas.2322823121
fbib https://doi.org/10.1073/pnas.2322823121
fbib 10.48550/arXiv.2410.21554
@article{DeVerna_2024,
author = {DeVerna, Matthew R. and Yan, Harry Yaojun and Yang, Kai-Cheng and Menczer, Filippo},
DOI = {10.1073/pnas.2322823121},
ISSN = {1091-6490},
journal = {Proceedings of the National Academy of Sciences},
month = dec,
number = {50},
publisher = {Proceedings of the National Academy of Sciences},
title = {Fact-checking information from large language models can decrease headline discernment},
url = {http://dx.doi.org/10.1073/pnas.2322823121},
volume = {121},
year = {2024}
}
Search by free text by including text between quotes:
fbib "Fact-checking information from large language models can decrease headline discernment"
Note: OpenAlex searches titles and abstracts. Full or partial paper titles work best. Use
-nto return multiple results if needed. See Specify number of free-text matches section below.
Installation
pip
pip install fetchbib
uv
uv tool install fetchbib
Requires Python 3.9+.
Usage
fbib [-h] [-f FILE] [-o OUTPUT] [-a] [-n MAX_RESULTS]
[--config-api-key KEY] [--config-protect-titles]
[--config-exclude-issn] [--config-exclude-doi]
[--print-config] [inputs ...]
Flexible input
fbib accepts DOIs in any format — bare, full URL, or free-text search queries — and you can mix them freely.
Inputs are comma-separated, so all of the following work:
# Multiple positional arguments
fbib 10.1609/icwsm.v5i1.14126 10.1093/jcmc/zmz022
# Comma-separated string
fbib "10.1609/icwsm.v5i1.14126, 10.1093/jcmc/zmz022"
# Full DOI URLs
fbib "https://doi.org/10.1609/icwsm.v5i1.14126, https://doi.org/10.1093/jcmc/zmz022"
# Mix DOIs, URLs, and search queries
fbib 10.1609/icwsm.v5i1.14126 "Fact-checking information from large language models"
From a file (--file), each line is treated the same way — one entry per line, or comma-separated on a single line:
fbib --file dois.txt
Duplicate inputs are automatically removed.
Write to a file
Overwrite (default):
fbib --output refs.bib 10.1609/icwsm.v5i1.14126
Append to an existing .bib file:
fbib --append --output refs.bib 10.1093/jcmc/zmz022
Specify number of free-text matches
Free-text searches return 1 result by default. Use -n to control the limit (1-100):
# Get 3 results (see the correct result in position #2)
fbib -n 3 "Fact-checking information from large language models can decrease"
Configuration
Settings are stored in ~/.config/fetchbib/config.json and persist across sessions.
OpenAlex API Key
OpenAlex allows unauthenticated requests but with limited daily credits. For higher limits, get a free API key at openalex.org:
fbib --config-api-key YOUR_API_KEY
You can also use the OPENALEX_API_KEY environment variable, which takes precedence over the config file:
OPENALEX_API_KEY=your_key fbib "search query"
Protect titles
BibTeX processors may change title capitalization. Enable title protection to wrap titles in double braces, preserving the original case:
fbib --config-protect-titles
This transforms the below:
title = {A {GPU} Study}becomestitle = {{A GPU Study}}andtitle = {An Important Study}becomestitle = {{An Important Study}}.
Run again to toggle off.
Exclude ISSN
Remove the ISSN field from returned BibTeX entries:
fbib --config-exclude-issn
Run again to toggle off.
Exclude DOI
Remove the DOI field from returned BibTeX entries (the DOI is typically already included in the URL field):
fbib --config-exclude-doi
Run again to toggle off.
View current settings
Print the current state of all configurable settings (and whether an OpenAlex API key is set) to stdout:
fbib --print-config
Clone the repo and sync dependencies with uv:
git clone https://github.com/mr-devs/fetchbib.git
cd fetchbib
uv tool install -e . # OR pip install -e .
The
-eflag (uv tool install -e .), it performs an editable installation. This means any changes you make to the local source code are immediately reflected when you run the command, without needing to reinstall.
Run unit tests:
uv run pytest
Run integration tests (hits live APIs):
uv run pytest -m integration
Metadata
Release files for fetchbib 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fetchbib-0.7.0.tar.gz | 23.5 kB | Without provenance | Details for fetchbib-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fetchbib-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for fetchbib-0.7.0-py3-none-any.whl |
Total release size: 37.3 kB
Release files / fetchbib-0.7.0.tar.gz
| Download URL | fetchbib-0.7.0.tar.gz |
|---|---|
| Size | 23.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6b886ba872f821cbf0515132e3e9f3c87dcb3127f5ec9ea63c1099e3fd5f738b
|
|
BLAKE2b-256 checksum How to use checksums |
34edc9b281eabb4fe8b577ffb4e729390160a4d9caa24a934614f944c1684921
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / fetchbib-0.7.0-py3-none-any.whl
| Download URL | fetchbib-0.7.0-py3-none-any.whl |
|---|---|
| Size | 13.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
419bf33e2b2a2072f5a70b5f86000b0c649a173ad12f3c784a857dfcc8ae899f
|
|
BLAKE2b-256 checksum How to use checksums |
c9cdd227d8de5b724105436970c117a12a9630d10bb73327db5b194a6a68b269
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for fetchbib 0.7.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.