A sweetened pymarc.Record
module tailored for data extraction from local Sierra's MARC dumps.
Install via pip:
python -m pip install git+https://github.com/BookOps-CAT/bookops-marc
from bookops_marc import SierraBibReader
with open('marc.mrc', "rb") as marcfile:
reader = SierraBibReader(marcfile)
for bib in reader:
print(bib.sierra_bib_id_normalized())
print(bib.sierra_bib_format())
print(bib.branch_call_no())
print(bib.orders())
print(bib.main_entry())
print(bib.form_of_item())
print(bib.dewey())
print(bib.dewey_shortened())
In certain scenarios it may be convinient to instate Bib
directly from an instance of pymarc.Record
. This can be accomplished using pymarc_record_to_local_bib()
:
from pymarc import Record
from bookops_marc.bib import pymarc_record_to_local_bib
# pymarc Record instance
record = Record()
bib = pymarc_record_to_local_bib(record, "bpl")
bib.remove_unsupported_subjects()
Python 3.8 and up.
0.10.0
0.10.0 - 2024-03-16
- method to retrieve all OCLC numbers present in a bib (001, 035, 991):
bib.oclc_nos()
- methods to normalize OCLC number in the 001 control field in
bib.Bib
class:bib.normalize_oclc_control_number
- new module
local_values
with the followoing methods:_add_oclc_prefix
_delete_oclc_prefix
has_oclc_prefix
,is_oclc_number
,oclcNo_with_prefix
,oclcNo_without_prefix
- dropped Python 3.7 support
- update dev dependencies:
- black (24.3.0)
- mypy (1.9)
- pytest (8.1.1)
- pytest-cov (4.1.0)
- changed
pyproject.toml
settings for black, mypy, & coverage - deleted
requirements.txt
and transition topyproject.toml
for dependencies
0.9.0 - 2024-01-05
- updated to pymarc 5.0
- updated dev dependencies:
- black (22.12.0)
- pytest (7.4.4)
- github actions upgrade to v4
- tests for Python 3.11 & 3.12
0.8.1 - 2022-08-16
- version bump propagated to all places
0.8.0 - 2022-08-15
bib.pymarc_record_to_local_bib()
method to instageBib
instance frompymarc.Record
instancesierra_bib_format()
method inBib
class that returns 998$d of Sierra record
- added basic normalization to
library
parameter passed toBib
class stub_marc
test fixture renamed tostub_bib
0.7.0 - 2022-04-16
- remove_unsupported_subjects() that deletes subject tags (6xx) which are not supported by BookOps (NYPL & BPL CAT)
- dev dependency mypy 0.942
- basic type checking
- pytest bumped to 7.1.1
- pytest-cov bumped to 3.0.0
0.6.1 - 2022-04-13
- parsing of NYPL bib created date Sierra field (907$c)
- bumps pymarc to v4.2.0
0.6.0 - 2022-02-06
- CI moved from Travis to Github-Actions
- added Python 3.10 tests
0.5.0 - 2021-11-15
bib.suppressed()
method toBib
which determines if bib is suppressed from the public display
0.4.0 - 2021-09-23
bib.control_number()
method toBib
(retrieves data from the tag 001)
0.3.0 - 2021-09-23
bib.lccn()
(retrieves LCCN from bib),bib.overdrive_number()
(retrieves Overdrive Reserve ID),bib.upc_number()
(retrieves UPC from bib)
0.2.0 - [2021-08-30]
- a method for retrieving branch call number as
pymarc.Field