pybibparse is a python-based parser for bibtex files. It allows reading *.bib into list of dictionaries, modify entries and save resulting file. It is created for work with bibliographies, produced in JabRef, but currently not supports all JabRef features.

Licensed under GNU Lesser General Public License v3.0.

Comments and wishes send to [encode_email email=”” display=””], please (Oleksandr V. Pylypovskyi).

 Downloading and installation

Actual version: 0.11 (download link). Improved work with list of entries, now it is possible via index index.

Previous versions:

For installation you need «re» python module. After downloading:

cd pybibparse-0.1
sudo python install


Loading bibliography:

import pybibparse
data = pybibparse.pybibparse('articles.bib')

Get list with all entries:

 artlist = data.getAllEntries()

Get entry with specified field:

data.getEntry(['bibtexkey'], ['Waeyenberge06'])

Here first argument must be a list with keys and second argument is a list values, which are compared first with first, second with second etc. The third optional argument takes values True or False (by default). If it is True, than matching of all given fields is needed. Such code returns dictionary

[{'author': 'Van Waeyenberge, B. and Puzic, A. and Stoll, H. and Chou, K. W. and\n\tTyliszczak, T. and Hertel, R. and F\\"ahnle, M. and Bruckl, H. and\n\tRott, K. and Reiss, G. and Neudecker, I. and Weiss, D. and Back,\n\tC. H. and Sch\\"utz, G.',
  'bibtexkey': 'Waeyenberge06',
  'comment': '10.1038/nature05240',
  'file': 'Waeyenberge.Nature.06.pdf:Waeyenberge.Nature.06.pdf:PDF',
  'issn': '0028-0836',
  'journal': 'Nature',
  'month': 'nov',
  'number': '7118',
  'order': '00185',
  'pages': '461--464',
  'pyentrytype': 'article',
  'title': 'Magnetic vortex core reversal by excitation with short bursts of\n\tan alternating field',
  'url': '',
  'volume': '444',
  'year': '2006'}]

Adding new entry:

entry = {'bibtexkey': 'newEntry01', 'author': 'Me', 'title': New article', : 'journal': 'My J.'}
data.getEntry(['bibtexkey'], ['newEntry01'])
# return:
[{'author': 'Me',
  'bibtexkey': 'newEntry01',
  'journal': 'My J.',
  'title': 'New article'}]

Save modified bibliography:'modified_articles.bib')

For other information see in-line help.

Comments are closed.