Skip to main content

miscellaneous python utilities

Project description

PyPI PyPI - Downloads docs

Checks Checks Coverage

GitHub commits GitHub commit activity GitHub closed pull requests code size, bytes

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

https://miv.name/muutils

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!

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

muutils-0.9.1.tar.gz (3.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

muutils-0.9.1-py3-none-any.whl (144.3 kB view details)

Uploaded Python 3

File details

Details for the file muutils-0.9.1.tar.gz.

File metadata

  • Download URL: muutils-0.9.1.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for muutils-0.9.1.tar.gz
Algorithm Hash digest
SHA256 7191ed23ca4b6b83cee0bc125f99db02be3ee5bb89d38fba86f144178f4823f5
MD5 60bbfa35ec40713d85aac783d140f599
BLAKE2b-256 36dd17cae234b7fb930686450f5c2eddd43b04cb96a3a2bf095c06a69dfeb338

See more details on using hashes here.

File details

Details for the file muutils-0.9.1-py3-none-any.whl.

File metadata

  • Download URL: muutils-0.9.1-py3-none-any.whl
  • Upload date:
  • Size: 144.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for muutils-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6e7740a0d4080ed01f6490604d1c05b9989b7f88c02b6c987d7a073a02120c32
MD5 817a264ebd398cdeb798c4011718d52c
BLAKE2b-256 fe896ca110cfeb7287586578b69459f7e1ab798f36fcca9aa642a5784e4d0f93

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page