Skip to main content

miniswhid

No-frills Software Hash Identifier (SWHID) computation for files and directories.

PyPI version Python versions License: MIT

Features

  • Support for content (cnt) and directory (dir) SWHIDs
  • Concurrent file hashing on multi-core systems
  • Minimal dependencies — uses only Python standard library

Revision, release and snapshot SWHIDs are not supported.

Requirements

  • Python 3.10 or higher

Installation

pip install miniswhid

Quick Start

Command Line

# Compute SWHID for a file
miniswhid README.md
# Output: swh:1:cnt:4c7fdf8...

# Compute SWHID for a directory  
miniswhid /path/to/directory
# Output: swh:1:dir:8b137891...

Python API

from miniswhid import compute_content_swhid, compute_directory_swhid

# File content SWHID
file_swhid = compute_content_swhid("README.md")
print(file_swhid)  # swh:1:cnt:4c7fdf8...

# Directory SWHID
dir_swhid = compute_directory_swhid("/path/to/directory")  
print(dir_swhid)   # swh:1:dir:8b137891...

Development

Running Tests

# Install development dependencies
uv sync

# Run test suite
uv run pytest

# Run with coverage
uv run pytest --cov=miniswhid

# Run linting and type checking
uvx ruff check
uvx ruff format
uvx mypy .

# Or run all checks via pre-commit
uv run pre-commit run --all-files

License

MIT - see LICENSE file.

Acknowledgements

This project's test suite uses reference SWHID values generated by the Software Heritage toolchain (swh identify) to ensure correctness and compatibility with the official implementation.

Changelog

0.1.1 (2026-03-14)

  • Added Python 3.14 support
  • Updated dependencies and tool versions
  • Added tests for ThreadPoolExecutor error handling

0.1.0 (2025-08-13)

  • Initial release with complete SWHID computation for files and directories
  • Command-line interface (miniswhid command)
  • Python API with compute_content_swhid() and compute_directory_swhid()
  • Parallel processing for directory traversal
  • Comprehensive test suite with 22+ tests using official Software Heritage reference values
  • Type checking with mypy and strict type annotations
  • Code formatting and linting with ruff
  • Pre-commit hooks for code quality assurance
  • Automated PyPI publishing via GitHub Actions
  • TestPyPI workflow for release validation

Metadata

Release files for miniswhid 0.1.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 miniswhid 0.1.1
File Size Uploaded Provenance Actions
miniswhid-0.1.1.tar.gz 36.6 kB With provenance Details for miniswhid-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for miniswhid 0.1.1
File Interpreter ABI Platform Actions
miniswhid-0.1.1-py3-none-any.whl Python 3 none any Details for miniswhid-0.1.1-py3-none-any.whl

Total release size: 43.2 kB

Release files / miniswhid-0.1.1.tar.gz

Download URL miniswhid-0.1.1.tar.gz
Size 36.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0cdf9b971f4b7fa53457f5287aac37e4db4c0660b9fb824b8902dd91d0c512fe
BLAKE2b-256 checksum
How to use checksums
1265bd65b03d022ed292e5c3593d6144cc5fc6765012329ea20798ec385434a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.

Transparency log

Release files / miniswhid-0.1.1-py3-none-any.whl

Download URL miniswhid-0.1.1-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
19e64037634166fc913b896e1ef7056ec1eba4e06edf58395021a65fbd231c0a
BLAKE2b-256 checksum
How to use checksums
fc826eeaa10b864ced43e4d14f83a506f2e75f8c3ec85bb296a66f886dfc098d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.

Transparency log

Security for miniswhid 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for miniswhid-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

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