Python package containing utilities to manuipulate BibTex .bib files.
- Clone the repository
- Make sure you have
pipv10 or greater, either as your systempipor in the virtual environment you will install to (lower versions may work but will give error messages about being unable to build wheels) - In the package directory (the one with
setup.py) runpip install --user .. If installing to a virtual environment, omit the--userflag. - The programs
bb-build,bb-web, andbb-mergewill be placed in the standard binary (bin) directory for how you ranpip. - Add the installation directory to your
PATHenvironmental variable, or link thebb-programs to a directory that is on yourPATH.
This has been tested with Python 3.5.
The bb-build program is designed to walk a directory containing PDFs of journal articles, extract their DOIs, and retrieve a
BibTex entry for each paper, assembling them into a new .bib file. It is also designed to update a .bib file, meaning:
- It has the option to skip papers in the folder if an entry with the same DOI already exists
- It can store the options used in the .bib file, so that the next update uses the same options
The bb-web program is designed to create an HTML file from a .bib file for use on a website. The assumption is that you
would have a .bib file containing all publications and/or presentations that you want to include on a website.
It has options to:
- Bold one or more authors
- Put papers with a bolder author as first author near the top of each year
- Extract only entries of specific types in the .bib file
The bb-merge program is designed to combine two or more .bib files. It will avoid duplicating identical entries, and by
default will ask what to do if it finds two entries that share a key. It also has the option to exclude entries that are identified
by a key that exists in one or more "exclude" .bib files - this way you can ensure that the merged .bib file will be compatible
as an additional bib resource alongside one or more other .bib files.
In addition to the command line programs, the bib_utils module in this package has several Python objects that can help
if you need to write your own Python program to work with .bib files. Some highlights are:
BetterBibDatabaseextends theBibDatabaseclass from thebibtexparserpackage that adds convenience functionality (e.g. built-in methods to load from and save to a file, add or remove an entry, etc.) and has a more internally-consistent treatment of entries (currently, all entries are stored in theentrieslist attribute and theentries_dictattribute is generate from that list on demand, so the two are always linked - theentries_dictcannot be modified directly).init_bib_databaseis a function that creates an instance ofBetterBibDatabaseand can automatically back up the .bib file.pdf2bibis a function that encapsulates reading a PDF file, searching for a DOI and retrieving the BibTex entry. Fair warning: I'm an atmospheric chemist, so I've only tested it on atmospherically relevant journals.