Rust in PyMARC experiment

26 views
Skip to first unread message

William Blackerby

unread,
Dec 10, 2024, 2:33:26 PM12/10/24
to pymarc Discussion
Greetings pymarc-ers!

As a project to learn more about MARC, Python, and Rust, I spent far too much of my free time this week implementing the MARC8 to Unicode transformation logic in marc8.py and marc8_mapping.py in Rust.

If you'd like to kick the tires on this experiment, you need to:
2. Follow the steps in the Developing section of the README, but with this important change: run `git clone -b marc8-rs https://gitlab.com/blackerby/pymarc.git` instead of the git clone command listed in the README.

Three items of note: 
1. When running `uv sync`, the step for installing the `marc8` module may take 45 seconds or more to complete because the module has to be compiled.
2. For the sake of simplicity, the current Rust implementation of marc8_to_unicode() will only accept a bytes-like object, not a string, so I made a small change to get the test suite to pass.
3. The marc8 module used in this experimental fork lives in a separate project. The repository is here: https://github.com/blackerby/marc8-rs.

I am far from an expert on any of MARC, Python, or Rust, and I can't claim that the Rust I've written is the best/most efficient/most idiomatic, but this has been a ton of fun and I plan to keep working on it. If this kind of thing matches your idea of fun, I invite you to join me in hacking on the Rust code!

William
Reply all
Reply to author
Forward
0 new messages