Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Easily convert MARC bibliographic records to BibTeX entries

Project description

https://img.shields.io/pypi/v/marc2bib.svg https://travis-ci.org/mstolyarchuk/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/mstolyarchuk/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 = {I. Hargittai, M. Hargittai},
 . . .
}

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
$ py.test tests

Acknowledgments

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for marc2bib, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size marc2bib-0.1.4.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page