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.1 && 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.1

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.1
File Size Uploaded Provenance Actions
marcfinder-0.2.1.tar.gz 182.4 kB Without provenance Details for marcfinder-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 366.4 kB

Release files / marcfinder-0.2.1.tar.gz

Download URL marcfinder-0.2.1.tar.gz
Size 182.4 kB
Tags Source
SHA-256 checksum
How to use checksums
fe0c516c7a5c9ff992c68e4c051f06611e4828098a889e8f5520d9785f5446d8
BLAKE2b-256 checksum
How to use checksums
dcc7387e588b85abd8d6a76c47ee30fb06483f5a5dea31e1f79df7807f1be845
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.1-py3-none-any.whl

Download URL marcfinder-0.2.1-py3-none-any.whl
Size 184.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ba24167e1dad7275ee487cb6c5141474ffc3622a6c5209019213edc0413a56a
BLAKE2b-256 checksum
How to use checksums
87e3594875f89b4c2d3fc7f176dea0fd13a4405e3ba9c9f169383b61e1167b67
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.1

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.1 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