biblib package API

In the namespace biblib you have access to the core classes (Entry, Database and StorageDB) and the helper functions. I you like to extend or modify a storage class, you need to extend the lib by importing biblib.storage. You can extend the lib by using the classes and functions exposed in namespace biblib.dev, which are decribed here.

Helper Functions

entry_from_doi Creates an entry object by DOI.
entry_from_isbn Creates an entry object by ISBN.
db_from_string Function parsing a BibTeX bibStr containing one or more entries and returns a BibTeX database object.
db_from_file Function parsing a BibTeX file containing one or more entries and returns a BibTeX database object.
db_from_doiList Function to retrieve BibTeX citation entries by their DOI and returns a BibTeX database object.
db_from_isbnList Function to retrieve BibTeX citation entries by their ISBN and returns a BibTeX database object.
entry_to_string Returns the BibTeX code of an Entry objects as a string.
db_to_string Returns the BibTeX code of a database objects as a string.
db_to_file Writes a database objects to a BibTeX file.

This package contains object classes and functions to manage BibTeX entries and databases within Python.

Terms are used here according to http://www.bibtex.org.

biblib.entry_from_doi(doi)[source]

Creates an entry object by DOI.

Parameters:doi (str) – DOI ss string
Returns:BibTeX entry object
Return type:Article | Book | ...
biblib.entry_from_isbn(isbn)[source]

Creates an entry object by ISBN.

Parameters:isbn (str) – ISBN ss string
Returns:BibTeX entry object
Return type:Book
biblib.db_from_string(bibStr, method=None)[source]

Function parsing a BibTeX bibStr containing one or more entries and returns a BibTeX database object.

Parameters:
  • bibStr (unicode) – input BibTeX string
  • method (str) – keyword for merging method (see BibDB.add_entry())
Returns:

BibTeX database object

Return type:

BibDB

biblib.db_from_file(filename, method=None)[source]

Function parsing a BibTeX file containing one or more entries and returns a BibTeX database object.

Parameters:
Returns:

BibTeX database object

Return type:

BibDB

biblib.db_from_doiList(doiList, method=None)[source]

Function to retrieve BibTeX citation entries by their DOI and returns a BibTeX database object.

Parameters:
  • doiList (list) – list of DOIs as strings
  • method (str) – keyword for merging method (see BibDB.add_entry())
Returns:

BibTeX database object

Return type:

BibDB

biblib.db_from_isbnList(isbnList, method=None)[source]

Function to retrieve BibTeX citation entries by their ISBN and returns a BibTeX database object.

Parameters:
  • isbnList (list) – list of ISBN numbers as strings
  • method (str) – keyword for merging method (see BibDB.add_entry())
Returns:

BibTeX database object

Return type:

BibDB

biblib.db_to_string(db, encoding='ascii')[source]

Returns the BibTeX code of a database objects as a string.

Parameters:
  • db (BibDB) – BibTeX database
  • encoding (str) – string encoding
Returns:

BibTeX code

Return type:

str

Raises TypeError:
 

if db is not a valid database object

biblib.db_to_file(db, filename, encoding='ascii')[source]

Writes a database objects to a BibTeX file.

Parameters:
  • db (BibDB) – BibTeX database
  • filename (str) – output file name
  • encoding (str) – string encoding
Raises TypeError:
 

if db is not a valid database object

biblib.entry_to_string(entry, ckey=None, encoding='ascii')[source]

Returns the BibTeX code of an Entry objects as a string. If ckey is not defined, the object attribute Entry.ckey will be used.

Parameters:
  • entryObj (Article | Book | ...) – BibTeX Entry
  • ckey (str) – citation-key
  • encoding (str) – string encoding
Returns:

BibTeX code

Return type:

str

Raises TypeError:
 

if entryObj is not a valid Entry object