PyMiscUtils

0.3.14 · active · verified Sun Apr 12

PyMiscUtils (installed via `pip install pymiscutils`) provides a collection of miscellaneous Python utilities, including context managers like `Timer` and `Suppressor`, a `NestedParser` for string parsing, and various helper classes for introspection, environment variables, and version management. The library is currently at version 0.3.14 and is under active development with frequent minor releases, though the API is subject to change.

Warnings

Install

Imports

Quickstart

This example demonstrates using the `Timer` context manager to measure the execution time of a function. The `Timer` will print the elapsed time upon exiting the `with` block.

import time
from miscutils.context_managers import Timer

def long_running_task():
    print("Starting a long task...")
    time.sleep(1.5)
    print("Task finished.")

with Timer('My Task'):
    long_running_task()

view raw JSON →