.. _swh-digestmap: .. include:: README.rst .. toctree:: :hidden: design Direct use ---------- :: from swh.digestmap import DigestMap digestmap = DigestMap("dest_folder") digestmap.sha1_from_swhid("swh:1:cnt:0000000000000000000000000000000000000004") found = digestmap.content_get([b"0000000000000000000000000000000000000004"], algo="sha1_git") if found and found[0]: hashes_dict = found[0].hashes() Use as a Software Heritage storage backend ------------------------------------------ The Python package will register ``digestmap`` as a :ref:`Software Heritage storage backend `. However it only partially implements :py:func:`swh.storage.interface.StorageInterface.content_get`: returned content objects should only be used to fetch ``.hashes()`` as in the example above. Note that the returned dict will only contain hashes known to the digestmap, ``sha1`` and ``sha1_git``. If you are not bothered by these limitations (for example, you're using :ref:`swh-fuse ` ) It can be configured as such:: storage: cls: digestmap path: "/path/to/digestmap/folder" Develop ------- :: pip install -r requirements-swh.txt pip install -r requirements-test.txt pip install . pytest We test via ``pytest`` because the ``DigestMap`` binding needs a Python able to import ``swh.model.model``. Package with ``cibuildwheel .`` from the repository's root.