Skip to main content

Yet another collection of Python utility functions

Project description

Pyng is a collection of Python utility functions I’ve written over the years, and that I keep wishing were available everywhere. Sadly, in many cases I’ve simply pasted copies of individual functions as needed. But no more!

It’s organized as follows:

  • commands: decorator to automatically build an argparse.ArgumentParser by decorating functions you want to expose as script subcommands

  • dicts: dict subsets, dict searching

  • exc: manipulate exceptions, e.g. reraise, retry

  • genio: generator-based file I/O, loosely related to Java file streams

  • graph: filter DAG represented as dict of (key, otherkeys)

  • iters: generic iterator functionality, akin to itertools

  • out: construct a file-like output object to wrap a specified sink function, with buffer_lines as a useful example and syslogger as a practical use case

  • relwalk: os.walk() filtered to produce pathnames relative to the starting directory

  • replacefile: filter a text file in-place

  • timing: time-related utilities, e.g. duration() to produce a human-friendly description of a specified interval and ProgressTimer to abstract ETA computations

  • tk: Tkinter utilities, e.g. prompt for a single password or construct a prompt dialog from (description, type) tuples

  • toposort: topological sort of DAG represented as dict of (key, otherkeys)

In addition…

  • ProgressBar provides experimental progress-bar support for a long- running console script, from self-overwriting console messages through wxPython, zenity, Tkinter. This is very much a work in progress, though functional subsets have been successfully used.

Please see the individual docstrings for more information.

Project details


Download files

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

Source Distribution

Pyng-1.5.1.tar.gz (105.6 kB view details)

Uploaded Source

File details

Details for the file Pyng-1.5.1.tar.gz.

File metadata

  • Download URL: Pyng-1.5.1.tar.gz
  • Upload date:
  • Size: 105.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.12

File hashes

Hashes for Pyng-1.5.1.tar.gz
Algorithm Hash digest
SHA256 8a70e8fa1d6860fc8a812dce1586e4c102f69c9a109c96e7c5bab6864ccc26fb
MD5 d114a6ac455c8f74e8744300d0d69e10
BLAKE2b-256 befb9cfb53595e7d76ad04b50e58c31dc1a7329b1ec1e4a5b77c33c289a35f3e

See more details on using hashes here.

Supported by

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