A Rust library for reading, writing, and manipulating MARC bibliographic records, with Python bindings.
Note: This project was developed using agentic coding tools (amp and Claude) and uses beads_rust for agentic issue tracking. The package has not yet had extensive practical testing by humans and should be considered experimental.
- Reads and writes ISO 2709 (MARC21) binary format
- Python bindings with pymarc-compatible API (minor differences documented)
- Multiple serialization formats: JSON, MARCXML, MARCJSON, CSV, Dublin Core, MODS, BIBFRAME
- MARC-8 and UTF-8 character encoding support
- Rust-core parsing with GIL release for multi-threaded Python workloads; early benchmarking suggested at least a 4x speedup over pymarc (these benchmarks need updating — see benchmarks)
Python (3.10+):
pip install mrrc
# or with uv:
uv add mrrcRust:
cargo add mrrcPython:
from mrrc import MARCReader
# Pass filename directly for best performance (releases GIL)
for record in MARCReader("records.mrc"):
print(record.title)File paths use pure Rust I/O, releasing Python's GIL for multi-threaded workloads. See the threading guide for details.
Rust:
use mrrc::MarcReader;
use std::fs::File;
let file = File::open("records.mrc")?;
let mut reader = MarcReader::new(file);
while let Some(record) = reader.read_record()? {
if let Some(title) = record.title() {
println!("{}", title);
}
}| Format | Read | Write |
|---|---|---|
| ISO 2709 | Yes | Yes |
| JSON | Yes | Yes |
| MARCJSON | Yes | Yes |
| MARCXML | Yes | Yes |
| CSV | - | Yes |
| Dublin Core | - | Yes |
| MODS | Yes | Yes |
| BIBFRAME | Yes | Yes |
CSV and Dublin Core are write-only: both are lossy exports of a MARC record, so mrrc emits them but does not read them back. Bring your own reader if you need to import such data into MARC.
Pre-built Python wheels are available for:
| Platform | Architectures |
|---|---|
| Linux | x86_64, aarch64, i686 |
| macOS | x86_64 (Intel), arm64 (Apple Silicon) |
| Windows | x64 |
Experimental. The Python API aims for pymarc compatibility but has some differences; see the migration guide. Rust APIs may change between minor versions.
Version 0.8.2 is suitable for testing but remains experimental. Before a 1.0 release, we plan to complete:
- Real-world data testing — Validate against large-scale MARC datasets from LOC, Internet Archive, and other sources to discover edge cases
- Code review — Thorough review of the codebase, particularly the Rust core and
PyO3bindings - Performance analysis — Profile with production workloads, optimize bottlenecks, and update benchmark documentation
MIT