Skip to main content

marcfinder

CLI tool for looking up MARC 21 Bibliographic and Holdings field definitions.

Installation

uv tool install marcfinder

This installs the marc command globally while keeping dependencies isolated. To update later: uv tool upgrade marcfinder.

To run from a clone instead (for development):

git clone https://github.com/mikegsaunders/marcfinder.git
cd marcfinder
uv tool install -e .

Usage

Fields and subfields:

marc 245        # Field 245 and all its subfields
marc 245a       # One subfield (245$a and "245 a" also work)
marc ldr        # Leader, with its character positions

Character positions (Leader, 006, 007, 008):

marc 008/23     # Form of item, for every material type that defines it
marc ldr/06     # Type of record, with all its codes
marc 008/07-10  # A range

Browse fields by pattern:

marc 5xx        # All 5XX note fields
marc 24x        # 240-249
marc 6          # Every field starting with 6

Keyword search (field, subfield and character-position names and codes, plus common terms like ISBN, LCCN, Dewey):

marc isbn
marc place of publication
marc braille            # finds 007/01, 008/23 etc.
marc -v accessibility   # -v also searches definitions

Holdings format:

marc -h 852             # Holdings 852 Location
marc -h 8xx
marc -h -v 863          # Indicators, subfields and examples for 863
marc 863                # Holdings-only fields (841-878) are found without -h too

Verbose mode shows the definition, indicators (with explanations), subfield descriptions, character positions, examples and a link to the LOC page:

marc -v 245
marc -v 040b

Update marcfinder:

marc --update   # or: marc -up

For a clone this runs git pull. For a PyPI install it prints the uv tool upgrade marcfinder command to run.

Help is marc --help (-h is holdings).

Colour is turned off automatically when output is piped, or when NO_COLOR is set.

Development

Data lives in marc_cli/data/bibliographic.json and marc_cli/data/holdings.json, scraped from the Library of Congress concise format documentation.

uv run --extra dev python scrape_marc.py              # both formats
uv run --extra dev python scrape_marc.py holdings     # just one
uv run --extra dev python scrape_marc.py --refresh    # ignore the page cache
uv run --extra dev pytest

Downloaded pages are cached in .cache/loc/, so re-runs take seconds. The scraper prints anything that looks incomplete (for example a field with no subfields) so it can be checked by hand.

Releasing to PyPI

  1. Bump version in pyproject.toml and commit.
  2. Tag and push: git tag v0.2.0 && git push --tags.
  3. Create a GitHub release from the tag. The publish workflow builds and uploads it.

One-time setup: on PyPI, add a "trusted publisher" for this repo (workflow publish.yml, environment pypi). No API token is needed.

License

MIT. Field definitions are from the Library of Congress MARC 21 documentation.

Metadata

Release files for marcfinder 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for marcfinder 0.2.0
File Size Uploaded Provenance Actions
marcfinder-0.2.0.tar.gz 182.3 kB Without provenance Details for marcfinder-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for marcfinder 0.2.0
File Interpreter ABI Platform Actions
marcfinder-0.2.0-py3-none-any.whl Python 3 none any Details for marcfinder-0.2.0-py3-none-any.whl

Total release size: 366.4 kB

Release files / marcfinder-0.2.0.tar.gz

Download URL marcfinder-0.2.0.tar.gz
Size 182.3 kB
Tags Source
SHA-256 checksum
How to use checksums
fa7e49d6cbebf1a80f29187c83e893682021f521dcea9f0024f5fcc869df1472
BLAKE2b-256 checksum
How to use checksums
4f1ec278a2a2076863b553f118592ebce708d6d3f8c5582fa0f0baf1d424f0fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / marcfinder-0.2.0-py3-none-any.whl

Download URL marcfinder-0.2.0-py3-none-any.whl
Size 184.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80506288f06c40a19c4ed74d3b6994a9c5273c4277299c41f7e0c902759fcba5
BLAKE2b-256 checksum
How to use checksums
11ff30a1af659fec3a8ccc15c40df3b6797e37205ebf468f801cc0d7c3d60950
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for marcfinder 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page