yautil
Yet Another Python util — a grab bag of helpers grown out of day-to-day work: argparse extensions, file utilities, multiprocessing-friendly caches, Docker shell helpers, plotting wrappers, password/keyring helpers, and a transactional filesystem-mount API.
Failed sub-imports degrade to dummy modules (so import yautil works even if one optional dep is missing). Python ≥ 3.11.
Install
pip install -e .
Requires sh, matplotlib; optional: argcomplete, keyring, tqdm.
API
Top-level re-exports — from yautil import ...:
argparse extensions (yautil.argparse)
| Symbol | Purpose |
|---|---|
OverridingAppendAction |
append-style action where a later flag replaces the accumulated list. |
SplitAppendAction |
append that splits each value on a delimiter (e.g. a,b,c). |
SmartAppendAction |
Heuristic combination of override + split semantics. |
ChoiceComb |
list[str] subclass used as choices= to allow comma-separated combinations. |
WarningAction |
--warning=foo,bar action with allowed-value validation. |
Files (yautil.file)
| Symbol | Purpose |
|---|---|
find(root, ...) |
Non-recursive find with name patterns / type filter. |
find_recursive(root, name_patterns=None, ignored_dirs=None, type='any', depth=-1, sort=False) |
Recursive find with prune list. |
remove_contents(folder) |
Delete every entry inside folder without removing it. |
overwrite(src, dst) |
Replace dst with src atomically. |
get_memtmpdir(suffix=None, prefix=None, dir=None) |
TemporaryDirectory on /dev/shm (or tmpfs) when available. |
Writable |
File-like wrapper that proxies writes; useful for piping output. |
Decorators (yautil.decorators)
| Symbol | Purpose |
|---|---|
static_vars(**kw) |
Attach mutable "static" attributes to a function on first call. |
Events (yautil.event)
| Symbol | Purpose |
|---|---|
Event |
Listenable event object (+= handler to subscribe, call to fire). |
EventGenerator |
Mixin / factory that declares named Events on an object. |
Printing (yautil.print)
| Symbol | Purpose |
|---|---|
decomment_cxx(text) |
Strip // and /* */ comments from C/C++/Java text. |
auto_print(string, max_len=-1, **kwargs) |
print with auto-truncation past max_len. |
strcompare(left, right, width=-1, highlight=True) -> str |
Side-by-side diff string with ANSI highlighting. |
Plotting (yautil.plot)
Thin matplotlib wrappers — all accept *data and a common set of styling kwargs.
| Symbol | Plot type |
|---|---|
plot_cdf |
Cumulative distribution function. |
plot_linear |
Line plot. |
plot_scatter |
Scatter plot. |
plot_box |
Box plot. |
plot_stack |
Stacked area / bar plot. |
Caches
| Symbol | Purpose |
|---|---|
lru_cache(...) (yautil.lru_cache_ext) |
Like functools.lru_cache but hashes list/dict arguments too. |
PersistentCache (yautil.persistent_cache) |
Disk-backed cache under ~/.cache/; survives process restarts. |
Passwords (yautil.passwd)
| Symbol | Purpose |
|---|---|
create_w_password(...) |
Build an object that requires interactive password unlock. |
create_w_secrets(...) |
Build an object that pulls secrets from a password-protected store. |
(See the module for the exact constructor signatures — both wrap keyring and an encrypted local secrets file.)
Docker shell (yautil.docker_sh)
| Symbol | Purpose |
|---|---|
docker_sh(...) |
sh-compatible Command that runs inside a built/pulled Docker image, with bind mounts, user-id pass-through, and interactive TTY support. |
AuthorizationError |
Raised when the daemon refuses (e.g. missing docker login). |
Git (yautil.git)
| Symbol | Purpose |
|---|---|
git_expand(repo, dest, *checkout_targets, ignore_errors=False, iter=False) |
Shallow-clone (or update) repo into dest for each checkout_target (branch/tag/sha). |
git_merge_file(...) |
Three-way file merge wrapping git merge-file. |
IO (yautil.io)
| Symbol | Purpose |
|---|---|
FilteredTextIO |
TextIO proxy that runs every write through a WriteCallback. |
Shell interop (yautil.pysh)
| Symbol | Purpose |
|---|---|
compile_shargs(*args, **kwargs) |
Pack Python call args into the (args, kwargs) form sh.Command expects. |
get_cmd_args(cmd) |
Recover the argv that produced a given sh.Command invocation. |
Mount API (yautil.mount)
Filesystem-mount abstraction for disk images / archives, plus high-level mount / extract / archive helpers.
from yautil.mount import mount, extract, archive, DiskImage, LinuxDiskImage
| Symbol | Purpose |
|---|---|
mount(target) |
Context manager that mounts target and yields the mount point. |
extract(target, dest) |
Extract contents of target into dest. |
archive(src, dest, type) |
Build an archive of src at dest. |
Mountable |
Base class for anything that can be mounted (loop devices, archives). |
Archive |
Mountable subclass for archive formats. |
MountableType, ArchiveType |
Enums of supported types. |
DiskImage, LinuxDiskImage |
Concrete Mountable for raw/Linux disk images (uses udisksctl). |
Metadata
Release files for yautil 0.0.69
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 |
|---|---|---|---|---|
| yautil-0.0.69.tar.gz | 38.4 kB | Without provenance | Details for yautil-0.0.69.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yautil-0.0.69-py3-none-any.whl | Python 3 | none | any | Details for yautil-0.0.69-py3-none-any.whl |
Total release size: 84.9 kB
Release files / yautil-0.0.69.tar.gz
| Download URL | yautil-0.0.69.tar.gz |
|---|---|
| Size | 38.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b502ff49f3d52027b592e2e4bbf3f30c019e9e1f9d6705e57431246e0937f9a3
|
|
BLAKE2b-256 checksum How to use checksums |
21fd7f64f245a87cc5c165b98b31f88e358db6fc650e7e88bbf60339b8adc05c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / yautil-0.0.69-py3-none-any.whl
| Download URL | yautil-0.0.69-py3-none-any.whl |
|---|---|
| Size | 46.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3adb0dbbd9983a2a909ba7998d83f5429adc9bd8a4cefca4d558195bde5ee2ae
|
|
BLAKE2b-256 checksum How to use checksums |
bab918fef5aba16a715cfd33c88e0b2f8ce1fc6b45036be67d5a409a2e444113
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Security for yautil 0.0.69
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.