Skip to main content

This module implements the support and tooling to manipulate SWH Shard files based on a perfect hash table, typically used by the software heritage object storage.

It is both a Python extension that can be used as a library to manipulate SWH shard files, and a set of command line tools.

Quick Start

This package uses pybind11 to build the wrapper around the cmph minimal perfect hashmap library. To build the binary extension, in addition to the python development tools, you will need cmph, gtest and valgrind. On a Debian system, you can install these using:

sudo apt install build-essential python3-dev libcmph-dev libgtest-dev valgrind lcov

Command Line Tool

You may use several methods to install swh-shard, e.g. using uv or pip.

For example:

$ uv tool install swh-shard
[...]
Installed 1 executable: swh-shard

$ swh-shard
Usage: swh-shard [OPTIONS] COMMAND [ARGS]...

  Software Heritage Shard tools.

Options:
  -C, --config-file FILE  Configuration file.
  -h, --help              Show this message and exit.

Commands:
  create  Create a shard file from given files
  get     List objects in a shard file
  info    Display shard file information
  ls      List objects in a shard file

Then you can create a shard file from local files:

$ swh-shard create volume.shard *.py
There are 3 entries
Checking files to add  [####################################]  100%
after deduplication: 3 entries
Adding files to the shard  [####################################]  100%
Done

This will use the sha256 checksum of each file content given as argument as key in the shard file.

Then you can check the header of the shard file:

$ swh-shard info volume.shard
Shard volume.shard
├─version:    1
├─objects:    3
│ ├─position: 512
│ └─size:     5633
├─index
│ ├─position: 6145
│ └─size:     440
└─hash
  └─position: 6585

List the content of a shard:

$ swh-shard ls volume.shard
8bb71bce4885c526bb4114295f5b2b9a23a50e4a8d554c17418d1874b1a233ac: 834 bytes
06340a7a5fa9e18d72a587a69e4dc7e79f4d6a56632ea6900c22575dc207b07f: 4210 bytes
d39790a3af51286d2d10d73e72e2447cf97b149ff2d8e275b200a1ee33e4a3c5: 565 bytes

Retrieve an object from a shard:

$ swh-shard get volume.shard 06340a7a5fa9e18d72a587a69e4dc7e79f4d6a56632ea6900c22575dc207b07f | sha256sum
06340a7a5fa9e18d72a587a69e4dc7e79f4d6a56632ea6900c22575dc207b07f  -

And delete one or more objects from a shard:

$ swh-shard delete volume.shard 06340a7a5fa9e18d72a587a69e4dc7e79f4d6a56632ea6900c22575dc207b07f
About to remove these objects from the shard file misc/volume.shard
06340a7a5fa9e18d72a587a69e4dc7e79f4d6a56632ea6900c22575dc207b07f (4210 bytes)
Proceed? [y/N]: y
Deleting objects from the shard  [####################################]  100%
Done

Metadata

Release files for swh.shard 2.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for swh.shard 2.2.1
File Size Uploaded
swh_shard-2.2.1.tar.gz 42.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for swh.shard 2.2.1
File
swh_shard-2.2.1-pp311-pypy311_pp73-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl PyPy 3.11 PyPy 3.11 7.3 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
swh_shard-2.2.1-pp310-pypy310_pp73-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl PyPy 3.10 PyPy 3.10 7.3 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
swh_shard-2.2.1-cp314-cp314t-musllinux_1_2_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ x86-64 Details
swh_shard-2.2.1-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
swh_shard-2.2.1-cp314-cp314-musllinux_1_2_x86_64.whl CPython 3.14 CPython 3.14 Linux musl 1.2+ x86-64 Details
swh_shard-2.2.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
swh_shard-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl CPython 3.13 CPython 3.13 Linux musl 1.2+ x86-64 Details
swh_shard-2.2.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
swh_shard-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl CPython 3.12 CPython 3.12 Linux musl 1.2+ x86-64 Details
swh_shard-2.2.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
swh_shard-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl CPython 3.11 CPython 3.11 Linux musl 1.2+ x86-64 Details
swh_shard-2.2.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
swh_shard-2.2.1-cp310-cp310-musllinux_1_2_x86_64.whl CPython 3.10 CPython 3.10 Linux musl 1.2+ x86-64 Details
swh_shard-2.2.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details

Total release size: 9.0 MB

Release files / swh_shard-2.2.1.tar.gz

Download URL swh_shard-2.2.1.tar.gz
Size 42.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b2ea8cf61a0fd6e7e74f1aaf5b04688e16a809f1ec85af65b0a55e9eba547c35
BLAKE2b-256 checksum
How to use checksums
4d340ee4f640faf00c402abefd37b858b4af2f8661df2fefb9e93afc4953bc6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release files / swh_shard-2.2.1-pp311-pypy311_pp73-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL swh_shard-2.2.1-pp311-pypy311_pp73-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 191.7 kB
Tags Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 PyPy 3.11 PyPy 3.11 7.3
SHA-256 checksum
How to use checksums
d44b217597e8c57106a503102bb89c02710d38255590c584418d9b1c95144f01
BLAKE2b-256 checksum
How to use checksums
2843abb2a01363cb2a53cbbf87d8d4e3af46a1dfe8fb78e1b890e4a3edcf6c9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release files / swh_shard-2.2.1-pp310-pypy310_pp73-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL swh_shard-2.2.1-pp310-pypy310_pp73-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 190.6 kB
Tags Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 PyPy 3.10 PyPy 3.10 7.3
SHA-256 checksum
How to use checksums
5818a5f5e14b87a8a39c37845a30e9114677867442d508a4238d43415089fba3
BLAKE2b-256 checksum
How to use checksums
15565fa2959fe4f05fe205e7eb793c30f460b876df374710f80a4f7c9149d958
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release files / swh_shard-2.2.1-cp314-cp314t-musllinux_1_2_x86_64.whl

Download URL swh_shard-2.2.1-cp314-cp314t-musllinux_1_2_x86_64.whl
Size 1.2 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
76805c215b3c321e750aa64db53def396b9eb7bccf5ebc04cd2482037abf0a96
BLAKE2b-256 checksum
How to use checksums
c8f2eaadb2ecb15eee3503844818dfedb3bd70e70168b038b8b79e9f605af23e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release files / swh_shard-2.2.1-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL swh_shard-2.2.1-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 194.6 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
cec24da19be77922fe957fb0ca2492c13b83484f00e311d1b8eac1dd0433a0fa
BLAKE2b-256 checksum
How to use checksums
caba347cd77e339862c3840e2a1bcbae4d79980508b9cf6ca2b3c7b85aabc5bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release files / swh_shard-2.2.1-cp314-cp314-musllinux_1_2_x86_64.whl

Download URL swh_shard-2.2.1-cp314-cp314-musllinux_1_2_x86_64.whl
Size 1.2 MB
Tags CPython 3.14 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
cba07e82ea3dc019c0bc1f09440d02cda14d10c21f398ba8f32342311c45a12e
BLAKE2b-256 checksum
How to use checksums
49c63604348a1c0b0760e57a79800735fc7ecc15852dcf32efb978cae7149fd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release files / swh_shard-2.2.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL swh_shard-2.2.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 193.3 kB
Tags CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b26ba5bbb818794f3f4e64fac231bf0be14f5df32d54721d2177414b3b4617e5
BLAKE2b-256 checksum
How to use checksums
ae44a017c250ae7bae310278148f644bb8b985167386c4c2e80bcbef17830138
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release files / swh_shard-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl

Download URL swh_shard-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl
Size 1.2 MB
Tags CPython 3.13 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
95ded4c2b985e7ec03d50ef0ce90c44c3867ee4cf4e32c838e9fed2fe11ca9be
BLAKE2b-256 checksum
How to use checksums
15fe7b830b5e7ee8dd70a30f4f0943bbb8cbe629627bbdee509a09a65e2b7d79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release files / swh_shard-2.2.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL swh_shard-2.2.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 193.2 kB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
8139e1f63cbf9b85afce7a30eaee5e397d6ef085934590ccac79c7d4dc8cd26e
BLAKE2b-256 checksum
How to use checksums
27919352e021d547d3e7e4fc6375ee8c50152b8e39fd9e98f9f05e3f902cbead
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release files / swh_shard-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl

Download URL swh_shard-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl
Size 1.2 MB
Tags CPython 3.12 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
604f1717700584ec13805b9d67a846c3a5697d92cdc31025a5fbc84fce437aa0
BLAKE2b-256 checksum
How to use checksums
daa8600d9e8941d9f81923d0639ac3c41068d1bc2e025e523502bee21f84169b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release files / swh_shard-2.2.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL swh_shard-2.2.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 193.2 kB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
009b99de60dc40e9e75a9c431234a9aeaf9eb6b1a7e6731fa581e98ba169457b
BLAKE2b-256 checksum
How to use checksums
5f265892903d64455ab896755baccbe6af1da98b49cbc813dbcdfb92c6b13c2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release files / swh_shard-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl

Download URL swh_shard-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl
Size 1.2 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
6459c1e3ae0b98030d9b0796c4ffd64d2446e2a27ed63c2e6b27599a45728ad5
BLAKE2b-256 checksum
How to use checksums
2c6a70fbe616ccfa9469e68168734c8d2aaaecac0c103c4cd88affcd1200c356
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release files / swh_shard-2.2.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL swh_shard-2.2.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 191.7 kB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
0fcd6f9828c0e476537c0701710fbe86f96aea9f6d8b5247cff39549e33e6a35
BLAKE2b-256 checksum
How to use checksums
f6cc1f194405641faf7fac76f1978b1ef8e055c7b76bd20d8b0673b24c1b9859
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release files / swh_shard-2.2.1-cp310-cp310-musllinux_1_2_x86_64.whl

Download URL swh_shard-2.2.1-cp310-cp310-musllinux_1_2_x86_64.whl
Size 1.2 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
091e2405839223b115f4a8b4f264879ca19401d7431d1f2582351c1d91ed65a8
BLAKE2b-256 checksum
How to use checksums
a4e22ccdc12734ae9a5a01ab6cddf6f433e042e653d62d3f0cf02c8a00f0dbe6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release files / swh_shard-2.2.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL swh_shard-2.2.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 190.2 kB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
492dffb23085c16a40defd6a2f6c183093f56b45e53362eb4ec47882dffd4b8d
BLAKE2b-256 checksum
How to use checksums
00967b60dadcc2bcaeabd75a11e7e4b345a69ef4cd40f4eff6018253e7c1e45f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release history Release notifications | RSS feed

This release

2.2.1 This release

15 release files

2.0.1

27 release files

2.0.0

27 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page