Skip to content

v0.7.2

Choose a tag to compare

@github-actions github-actions released this 12 Feb 04:58
· 522 commits to main since this release

Added

  • MODS XML read support: mods_to_record(xml_str) and mods_collection_to_records(xml_str) parse MODS XML (single record or <modsCollection>) into MARC Record objects. Covers titleInfo, name, subject, originInfo, physicalDescription, abstract, note, genre, classification, location, relatedItem, recordInfo, identifier, accessCondition, tableOfContents, targetAudience, and language elements with conformance tests using LOC-derived fixtures.
  • Cross-compiled Linux wheels (mrrc-experiments#16): Release workflow now builds aarch64 and i686 Linux wheels via maturin-action Docker cross-compilation, increasing wheel count from 15 to 25 per release.
  • Field constructor subfields= and indicators= kwargs (mrrc-experiments#15): Field now accepts subfields= (list of Subfield) and indicators= (list/tuple of two strings) as keyword arguments, enabling inline construction matching pymarc style: Field('245', indicators=['0', '1'], subfields=[Subfield('a', 'Title')]). The Rust binding already supported this signature; the Python wrapper now passes through both kwargs.
  • Record constructor fields= kwarg (mrrc-experiments#15): Record now accepts an optional fields= keyword argument (list of Field), enabling inline record construction: Record(fields=[Field(...), ...]). This goes beyond pymarc parity (pymarc's Record.__init__ does not accept fields=) as a UX improvement. Record() with no arguments also now works, defaulting to Leader().
  • Constructor kwargs tests: 8 new tests in TestConstructorKwargs covering indicators=, subfields=, fields=, combined usage, full inline construction, and backward compatibility.
  • PEP 561 py.typed marker: Added to root mrrc/ package so type checkers recognize shipped type stubs.
  • Project layout documentation: New docs/contributing/project-layout.md describes the three-layer architecture (core Rust → PyO3 bindings → Python package), how maturin and the Cargo workspace connect them, directory structure, build commands, and common development workflows.
  • Pre-push git hook: .githooks/pre-push runs .cargo/check.sh before every push, preventing code from reaching CI that would fail local checks. Opt-in via git config core.hooksPath .githooks.
  • check.sh --quick flag: Skips docs, audit, and maturin build for faster inner-loop iteration (keeps fmt, clippy, tests, ruff).

Changed

  • GitHub releases now include changelog notes: python-release.yml auto-extracts the relevant CHANGELOG.md section and includes it in the GitHub Release body. Backfilled v0.7.1 release notes.
  • Pymarc compatibility tests fully enabled: Removed 10 pytest.skip guards from test_pymarc_compatibility.py — all features (to_json, to_xml, to_marcjson, to_dublin_core, to_marc21, writer, roundtrip, test data) were already implemented. 88/88 tests now pass with 0 skipped.
  • Documentation updated for inline construction: Quickstart, API reference, migration guide, writing tutorial, and examples now show Field(subfields=..., indicators=...) and Record(fields=...) as the primary construction pattern, with add_subfield()/add_field() as the incremental alternative. Migration guide updated to reflect Record() no longer requires an explicit Leader argument and field creation is now closer to pymarc.
  • Type stubs updated: Field.__new__ and Record.__new__ in .pyi now include the new keyword-only parameters.
  • Type stubs enriched: Merged rich docstrings into mrrc/_mrrc.pyi from the old src-python stubs — Leader properties with MARC position descriptions, MARCReader GIL/concurrency/thread-safety docs, MARCWriter context manager protocol, BibframeConfig setter methods and property getters, RdfGraph parse()/triples()/__len__(). Added mods_to_record and mods_collection_to_records stubs.
  • Removed stale src-python/python/ directory: Deleted redundant Python package directory (1,235 lines) left over from the Phase 5 layout migration. Root mrrc/ is now the sole Python package location.
  • Test suite audit: Deleted 5 redundant/inert files from src-python/tests/, migrated 4 test files to tests/python/ (backend parity, type detection, rayon parser pool, record boundary scanner), extracted 1 pipeline regression test. Deleted src-python/tests/ entirely. Python test count: 364 → 433.
  • Ruff lint compliance: Fixed 76 ruff errors across mrrc/ and tests/python/ (bare except, unused imports/variables, walrus operator patterns, f-string placeholders, true/false comparisons). Added ruff check step to check.sh.
  • Rust integration tests in check.sh: Changed cargo test --lib to cargo test --lib --tests, adding 17 integration test files (bibframe, mods, field query, concurrent GIL, etc.) to the local CI script.
  • CI workflow alignment with check.sh: Closed gaps where CI was missing checks that check.sh runs locally. Added clippy on mrrc-python to lint.yml (was only linting mrrc core). Added ruff Python lint job to lint.yml (via uvx). Fixed rustdoc scope from --package mrrc to --all to include PyO3 bindings. Changed test.yml from --lib --bins to --lib --tests --package mrrc, adding 15+ integration test files that were skipped in CI. Removed unused mypy/pyright install from python-build.yml test-wheels job. Upgraded actions/cache from v3 to v4 across all workflows.
  • CI efficiency improvements: Switched all pip install calls to uv pip install --system across python-build.yml, benchmark-python.yml, and python-release.yml for faster dependency resolution. Consolidated three separate cargo cache actions (registry, index, build) into single multi-path caches across five workflows. Switched cargo-audit and cargo-tarpaulin from cargo install (compiles from source) to pre-built binaries via taiki-e/install-action. Combined two tarpaulin runs into one (--out Xml Html). Upgraded codecov/codecov-action from v3 to v4, actions/setup-python from v4 to v5. Removed redundant pip install maturin and single-element Rust version matrix from build.yml.

Fixed

  • Rust formatting: Applied cargo fmt to src/mods.rs and src-python/src/formats.rs (pre-existing match arm brace style).
  • Clippy doc lint: Escaped OCoLC in tests/mods_conformance_tests.rs doc comment to satisfy clippy::doc_markdown.
  • Flaky CI benchmark: test_bytesio_vs_file_isolation switched from mean to median for I/O overhead measurement, preventing single-iteration CI runner spikes from failing the test. Removed hard assertion (test value is diagnostic, not a correctness gate).