skillfed

pymarc

Read, write and modify MARC bibliographic data

pymarc v5.4.0 93.8K downloads/30d#13,362 on PyPI
License unclear Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above… (full text in the JSON record) Active released

What it is and what it does

pymarc is a Python library for working with MARC21 records—the standard bibliographic data format used by libraries worldwide. It provides an API to read MARC binary files, extract fields and subfields, create new records, and serialize to JSON or XML formats. The library was originally designed as an escape route for extracting data out of MARC into more modern representations, but has evolved to support full record creation and modification as MARC remains in widespread use despite decades of calls for its replacement.

The package exposes MARC records as Python objects with both convenience properties (like `title`, `author`, `isbn`) and direct field access via numeric tags and subfield codes. It handles the complexity of MARC's hierarchical structure—fields contain indicators and subfields—and supports batch processing through iterators. As of version 5.0.0, subfields are represented as named tuples rather than flat string lists, with a conversion utility for legacy code.

Use it for:

  • Extract titles, authors, and ISBNs from a batch of MARC records for import into a database or search index.
  • Convert MARC binary files to JSON or XML for distribution to systems that cannot parse MARC natively.
  • Migrate bibliographic data out of legacy library systems by reading MARC dumps and transforming them into modern formats.
  • Create or update MARC records programmatically when integrating with library management systems.
  • Process subject headings and other repeating fields from MARC records for analysis or enrichment.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

pymarc reads, writes, and modifies MARC21 bibliographic records, the standard format used by libraries to encode catalog metadata.

Yes. pymarc is actively maintained, has no dependencies, installs easily, and is the standard tool for MARC processing in Python. Install it if you work with library data, need to migrate MARC records, or integrate with library systems. The license is permissive. No known security vulnerabilities.

Install

pymarc on PyPI

pip

pip install pymarc

uv

uv add pymarc

poetry

poetry add pymarc

Installing pymarc

Before you install

Low install friction with no runtime dependencies. Actively maintained as of 43 days ago with support for current Python versions (requires Python 3.10+).

License in practice

License text indicates a BSD-style permissive license (unclear SPDX classification in metadata), allowing use in most projects with attribution and liability disclaimer.

Quickstart

from pymarc import MARCReader
with open('records.dat', 'rb') as fh:
    reader = MARCReader(fh)
    for record in reader:
        print(record.title)

Requires Python 3.10 or later. MARC data must be in binary MARC21 format (typically .dat or .mrc files).

Verify before relying

  • Whether the package is suitable for production use in large-scale library systems or primarily for data migration tasks.
  • Performance characteristics when processing very large MARC record batches.

Package facts

License Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above… (full text in the JSON record) (unclear)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 43 days since the last release
First released
Downloads 93,784/month — #13,362 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pymarc-5.4.0-py3-none-any.whl

Tags

MARC record processingbibliographic data libraryMARC21 parserlibrary catalog dataMARC reader writerbibliographic metadataMARC field extraction
library-databibliographic-metadata

More Text Processing packages