Library for dealing with METS files.


Keywords
archivematica, preservation, mets, premis
License
Other
Install
pip install metsrw==0.5.1

Documentation

METS Reader & Writer

By Artefactual

PyPI version GitHub CI codecov

METSRW is a library to help with parsing and creating METS files. It provides an API, and abstracts away the actual creation of the XML. METSRW was initially created for use in Archivematica and is managed as part of that project.

You are free to copy, modify, and distribute metsrw with attribution under the terms of the AGPL license. See the LICENSE file for details.

Installation & Dependencies

METSRW can be installed with pip.

pip install metsrw

METSRW has been tested with:

  • Python 3.6
  • Python 3.7
  • Python 3.8
  • Python 3.9

Basic Usage

Read a METS file

mets = metsrw.METSDocument.fromfile('path/to/file')  # Reads a file
mets = metsrw.METSDocument.fromstring('<mets document>')  # Parses a string
mets = metsrw.METSDocument.fromtree(lxml.ElementTree)  # Parses an lxml.Element or lxml.ElementTree

Create a new METS file

mets = metsrw.METSDocument()

Contributing

METSRW is in early development and welcomes feedback on the API and overall design! Design goals, use cases, and a proposed API are in the Github wiki