Home > bagit

bagit

Bagit is a project mainly written in Python, it's free.

create BagIt style packages of digital content

This package can be used to create BagIt style packages programmatically in Python or from the command line. More about BagIt can be found at:

http://purl.org/net/bagit

bagit.py is a standalone python module that you can drop into your project as needed or you can install globally with:

python setup.py install

From python you can use the bagit module to make a bag like this:

import bagit bag = bagit.make_bag('mydir', {'Contact-Name': 'Ed Summers'})

Or if you've got an existing bag

import bagit bag = bagit.Bag('/path/to/bag')

Or from the command line:

bagit.py --contact-name 'Ed Summers' mydir

If you'd like to generate the checksums using parallel system processes, instead of single process:

bagit.make_bag('mydir', {'Contact-Name': 'Ed Summers'}, processes=4)

or:

bagit.py --processes 4 --contact-name 'Ed Summers' mydir

bag --help will give the full set of options.

Development

% git clone git://github.com/edsu/bagit.git % cd bagit % python test.py

If you'd like to see how increasingl parallelization of bag creation on your system effects the time to create a bag try using the included bench utility:

% ./bench.py

TODO:

  • define the return value of make_bag
  • add validation
  • write manifest to tmp file first before moving stuff around, so that if the manifest generation throws an exception the bag directory will be left untouched

Contact

Ed Summers [email protected]

License

Public Domain http://creativecommons.org/licenses/publicdomain/

Previous:napnik.com