Skip to main content

Better bibliography data

Project description

betterbib

PyPi Version PyPI pyversions GitHub stars

Discord

[!NOTE] See here for licensing information.

Bibliography files are notoriously hard to work with. Betterbib contains a number of easy-to-use command-line tools to help.

Installation

Install betterbib from PyPI with

pip install betterbib

Convert

Sync

Simply run

betterbib sync in.bib

to sync your bibliography file with online sources. For example, the input

@article{wiles,
title={Fermat Last Theorem},
doi={10.2307/2118559},
}

is converted to

@article{wiles,
  number = {3},
  doi = {10.2307/2118559},
  pages = {443},
  source = {Crossref},
  volume = {141},
  author = {Wiles, Andrew},
  year = {1995},
  month = may,
  url = {https://doi.org/10.2307/2118559},
  issn = {0003-486X},
  journal = {The Annals of Mathematics},
  publisher = {JSTOR},
  title = {Modular Elliptic Curves and Fermat's Last Theorem},
}

See -h/--help for all options.

betterbib sync -h
Usage: betterbib sync [-h] [-i] [-c N] [-s SRC] [-m MINIMUM_SCORE] [-q] [--debug]
                      [--output-format {bibtex,biblatex,csl-json,ris}]
                      infiles [infiles ...]

Positional Arguments:
  infiles               input bibliography files

Options:
  -h, --help            show this help message and exit
  -i, --in-place        modify infile in place
  -c, --num-concurrent-requests N
                        number of concurrent HTTPS requests (default: 1)
  -s, --sources SRC     sources to try (comma-separated, with order; default:
                        crossref,dblp,pubmed)
  -m, --minimum-score MINIMUM_SCORE
                        minimum score to count as a match (default: 0.0)
  -q, --quiet           don't show progress info (default: show)
  --debug               some debug output (default: false)
  --output-format {bibtex,biblatex,csl-json,ris}
                        force output format (default: same as input)

Format

After that, you can for example run

betterbib format in.bib --sort-fields --align-values --journal-names short --abbrev-first-names

to get

@article{wiles,
  author    = {Wiles, A.},
  doi       = {10.2307/2118559},
  issn      = {0003-486X},
  journal   = {Ann. Math.},
  month     = may,
  number    = {3},
  pages     = {443},
  publisher = {JSTOR},
  source    = {Crossref},
  title     = {Modular Elliptic Curves and Fermat's Last Theorem},
  url       = {https://doi.org/10.2307/2118559},
  volume    = {141},
  year      = {1995},
}
betterbib format -h
Usage: betterbib format [-h] [-i] [--drop DROP] [--journal-names {long,short,unchanged}] [--abbrev-first-names]
                        [--sort-entries] [--sort-fields] [--doi-url-type {unchanged,old,new,short}]
                        [--page-range-separator PAGE_RANGE_SEPARATOR] [--protect-title-capitalization]
                        [--indent [INDENT]] [--align-values]
                        infiles [infiles ...]

Positional Arguments:
  infiles               input BibTeX files

Options:
  -h, --help            show this help message and exit
  -i, --in-place        modify infile in place
  --drop DROP           drop fields from entries (can be passed multiple times)
  --journal-names {long,short,unchanged}
                        force full or abbreviated journal names (default: unchanged)
  --abbrev-first-names  abbreviate first names in author lists etc. (default: false)
  --sort-entries        sort entries alphabetically by BibTeX key (default: false)
  --sort-fields         sort fields alphabetically (default: false)
  --doi-url-type {unchanged,old,new,short}
                        DOI URL (new: https://doi.org/<DOI>, short: https://doi.org/abcde) (default: new)
  --page-range-separator PAGE_RANGE_SEPARATOR
                        page range separator (int or string, default: unchanged)
  --protect-title-capitalization
                        brace-protect names in titles (e.g., {Newton}; default: false)
  --indent [INDENT]     indentation (int or string; default: 1)
  --align-values        align field values (default: false)

Dereference DOIs

Given a DOI or a DOI URL, it's often useful to generate a bibliography entry for it. betterbib doi-to does just that.

betterbib doi-to ris 10.1002/andp.19053221004
TY  - JOUR
IS  - 10
DO  - 10.1002/andp.19053221004
SP  - 891
EP  - 921
DS  - Crossref
VL  - 322
AU  - Einstein, A.
DA  - 1905/01
UR  - https://doi.org/10.1002/andp.19053221004
SN  - 0003-3804
SN  - 1521-3889
JF  - Annalen der Physik
JO  - Ann. Phys.
PB  - Wiley
TI  - Zur Elektrodynamik bewegter Körper
ER  -

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

betterbib-7.5.25-cp313-none-any.whl (3.1 MB view details)

Uploaded CPython 3.13

betterbib-7.5.25-cp312-none-any.whl (3.1 MB view details)

Uploaded CPython 3.12

betterbib-7.5.25-cp311-none-any.whl (3.1 MB view details)

Uploaded CPython 3.11

betterbib-7.5.25-cp310-none-any.whl (3.0 MB view details)

Uploaded CPython 3.10

File details

Details for the file betterbib-7.5.25-cp313-none-any.whl.

File metadata

  • Download URL: betterbib-7.5.25-cp313-none-any.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.13
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for betterbib-7.5.25-cp313-none-any.whl
Algorithm Hash digest
SHA256 02ad4166d20b6b2b1d3ca3c904033fe3522aeb2b8150a6c56e5cb7fb4e66312e
MD5 06448b74aabd658eeca7a05c2d678e42
BLAKE2b-256 cdc53aded2927f77cc2a39612b04b83f030a5645e43b8b7b1505935ebc145f8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for betterbib-7.5.25-cp313-none-any.whl:

Publisher: release.yml on texworld/betterbib-dev

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

File details

Details for the file betterbib-7.5.25-cp312-none-any.whl.

File metadata

  • Download URL: betterbib-7.5.25-cp312-none-any.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.12
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for betterbib-7.5.25-cp312-none-any.whl
Algorithm Hash digest
SHA256 977be7f38e542c09b7497e1224a4ae6a3221f3f1a8b824be8053221c0b82ec76
MD5 af152e499205816c50155ccbd0818d9b
BLAKE2b-256 9de2d07a7829ecaf7735b652075d6fdb00ddc4e5c741441e3f04d19e578b0ea9

See more details on using hashes here.

Provenance

The following attestation bundles were made for betterbib-7.5.25-cp312-none-any.whl:

Publisher: release.yml on texworld/betterbib-dev

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

File details

Details for the file betterbib-7.5.25-cp311-none-any.whl.

File metadata

  • Download URL: betterbib-7.5.25-cp311-none-any.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.11
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for betterbib-7.5.25-cp311-none-any.whl
Algorithm Hash digest
SHA256 e05a75c27633fa6f4190f1b1afa17008e7c1e81ac68310e1048d928045f006f4
MD5 8b77e4a29fc7c4fba0ea647a98b02856
BLAKE2b-256 d9b034861e79281c3a3f98adca787671a2700fbb0c6bd430460d88964749fd59

See more details on using hashes here.

Provenance

The following attestation bundles were made for betterbib-7.5.25-cp311-none-any.whl:

Publisher: release.yml on texworld/betterbib-dev

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

File details

Details for the file betterbib-7.5.25-cp310-none-any.whl.

File metadata

  • Download URL: betterbib-7.5.25-cp310-none-any.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.10
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for betterbib-7.5.25-cp310-none-any.whl
Algorithm Hash digest
SHA256 a623e58ac3751412f8c86e982c86726d3d8aff4e389fc0df6a9ddf35d590a8b4
MD5 128aa1764e3ac2e802a9d3ea67f936f8
BLAKE2b-256 3b8e8664e082a6be30f0be8e0cd242e799d7b4f60ca8c53f8373da0216d96928

See more details on using hashes here.

Provenance

The following attestation bundles were made for betterbib-7.5.25-cp310-none-any.whl:

Publisher: release.yml on texworld/betterbib-dev

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 Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page