dh
Typed Python utilities for filesystem traversal, command execution, terminal text, and parallel processing. Requires Python 3.11+.
python -m pip install -e '.[dev,parallel]'
from dh import get_files, get_dirs, runcmd
rst_files = get_files("docs", ext=[".rst"])
directories = list(get_dirs("src"))
code, stdout, stderr = runcmd(["git", "status", "--short"], show_output=False)
dh.fileutils contains the shared filesystem implementation. Existing
dh.pathutils imports remain supported. get_files(..., dirs_only=True) unifies
directory traversal; suffix, Python-source, binary, and directory exclusion filters
work together. Traversal uses one shared pure-Python os.scandir engine, with
excluded directory trees pruned before descent. No native extension is required.
Text helpers
from dh import levenshtein, text_distance, count_words, to_camel, to_snake, word_frequencies
assert levenshtein("kitten", "sitting") == 3
assert to_snake("HTTPServer") == "http_server"
assert to_camel("hello_world") == "helloWorld"
assert count_words("Hello, world!") == 2
assert word_frequencies("Hi hi")["hi"] == 2
See text utilities for distance and tokenization contracts.
Tests and types
pytest -q
ty check
Documentation
Read the book sources or open
docs/html/index.html for built HTML.
python tools/build_api_docs.py
mdbook build docs
See development instructions for mdBook installation and traversal contracts for filtering details.
Metadata
Release files for dh-slim 1.4.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dh_slim-1.4.7.tar.gz | 76.4 kB | Without provenance | Details for dh_slim-1.4.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dh_slim-1.4.7-py3-none-any.whl | Python 3 | none | any | Details for dh_slim-1.4.7-py3-none-any.whl |
Total release size: 148.9 kB
Release files / dh_slim-1.4.7.tar.gz
| Download URL | dh_slim-1.4.7.tar.gz |
|---|---|
| Size | 76.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b78f87b65e613a1d1f3048561f57d5c55da3f7073c3eec53e77c5f6725c139b9
|
|
BLAKE2b-256 checksum How to use checksums |
ef6e84177448acb45696c48a5e851eba3c672a7f73b7d5567f31c7da5e3855a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.10
|
Release files / dh_slim-1.4.7-py3-none-any.whl
| Download URL | dh_slim-1.4.7-py3-none-any.whl |
|---|---|
| Size | 72.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
543f9d460ae4de90b5c943ee69fc37c0a371335f1a7229db416cc14a7f0ced66
|
|
BLAKE2b-256 checksum How to use checksums |
6734dab701e411c69b850bd3e45e0442849c7ebd6072fb11926b0e5268bc8d8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.10
|
Security for dh-slim 1.4.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.