Skip to content
Please note that GitHub no longer supports your web browser.

We recommend upgrading to the latest Google Chrome or Firefox.

Learn more
A simple Python module for validating BagIt Profiles.
Python Makefile Batchfile
Branch: master
Clone or download
Cannot retrieve the latest commit at this time.
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
fixtures
.gitignore
.travis.yml
LICENSE
MANIFEST.in
Makefile
README.md
README.rst
bagit_profile.py
conf.py
index.rst
make.bat
module_test.py
requirements.txt
setup.py
test.py

README.md

Bagit Profile (validator)

PyPI version Build Status

Description

A simple Python module for validating BagIt Profiles. See the BagIt Profiles Specification (draft) for more information.

This module is intended for use with bagit-python 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/bagit-profiles/bagit-profiles-validator.git
  2. cd bagit-profiles-validator
  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.

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

You can’t perform that action at this time.