muutils, stylized as "$\mu$utils" or "μutils", is a collection of miscellaneous python utilities, meant to be small and with no dependencies outside of standard python.
installation
PyPi: muutils
pip install muutils
Optional dependencies:
pip install muutils[array] # numpy, torch, jaxtyping -- for mlutils, tensor_utils, tensor_info, ml, json_serialize array features
pip install muutils[notebook] # ipython -- for nbutils.configure_notebook
pip install muutils[parallel] # multiprocess, tqdm -- for parallel processing with progress
pip install muutils[web] # weasyprint -- for web/html_to_pdf
documentation
modules
| Module | Description |
|---|---|
statcounter |
Extension of collections.Counter with smart stats computation (mean, variance, percentiles) |
dictmagic |
Dictionary utilities: dotlist conversion, DefaulterDict, tensor dict condensing |
kappa |
Anonymous getitem (Kappa(lambda x: x**2)[2] returns 4) |
sysinfo |
System information collection for logging |
misc |
Utilities: stable_hash, list_join/list_split, filename sanitization, freeze |
interval |
Mathematical intervals (open/closed/half-open) with containment, clamping, set operations |
errormode |
Enum-based error handling (raise/warn/log/ignore) |
validate_type |
Runtime type validation for basic and generic types |
console_unicode |
Safe console output with Unicode/ASCII fallback |
spinner |
Animated spinners with elapsed time and status updates |
timeit_fancy |
Enhanced timing with multiple runs, profiling, and statistics |
dbg |
Debug printing inspired by Rust's dbg! macro |
collect_warnings |
Context manager to capture and summarize warnings |
parallel |
Simplified parallel processing with progress bars |
jsonlines |
Simple jsonl file reading/writing |
group_equiv |
Group elements by equivalence relation (non-transitive) |
json_serialize |
Serialize arbitrary Python objects to JSON (works with ZANJ) |
nbutils |
Jupyter utilities: notebook conversion, configuration, mermaid/TeX display |
math |
Binning functions and matrix power computation |
cli |
CLI utilities: boolean argument parsing, flag actions |
web |
HTML asset inlining for standalone documents |
logger |
(deprecated) Logging framework, use trnbl instead |
mlutils |
ML pipeline: device detection, seeding, checkpoints (requires array) |
tensor_utils |
PyTorch/numpy type conversions (requires array) |
tensor_info |
Tensor metadata extraction and formatting (requires array) |
ml |
CUDA memory monitoring (requires array) |
ZANJ
ZANJ is a human-readable and simple format for ML models, datasets, and arbitrary objects. It's built around having a zip file with json and npy files, and has been spun off into its own project.
There are a couple work-in-progress utilities in _wip that aren't ready for anything, but nothing in this repo is suitable for production. Use at your own risk!
Release files for muutils 0.9.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| muutils-0.9.1.tar.gz | 3.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| muutils-0.9.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.3 MB
Release files / muutils-0.9.1.tar.gz
| Download URL | muutils-0.9.1.tar.gz |
|---|---|
| Size | 3.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7191ed23ca4b6b83cee0bc125f99db02be3ee5bb89d38fba86f144178f4823f5
|
|
BLAKE2b-256 checksum How to use checksums |
36dd17cae234b7fb930686450f5c2eddd43b04cb96a3a2bf095c06a69dfeb338
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / muutils-0.9.1-py3-none-any.whl
| Download URL | muutils-0.9.1-py3-none-any.whl |
|---|---|
| Size | 144.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6e7740a0d4080ed01f6490604d1c05b9989b7f88c02b6c987d7a073a02120c32
|
|
BLAKE2b-256 checksum How to use checksums |
fe896ca110cfeb7287586578b69459f7e1ab798f36fcca9aa642a5784e4d0f93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|