# miniswhid
No-frills [Software Hash Identifier](https://www.swhid.org/) (SWHID) computation for files and directories.
[](https://badge.fury.io/py/miniswhid)
[](https://pypi.org/project/miniswhid/)
[](https://opensource.org/licenses/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
```bash
pip install miniswhid
```
## Quick Start
### Command Line
```bash
# 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
```python
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
```bash
# 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](LICENSE) file.
## Acknowledgements
This project's test suite uses reference SWHID values generated by the [Software Heritage toolchain](https://docs.softwareheritage.org/devel/swh-core/cli.html#swh-identify) (`swh identify`) to ensure correctness and compatibility with the official implementation.
## Changelog
### 0.1.0 (2024-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
Raw data
{
"_id": null,
"home_page": null,
"name": "miniswhid",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "hash, identifier, software-heritage, swhid",
"author": "Diego Jorquera",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/07/b3/15b2bea12d7f6baf75ce7db723b6cbee651aae5ca523e52c3caa99e182a3/miniswhid-0.1.0.tar.gz",
"platform": null,
"description": "# miniswhid\n\nNo-frills [Software Hash Identifier](https://www.swhid.org/) (SWHID) computation for files and directories.\n\n[](https://badge.fury.io/py/miniswhid)\n[](https://pypi.org/project/miniswhid/)\n[](https://opensource.org/licenses/MIT)\n\n## Features\n\n- Support for content (`cnt`) and directory (`dir`) SWHIDs\n- Concurrent file hashing on multi-core systems\n- Minimal dependencies \u2014 uses only Python standard library\n\nRevision, release and snapshot SWHIDs are *not* supported.\n\n## Requirements\n\n- Python 3.10 or higher\n\n## Installation\n\n```bash\npip install miniswhid\n```\n\n## Quick Start\n\n### Command Line\n\n```bash\n# Compute SWHID for a file\nminiswhid README.md\n# Output: swh:1:cnt:4c7fdf8...\n\n# Compute SWHID for a directory \nminiswhid /path/to/directory\n# Output: swh:1:dir:8b137891...\n```\n\n### Python API\n\n```python\nfrom miniswhid import compute_content_swhid, compute_directory_swhid\n\n# File content SWHID\nfile_swhid = compute_content_swhid(\"README.md\")\nprint(file_swhid) # swh:1:cnt:4c7fdf8...\n\n# Directory SWHID\ndir_swhid = compute_directory_swhid(\"/path/to/directory\") \nprint(dir_swhid) # swh:1:dir:8b137891...\n```\n\n## Development\n\n### Running Tests\n\n```bash\n# Install development dependencies\nuv sync\n\n# Run test suite\nuv run pytest\n\n# Run with coverage\nuv run pytest --cov=miniswhid\n\n# Run linting and type checking\nuvx ruff check\nuvx ruff format\nuvx mypy .\n\n# Or run all checks via pre-commit\nuv run pre-commit run --all-files\n```\n\n## License\n\nMIT - see [LICENSE](LICENSE) file.\n\n## Acknowledgements\n\nThis project's test suite uses reference SWHID values generated by the [Software Heritage toolchain](https://docs.softwareheritage.org/devel/swh-core/cli.html#swh-identify) (`swh identify`) to ensure correctness and compatibility with the official implementation.\n\n## Changelog\n\n### 0.1.0 (2024-08-13)\n- Initial release with complete SWHID computation for files and directories\n- Command-line interface (`miniswhid` command)\n- Python API with `compute_content_swhid()` and `compute_directory_swhid()`\n- Parallel processing for directory traversal\n- Comprehensive test suite with 22+ tests using official Software Heritage reference values\n- Type checking with mypy and strict type annotations\n- Code formatting and linting with ruff\n- Pre-commit hooks for code quality assurance\n- Automated PyPI publishing via GitHub Actions\n- TestPyPI workflow for release validation",
"bugtrack_url": null,
"license": null,
"summary": "No-frills SWHID computation for files and directories",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/diegojorquera/miniswhid",
"Issues": "https://github.com/diegojorquera/miniswhid/issues",
"Repository": "https://github.com/diegojorquera/miniswhid"
},
"split_keywords": [
"hash",
" identifier",
" software-heritage",
" swhid"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "057fc3f9fefa6f3597def0162fb53ff502568c54d05052da7fbc726c80deb98d",
"md5": "e29f0c4da614bf4c17626c1dabaee68c",
"sha256": "2e3ce6e3cfae298cff5cabd517fde0258fed942d74f2be4a5f8e76972067e7f2"
},
"downloads": -1,
"filename": "miniswhid-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e29f0c4da614bf4c17626c1dabaee68c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 6578,
"upload_time": "2025-08-13T07:39:03",
"upload_time_iso_8601": "2025-08-13T07:39:03.475575Z",
"url": "https://files.pythonhosted.org/packages/05/7f/c3f9fefa6f3597def0162fb53ff502568c54d05052da7fbc726c80deb98d/miniswhid-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "07b315b2bea12d7f6baf75ce7db723b6cbee651aae5ca523e52c3caa99e182a3",
"md5": "f462645beabf4aecfb2776df73a67139",
"sha256": "415713d38b2c6aaa9490ebc8dfdae512daa8d6565f5c36357b3a666b7fad2728"
},
"downloads": -1,
"filename": "miniswhid-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "f462645beabf4aecfb2776df73a67139",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 28855,
"upload_time": "2025-08-13T07:39:04",
"upload_time_iso_8601": "2025-08-13T07:39:04.727243Z",
"url": "https://files.pythonhosted.org/packages/07/b3/15b2bea12d7f6baf75ce7db723b6cbee651aae5ca523e52c3caa99e182a3/miniswhid-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-13 07:39:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "diegojorquera",
"github_project": "miniswhid",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "miniswhid"
}