-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathindex.html
More file actions
129 lines (96 loc) · 5.81 KB
/
index.html
File metadata and controls
129 lines (96 loc) · 5.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>bagit-python by LibraryOfCongress</title>
<link rel="stylesheet" href="stylesheets/styles.css">
<link rel="stylesheet" href="stylesheets/pygment_trac.css">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="wrapper">
<header>
<h1>bagit-python</h1>
<p>Work with BagIt packages from Python.</p>
<p class="view"><a href="https://github.com/LibraryOfCongress/bagit-python">View the Project on GitHub <small>LibraryOfCongress/bagit-python</small></a></p>
<ul>
<li><a href="https://github.com/LibraryOfCongress/bagit-python/zipball/master">Download <strong>ZIP File</strong></a></li>
<li><a href="https://github.com/LibraryOfCongress/bagit-python/tarball/master">Download <strong>TAR Ball</strong></a></li>
<li><a href="https://github.com/LibraryOfCongress/bagit-python">View On <strong>GitHub</strong></a></li>
</ul>
</header>
<section>
<h1>
<a name="bagit" class="anchor" href="#bagit"><span class="octicon octicon-link"></span></a>bagit</h1>
<a href="https://secure.travis-ci.org/LibraryOfCongress/bagit-python"><img src="https://secure.travis-ci.org/LibraryOfCongress/bagit-python.png"></a>
<p>bagit is a Python library and command line utility for working with BagIt
style packages. BagIt is a minimalist packaging format for digital preservation.
If you're not familiar with BagIt already you may be interested in the
<a href="http://en.wikipedia.org/wiki/BagIt">BagIt Wikipedia article</a>,
the <a href="http://purl.org/net/bagit">IETF specification</a> or this short
video below.</p>
<iframe width="420" height="315" src="https://www.youtube.com/embed/l3p3ao_JSfo" frameborder="0" allowfullscreen></iframe>
<br>
<br>
<h2>
<a name="installation" class="anchor" href="#installation"><span class="octicon octicon-link"></span></a>Installation</h2>
<p>bagit.py is a single-file python module that you can drop into your project as
needed or you can install globally with:</p>
<pre><code>pip install bagit
</code></pre>
<p>Python v2.4+ is required.</p>
<h2>
<a name="usage" class="anchor" href="#usage"><span class="octicon octicon-link"></span></a>Usage</h2>
<p>From python you can use the bagit module to make a bag like this: </p>
<div class="highlight"><pre><span class="kn">import</span> <span class="nn">bagit</span>
<span class="n">bag</span> <span class="o">=</span> <span class="n">bagit</span><span class="o">.</span><span class="n">make_bag</span><span class="p">(</span><span class="s">'mydir'</span><span class="p">,</span> <span class="p">{</span><span class="s">'Contact-Name'</span><span class="p">:</span> <span class="s">'Ed Summers'</span><span class="p">})</span>
</pre></div>
<p>Or if you've got an existing bag</p>
<div class="highlight"><pre><span class="kn">import</span> <span class="nn">bagit</span>
<span class="n">bag</span> <span class="o">=</span> <span class="n">bagit</span><span class="o">.</span><span class="n">Bag</span><span class="p">(</span><span class="s">'/path/to/bag'</span><span class="p">)</span>
</pre></div>
<p>Or from the command line:</p>
<pre><code>bagit.py --contact-name 'Ed Summers' mydir
</code></pre>
<p>If you want to validate a bag you can:</p>
<div class="highlight"><pre><span class="n">bag</span> <span class="o">=</span> <span class="n">bagit</span><span class="o">.</span><span class="n">Bag</span><span class="p">(</span><span class="s">'/path/to/bag'</span><span class="p">)</span>
<span class="k">if</span> <span class="n">bag</span><span class="o">.</span><span class="n">is_valid</span><span class="p">():</span>
<span class="k">print</span> <span class="s">"yay :)"</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">print</span> <span class="s">"boo :("</span>
</pre></div>
<p>If you'd like to generate the checksums using parallel system processes,
instead of single process:</p>
<div class="highlight"><pre><span class="n">bagit</span><span class="o">.</span><span class="n">make_bag</span><span class="p">(</span><span class="s">'mydir'</span><span class="p">,</span> <span class="p">{</span><span class="s">'Contact-Name'</span><span class="p">:</span> <span class="s">'Ed Summers'</span><span class="p">},</span> <span class="n">processes</span><span class="o">=</span><span class="mi">4</span><span class="p">)</span>
</pre></div>
<p>or:</p>
<pre><code>bagit.py --processes 4 --contact-name 'Ed Summers' mydir
</code></pre>
<p>bag --help will give the full set of options.</p>
<h2>
<a name="development" class="anchor" href="#development"><span class="octicon octicon-link"></span></a>Development</h2>
<pre><code>% git clone git://github.com/LibraryOfCongress/bagit-python.git
% cd bagit
% python test.py
</code></pre>
<p>If you'd like to see how increasing parallelization of bag creation on
your system effects the time to create a bag try using the included bench
utility:</p>
<pre><code>% ./bench.py
</code></pre>
<h2>
<a name="license" class="anchor" href="#license"><span class="octicon octicon-link"></span></a>License</h2>
<p><a href="https://creativecommons.org/publicdomain/zero/1.0/"><img src="https://licensebuttons.net/p/zero/1.0/88x31.png" alt="Creative Commons CC0 Public Domain"></a></p>
</section>
<footer>
<p>This project is maintained by <a href="https://github.com/LibraryOfCongress">LibraryOfCongress</a></p>
<p><small>Hosted on GitHub Pages — Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
</footer>
</div>
<script src="javascripts/scale.fix.js"></script>
</body>
</html>