Pithy is a small library of Python 3.6 utilities. The various modules are mostly independent of each other.
The project is hosted at 'https://github.com/gwk/pithy'.
- ansi Ansi console control strings for colors and other terminal IO.
- buffer Buffer is an iterable class that lets you peek at and push back elements. Useful for parsing.
- collection Collection utilities.
- csv_utils CSV (comma-separated-value table files) utilities.
- data Date and time utilities.
- defaultlist DefaultList is a list subclass, analogous to
- format Python format string parsing utilities.
- fs File system utilities.
- graph_utils Graph (as in network, not chart) utilities.
- immutable Immutable object utilitise.
- io IO utilites, including shorthand functions for printing to stdout and stderr.
- iterable Iterable utilities.
- json_utils JSON, JSONL (per-line JSON), and JSONS (concatenated/streamable JSON) utilities.
- lex Easily create robust lexers from regular expressions.
- meta Python metaprogramming tools (it's a slippery slope!).
- path_encode Like urlencode, for creating sensible filesystem paths.
- schema Compute the common structure for a collection of data examples.
- sentinel Even sillier than NPM's left-pad.
- sequence Sequence utilities.
- string_utils String utilities.
- tag_parse Simplistic parser for simple structural languages defined by start/end tags.
- task Subprocess utilities.
- transform Transformer creates a pipeline of functional stages for an input stream, through which each record is transformed and notable transformations are logged.
- type_util Type utilities.
- util Miscellaneous utilities.
This project is dedicated to the public domain under the Creative Commons CC0 dedication: https://creativecommons.org/publicdomain/zero/1.0/. I chose this license because I believe that the potential usefulness of the code is increased by reducing the legal burden around using it to zero. You are free to copy, alter and integrate individual functions or modules into your project as you see fit.
Although no attribution is required, attribution and feedback are very much appreciated.
$ pip3 install pithy
Alternatively, you can check out the pithy project and use pip to install it in 'develop' mode as follows:
$ cd ~/work # or wherever you prefer to keep projects.
$ git clone email@example.com:gwk/pithy.git
$ pip3 install -e pithy
This method tells python to find the module at the specified directory (in this case "pithy", where we checked out the repo).
Changes to the code will be immediately visible to the python3 installation, with no need for reinstallation.
Please file issues to the github repository.