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