Skip to main content

Module to complete bibtex files by polling online databases

Reason this release was yanked:

Doesn't work with python < 3.9

Project description

Bibtex Autocomplete

Maintenance PyPI version PyPI pyversions License PyPI status Downloads

This repository contains a python package to autocomplete bibtex bibliographies. It is inspired and expanding on the solution provided by thando in this tex stackexchange post.

It attempts to complete a bibtex file by querying the following domains:

demo.svg

Disclaimers

The searches are performed using the entries' dois if present, title or author otherwise. Titles are compared excluding punctuation and case, so make sure to include the full title to get matches.

There is no guarantee that this script will find matches for your entries, or that the websites will have any data to add to your entries.

The script will not overwrite any user given non-empty fields, unless the -f/--force-overwrite flag is given. It is designed to minimize the chance of false positive - that is adding data from another similar-ish entry to your entry. If you find any such false positive please report them using the issue tracker.

Installation

Can be installed with pip :

pip install bibtexautocomplete

You should now be able to run the script using either commands:

btac --version
python3 -m bibtexautocomplete --version

Dependencies

This package has two dependencies (automatically installed by pip) :

Usage

The command line tool can be used as follows:

btac [-flag] <input_files>

Examples :

  • btac my/db.bib : reads from ./my/db.bib, writes to ./my/db.btac.bib
  • btac -i db.bib : reads from db.bib and overwrites it (inplace flag)
  • btac db1.bib db2.bib -o out1.bib -o out2.bib reads multiple files and write their outputs to out1.bib and out2.bib respectively

Optional arguments:

  • -o --output <file>

    Write output to given file. Can be used multiple times when also giving multiple inputs. Maps inputs to outputs in order in that case If there are extra inputs, use default name (old_name.btac.bib). Ignored in inplace (-i) mode.

  • -q --only-query <site> or -Q --dont-query <site>

    Restrict which websites to query from. <site> must be one of: crossref, dblp, researchr, unpaywall. These arguments can be used multiple times, for example to only query crossref and dblp use -q crossref -q dblp or -Q researchr -Q unpaywall

  • -e --only-entry <id> or -E --exclude-entry <id>

    Restrict which entries should be autocomplete. <id> is the entry id used in your bibtex file (e.g. @inproceedings{<id> ... }). These arguments can also be used multiple times to select only/exclude multiple entries

  • -c --only-complete <field> or -C --dont-complete <field>

    Restrict which fields you wish to autocomplete. Field is a bibtex field (e.g. author, doi,...). So if you only wish to add missing doi's used -c doi.

Output formatting:

  • --fa --align-values pad fieldnames to align all values

    @article{Example,
      author = {Someone},
      doi    = {10.xxxx/yyyyy},
    }
    
  • --fc --comma-first use comma first syntax

    @article{Example
      , author = {Someone}
      , doi = {10.xxxx/yyyyy}
      ,
    }
    
  • --fl --no-trailing-comma don't add the last trailing comma

  • --fi --indent <space> space used for indentation, default is a tab

Flags:

  • -i --inplace Modify input files inplace, ignores any specified output files

  • -f --force-overwrite Overwrite already present fields. The default is to overwrite a field if it is empty or absent

  • -t --timeout <float> set timeout on request in seconds, default: 10.0 s, increase this if you are getting a lot of timeouts.

  • -v --verbose verbose mode shows more info. It details entries as they are being processed and shows a summary of new fields and their source at the end. Using it more then once prints debug info (up to three times).

  • -s --silent hide info and progressbar. Keep showing warnings and errors. Use twice to also hide warnings, thrice to also hide errors and four times to also hide critical error, effectively killing all output.

  • -n --no-color don't color use ansi codes to color and stylise output

  • --version show version number

  • -h --help show help

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

bibtexautocomplete-1.0.2.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

bibtexautocomplete-1.0.2-py3-none-any.whl (38.6 kB view details)

Uploaded Python 3

File details

Details for the file bibtexautocomplete-1.0.2.tar.gz.

File metadata

  • Download URL: bibtexautocomplete-1.0.2.tar.gz
  • Upload date:
  • Size: 31.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for bibtexautocomplete-1.0.2.tar.gz
Algorithm Hash digest
SHA256 6700f2bdf94a1353790d9073b7b91c5409e2cf438073a3564e9f95889918da0a
MD5 97084f3c3329a13b4fc901c3eb3ff08c
BLAKE2b-256 052704c62824b4da8f08bf70233efb3eaa9803f3abdce4b7454641f99c0e5aac

See more details on using hashes here.

File details

Details for the file bibtexautocomplete-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: bibtexautocomplete-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 38.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for bibtexautocomplete-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f2fa93a52c0a5e356f05103d6dd2d66e95bfe13af6ebf0a7b59ed490c80b526c
MD5 08c61b6a3a44b70ed1e912c92960afbe
BLAKE2b-256 768b6cba225e5727f40bacaca5a12f97b089bc52b877b4560cf77bf2081396cb

See more details on using hashes here.

Supported by

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