Skip to main content

This module can be used to validate BagitProfiles.

Project description

Build Status

Description

A simple Python module for validating BagIt profiles. See the BagIt Profiles Specification for more information.

This module is intended for use with bagit but does not extend it.

Installation

bagit_profile.py is a single-file python module that you can drop into your project as needed or you can install globally with:

  1. git clone https://github.com/ruebot/bagit-profiles-validator.git

  2. cd bagit-profiles/python

  3. sudo python setup.py install

or:

pip install bagit_profile

Usage

import bagit
import bagit_profile

Instantiate an existing Bag using bagit. python bag = bagit.Bag('mydir')

Instantiate a profile, supplying its URI. python my_profile = bagit_profile.Profile('http://example.com/bagitprofile.json')

Validate ‘Serialization’ and ‘Accept-Serialization’. This must be done before .validate(bag) is called. ‘mydir’ is the path to the Bag.

if my_profile.validate_serialization('mydir'):
    print "Serialization validates"
else:
    print "Serialization does not validate"

Validate the rest of the profile.

if my_profile.validate(bag):
    print "Validates"
else:
    print "Does not validate"

Or from the commandline:

bagit_profile.py 'http://uri.for.profile/profile.json' path/to/bag

Test suite

python setup.py test

Development

  1. Fork the repository

  2. Do something awesome!

  3. Submit a pull request explianing what your code does

License

CC0

CC0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bagit_profile-1.0.2.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

bagit_profile-1.0.2.linux-x86_64.tar.gz (7.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page