Skip to main content

piethon

Series of tools for python3, releasing to PyPi.

# Install for Testing
# System
/usr/bin/python3 -m pip install -e .
# brew
python3 -m pip install -e .

This package currently includes 4 different libraries: - A text coloring library, along with argparse colorization (counts as 2). - A process listing library (ala ps which does NOT work in Windows). - A set of routines to pull methods and instance variables from one class into another.

Terminal Colors

Probably most of most interest: the text coloring and color argparse libraries.

import  piethon.term.colors as c
import  piethon.script.argparse_color as ColorArgparse

The focus here is on simplicity and readability. Instead of cumbersome escape codes, cumbersome color names and the overall cumbersomeness of using color, it's as easy as the proverbial pie.

The colors library includes five palettes. They can be used individually, or mixed and matched in the same code.

The first three palettes provide different common naming conventions for the xterm 256 color palette.

The first 8 base colors all have single-letter counterparts from RGB and CMYK. The delimiter, system and solarized palettes include similarly abbreviated color names. This makes coloring text a lot nicer looking in code.

R - red G - green B - blue C - cyan M - magenta Y - yellow K - black W - white N - reset to system normal

Preceding each with 'X' (for "extended" colors) takes us to the 16-color palette.

XR - extended red XG - extended green etc.

The Solarized palette includes the exact same 16-color naming, though each color name represents an different actual color. It also includes the violet, orange and the special names invented for Solarized itself. Solarized has a mild, Matrix-like green tint.

V - violet O - orange b03 - base03 b02 - base02 b01 - base01 b00 - base00 b0 - base0 b1 - base1 b3 - base3 b2 - base2

Note that we can code coloring in two ways: with methods or with instance variables. The methods use lower case names while the variables use upper_case names. The methods always reset the color back to "normal" (no color), while the instance variables work better when setting multiple colors in text.

Palettes

  • ANSI The common "ANSI" standard color names.
import  piethon.term.colors as c

print("I'm so mad, I'm seeing", c.ansi.r("red!"))
print("Better than being," c.ansi.y("yellow"), "with envy")

ca = c.ansi # a bit of abbreviating
print(ca.R + "Happy", ca.W + "Fourth", ca.B + "of July" + ca.N)
  • SOLARIZED
import  piethon.term.colors as c

print(c.sol.b01("A greyscale-ish color named base01!"))
  • X11 These names come from the X11 'rgb.txt' file found on many systems. They overlap heavily with the ANSI palette, but some names may appear only one or the other, and some which do match may actually have slightly different color values.
import  piethon.term.colors as c

print(c.x11.chocolate("I love chocolate!"))
  • SYSTEM Colorization for common system terms, akin to color ls.

e - exe cmd - command f - file d - dir or even directory l - link mp - mount h - hostname u - username

  • Delimiters A word of wisdom: colorizing delimiters looks really great, but are a huge hassle. This palette doesn't just change the color: it inserts the actual colorized delimiters as well. These only exist as functions, and typically work best for double-delimiaters like '()' etc.
print("We use the html tag", c.dlm.angle("p"), "for paragraphs)
print("A graph starting at", c.dlm.coord(1, 2))

Download files

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

Source Distribution

piecolor-3.1.1.tar.gz (94.2 kB view details)

Uploaded Source

Built Distribution

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

piecolor-3.1.1-py3-none-any.whl (104.2 kB view details)

Uploaded Python 3

File details

Details for the file piecolor-3.1.1.tar.gz.

File metadata

  • Download URL: piecolor-3.1.1.tar.gz
  • Upload date:
  • Size: 94.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for piecolor-3.1.1.tar.gz
Algorithm Hash digest
SHA256 435091e3ce5086d86c3ba7cc873979411c65523b703dfe88a3406b21703f05e4
MD5 562980cd0478eb2b2255cb77f7677f43
BLAKE2b-256 47666247a21561b69680fbcf9dc996c3c26162855d28e7bbaae1d8be48ed409d

See more details on using hashes here.

File details

Details for the file piecolor-3.1.1-py3-none-any.whl.

File metadata

  • Download URL: piecolor-3.1.1-py3-none-any.whl
  • Upload date:
  • Size: 104.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for piecolor-3.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef5f958ff033c15f4c69f94f8ad39a2a6da1b06cc6b33e0a58db878259b30838
MD5 bc84f31dbfafd46c1d5c721383f611bf
BLAKE2b-256 803ff9d51d47314297e644af1b2cb495a9cc37d75118c46721187e476133b31e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

3.1.1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page