Skip to content

WIP Converts MARC data to BibTeX

Notifications You must be signed in to change notification settings

Hubhubhurra/marc2bib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

marc2bib 📖

https://travis-ci.org/xymaxim/marc2bib.svg?branch=master

marc2bib is a Python package that allows to convert bibliographic records from MARC format to BibTeX entries. Requires Python 3.

It uses pymarc to read MARC data files.

Installation

As always, use pip to install the latest release from PyPI:

$ pip install marc2bib

Or for development:

$ git clone https://github.com/Hubhubhurra/marc2bib
$ pip install -e marc2bib

Quickstart

If you have not used pymarc before, nothing to worry about.

Now we are going to read some data from a MARC file and easily convert it to a BibTeX entry:

>>> from pymarc import MARCReader
>>> from marc2bib import convert

# Open a MARC file as you usually do this with pymarc.
>>> with open('file.mrc', 'rb') as f:
...     reader = MARCReader(f)
...     record = next(reader)  # Read the first record
...     print(convert(record)) # and, ta-da, convert it to a BibTeX entry.
...
@book{Hargittai2009,
 author = {Hargittai, István},
 . . .
}

And that is it!

Contributing

This project is hosted on GitHub. There you can create a new issue or submit pull requests for review.

Running the tests

For testing our package we use pytest. In order to run all tests, execute the following commands (you probably want to set up a virtualenv first):

$ pip install pytest
$ pytest tests

Acknowledgments

Thanks go to all the authors and contributors of the pymarc package. This project would not have been possible without their work.

About

WIP Converts MARC data to BibTeX

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 71.3%
  • mIRC Script 28.7%