Add to_unicode, permissive, and recovery_mode flags to MARCReader#80
Merged
Add to_unicode, permissive, and recovery_mode flags to MARCReader#80
Conversation
…oses #78) pymarc-compatible kwargs for MARCReader: - to_unicode: accepted for compat, warns if False (mrrc always converts) - permissive: yields None for bad records instead of raising (pymarc behavior) - recovery_mode: exposes mrrc's RecoveryMode for salvaging partial data Updated migration guide, reading tutorial, and quickstart with error handling documentation. Bead: bd-y331 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merging this PR will improve performance by 28.68%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | WallTime | test_process_4_files_sequential |
85.7 ms | 75.7 ms | +13.26% |
| ⚡ | WallTime | test_pipeline_parallel_2x_10k_threaded |
50.7 ms | 41.8 ms | +21.23% |
| ⚡ | WallTime | test_pipeline_parallel_4x_10k_threaded |
104.4 ms | 88.1 ms | +18.54% |
| ⚡ | WallTime | test_process_4_files_parallel_4_threads |
108.7 ms | 93.7 ms | +16% |
| ⚡ | WallTime | test_pipeline_sequential_extraction_4x_10k |
105.5 ms | 94 ms | +12.17% |
| ⚡ | WallTime | test_pipeline_sequential_4x_10k |
84.5 ms | 76.6 ms | +10.28% |
| ⚡ | WallTime | test_file_parallel_4x_10k_with_extraction |
1,096.1 ms | 851.8 ms | +28.68% |
| ⚡ | WallTime | test_pipeline_sequential_1x_10k |
20.4 ms | 18.4 ms | +11.12% |
Comparing bd-y331-marcreader-flags (9ec3c31) with main (dd4c671)
Footnotes
-
16 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
This was referenced Apr 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #78 — adds pymarc-compatible
to_unicodeandpermissivekwargs toMARCReader, and exposes mrrc's existingRecoveryModeas arecovery_modekwarg.to_unicode: accepted for pymarc compat; mrrc always converts MARC-8 → UTF-8, soFalseemits a warning but has no effectpermissive=True: yieldsNonefor records that fail to parse, matching pymarc's behavior exactlyrecovery_mode: exposes mrrc's Rust-nativeRecoveryMode("strict","lenient","permissive") for salvaging partial data from damaged recordspermissive=Truewith non-strictrecovery_moderaisesValueError(conflicting strategies)No Rust core changes —
permissiveis handled in the Python wrapper's__next__,recovery_modeis passed through PyO3 to the existingMarcReader::with_recovery_mode().Test plan
test_marcreader_flags.pycovering all kwargs, edge cases, and conflict validation.cargo/check.shpassesBead: bd-y331
🤖 Generated with Claude Code