comparison env/lib/python3.9/site-packages/bagit-1.8.1.dist-info/METADATA @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 Metadata-Version: 2.1
2 Name: bagit
3 Version: 1.8.1
4 Summary: Create and validate BagIt packages
5 Home-page: https://libraryofcongress.github.io/bagit-python/
6 Author: Ed Summers
7 Author-email: ehs@pobox.com
8 License: UNKNOWN
9 Platform: POSIX
10 Classifier: License :: Public Domain
11 Classifier: Intended Audience :: Developers
12 Classifier: Topic :: Communications :: File Sharing
13 Classifier: Topic :: Software Development :: Libraries :: Python Modules
14 Classifier: Topic :: System :: Filesystems
15 Classifier: Programming Language :: Python :: 2
16 Classifier: Programming Language :: Python :: 2.7
17 Classifier: Programming Language :: Python :: 3
18 Classifier: Programming Language :: Python :: 3.1
19 Classifier: Programming Language :: Python :: 3.2
20 Classifier: Programming Language :: Python :: 3.3
21 Classifier: Programming Language :: Python :: 3.4
22 Classifier: Programming Language :: Python :: 3.5
23 Classifier: Programming Language :: Python :: 3.6
24 Classifier: Programming Language :: Python :: 3.7
25 Classifier: Programming Language :: Python :: 3.8
26
27 bagit-python
28 ============
29
30 |Build Status| |Coverage Status|
31
32 bagit is a Python library and command line utility for working with
33 `BagIt <http://purl.org/net/bagit>`__ style packages.
34
35 Installation
36 ------------
37
38 bagit.py is a single-file python module that you can drop into your
39 project as needed or you can install globally with:
40
41 ::
42
43 pip install bagit
44
45 Python v2.7+ is required.
46
47 Command Line Usage
48 ------------------
49
50 When you install bagit you should get a command-line program called
51 bagit.py which you can use to turn an existing directory into a bag:
52
53 ::
54
55 bagit.py --contact-name 'John Kunze' /directory/to/bag
56
57 Finding Bagit on your system
58 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59
60 The ``bagit.py`` program should be available in your normal command-line
61 window (Terminal on OS X, Command Prompt or Powershell on Windows,
62 etc.). If you are unsure where it was installed you can also request
63 that Python search for ``bagit`` as a Python module: simply replace
64 ``bagit.py`` with ``python -m bagit``:
65
66 ::
67
68 python -m bagit --help
69
70 On some systems Python may have been installed as ``python3``, ``py``,
71 etc. – simply use the same name you use to start an interactive Python
72 shell:
73
74 ::
75
76 py -m bagit --help
77 python3 -m bagit --help
78
79 Configuring BagIt
80 ~~~~~~~~~~~~~~~~~
81
82 You can pass in key/value metadata for the bag using options like
83 ``--contact-name`` above, which get persisted to the bag-info.txt. For a
84 complete list of bag-info.txt properties you can use as commmand line
85 arguments see ``--help``.
86
87 Since calculating checksums can take a while when creating a bag, you
88 may want to calculate them in parallel if you are on a multicore
89 machine. You can do that with the ``--processes`` option:
90
91 ::
92
93 bagit.py --processes 4 /directory/to/bag
94
95 To specify which checksum algorithm(s) to use when generating the
96 manifest, use the --md5, --sha1, --sha256 and/or --sha512 flags (MD5 is
97 generated by default).
98
99 ::
100
101 bagit.py --sha1 /path/to/bag
102 bagit.py --sha256 /path/to/bag
103 bagit.py --sha512 /path/to/bag
104
105 If you would like to validate a bag you can use the --validate flag.
106
107 ::
108
109 bagit.py --validate /path/to/bag
110
111 If you would like to take a quick look at the bag to see if it seems
112 valid by just examining the structure of the bag, and comparing its
113 payload-oxum (byte count and number of files) then use the ``--fast``
114 flag.
115
116 ::
117
118 bagit.py --validate --fast /path/to/bag
119
120 And finally, if you'd like to parallelize validation to take advantage
121 of multiple CPUs you can:
122
123 ::
124
125 bagit.py --validate --processes 4 /path/to/bag
126
127 Using BagIt in your programs
128 ----------------------------
129
130 You can also use BagIt programatically in your own Python programs by
131 importing the ``bagit`` module.
132
133 Create
134 ~~~~~~
135
136 To create a bag you would do this:
137
138 .. code:: python
139
140 bag = bagit.make_bag('mydir', {'Contact-Name': 'John Kunze'})
141
142 ``make_bag`` returns a Bag instance. If you have a bag already on disk
143 and would like to create a Bag instance for it, simply call the
144 constructor directly:
145
146 .. code:: python
147
148 bag = bagit.Bag('/path/to/bag')
149
150 Update Bag Metadata
151 ~~~~~~~~~~~~~~~~~~~
152
153 You can change the metadata persisted to the bag-info.txt by using the
154 ``info`` property on a ``Bag``.
155
156 .. code:: python
157
158 # load the bag
159 bag = bagit.Bag('/path/to/bag')
160
161 # update bag info metadata
162 bag.info['Internal-Sender-Description'] = 'Updated on 2014-06-28.'
163 bag.info['Authors'] = ['John Kunze', 'Andy Boyko']
164 bag.save()
165
166 Update Bag Manifests
167 ~~~~~~~~~~~~~~~~~~~~
168
169 By default ``save`` will not update manifests. This guards against a
170 situation where a call to ``save`` to persist bag metadata accidentally
171 regenerates manifests for an invalid bag. If you have modified the
172 payload of a bag by adding, modifying or deleting files in the data
173 directory, and wish to regenerate the manifests set the ``manifests``
174 parameter to True when calling ``save``.
175
176 .. code:: python
177
178
179 import shutil, os
180
181 # add a file
182 shutil.copyfile('newfile', '/path/to/bag/data/newfile')
183
184 # remove a file
185 os.remove('/path/to/bag/data/file')
186
187 # persist changes
188 bag.save(manifests=True)
189
190 The save method takes an optional processes parameter which will
191 determine how many processes are used to regenerate the checksums. This
192 can be handy on multicore machines.
193
194 Validation
195 ~~~~~~~~~~
196
197 If you would like to see if a bag is valid, use its ``is_valid`` method:
198
199 .. code:: python
200
201 bag = bagit.Bag('/path/to/bag')
202 if bag.is_valid():
203 print("yay :)")
204 else:
205 print("boo :(")
206
207 If you'd like to get a detailed list of validation errors, execute the
208 ``validate`` method and catch the ``BagValidationError`` exception. If
209 the bag's manifest was invalid (and it wasn't caught by the payload
210 oxum) the exception's ``details`` property will contain a list of
211 ``ManifestError``\ s that you can introspect on. Each ManifestError,
212 will be of type ``ChecksumMismatch``, ``FileMissing``,
213 ``UnexpectedFile``.
214
215 So for example if you want to print out checksums that failed to
216 validate you can do this:
217
218 .. code:: python
219
220
221 bag = bagit.Bag("/path/to/bag")
222
223 try:
224 bag.validate()
225
226 except bagit.BagValidationError as e:
227 for d in e.details:
228 if isinstance(d, bagit.ChecksumMismatch):
229 print("expected %s to have %s checksum of %s but found %s" %
230 (d.path, d.algorithm, d.expected, d.found))
231
232 To iterate through a bag's manifest and retrieve checksums for the
233 payload files use the bag's entries dictionary:
234
235 .. code:: python
236
237 bag = bagit.Bag("/path/to/bag")
238
239 for path, fixity in bag.entries.items():
240 print("path:%s md5:%s" % (path, fixity["md5"]))
241
242 Contributing to bagit-python development
243 ----------------------------------------
244
245 ::
246
247 % git clone git://github.com/LibraryOfCongress/bagit-python.git
248 % cd bagit-python
249 # MAKE CHANGES
250 % python test.py
251
252 Running the tests
253 ~~~~~~~~~~~~~~~~~
254
255 You can quickly run the tests by having setuptools install dependencies:
256
257 ::
258
259 python setup.py test
260
261 Once your code is working, you can use
262 `Tox <https://tox.readthedocs.io/>`__ to run the tests with every
263 supported version of Python which you have installed on the local
264 system:
265
266 ::
267
268 tox
269
270 If you have Docker installed, you can run the tests under Linux inside a
271 container:
272
273 ::
274
275 % docker build -t bagit:latest . && docker run -it bagit:latest
276
277 Benchmarks
278 ----------
279
280 If you'd like to see how increasing parallelization of bag creation on
281 your system effects the time to create a bag try using the included
282 bench utility:
283
284 ::
285
286 % ./bench.py
287
288 License
289 -------
290
291 |cc0|
292
293 Note: By contributing to this project, you agree to license your work
294 under the same terms as those that govern this project's distribution.
295
296 .. |Build Status| image:: https://travis-ci.org/LibraryOfCongress/bagit-python.svg?branch=master
297 :target: http://travis-ci.org/LibraryOfCongress/bagit-python
298 .. |Coverage Status| image:: https://coveralls.io/repos/github/LibraryOfCongress/bagit-python/badge.svg?branch=master
299 :target: https://coveralls.io/github/LibraryOfCongress/bagit-python?branch=master
300 .. |cc0| image:: http://i.creativecommons.org/p/zero/1.0/88x31.png
301 :target: http://creativecommons.org/publicdomain/zero/1.0/
302
303