Skip to main content

pypi pypi pypi

py-pepe

Super simple pipeline helper on Python. Works like awk but easier to remember (and also less posibilities...).

PEPE can work in 2 different ways:

1. As python module

Don't remember awk commands? Not a problem! Just insert python script here and read result of previous command using pepe.read(). Additionally, you can select N column (like column 6 in example):

# Show max usage RAM from process
ps ux | python -c "import pepe; x=pepe.read(6); print(max(x[1:]))"

2. As CLI

Don't want to call python scripts like that? We got you a CLI tool too!

CLI interface totally mimics python functions usage:

# Show total RAM usage of Visual Studio Code process
ps ux | grep "Visual Studio Code" | pepe sum 6

Here you add pepe sum 6 in pipe. That's identical to import pepe; pepe.sum(6). Same args and same positions. That's why if you want to sort lines as numbers, you need to add 0 positional arg: pepe sort 0 true, because that's identical to pepe.sort(0, True).

CLI doesn't have any flags, only positional args. That's for simplicity.

Installation

pip install py-pepe

Functions/Example of usage

help

To show help just call pepe command in terminal. Also on each error in input you probably will see pepe help.

pepe.read

Python-code only function (no cli). Reads all stdin and returns list of lines.

NOTE: This is the only function in pepe that returns a value. All other function just print their results.

Optional positional params: - <column> - select only N column

# Show max usage RAM from process
ps ux | python -c "import pepe; x=pepe.read(6); print(max(x[1:]))"

pepe.out

Display result. Works like cat or echo, but can select column.

Optional positional params: - <column> - select only N column

# Display only 1 column of ps ux
ps ux | head -n 10 | pepe out 1

# Same, but using python code
ps ux | head -n 10 | python -c "import pepe; pepe.out(1)"

# Without pepe
ps ux | head -n 10 | awk '{ print $1 }'

pepe.sum

Command sum allows to sum lines as numbers.

Optional positional params: - <column> - select only N column

Let's count RAM usage of all VSCode processes (on mac). Column 6 of "ps ux" output contains info about RAM:

# Select column 6 and sum
ps ux | grep "Visual Studio Code" | pepe sum 6

# Select column 6 using awk and sum all lines
ps ux | grep "Visual Studio Code" | awk '{ print $6 }' | pepe sum

# Same, but using python code
ps ux | grep "Visual Studio Code" | python -c "import pepe; pepe.sum(6)"

# Without pepe
ps ux | grep "Visual Studio Code" | awk '{sum+=$6} END {print sum}'

pepe.sort

pepe.min

pepe.max

pepe.size

pepe.count

Metadata

Release files for py-pepe 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-pepe 0.0.5
File Size Uploaded
py-pepe-0.0.5.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-pepe 0.0.5
File Interpreter ABI Platform
py_pepe-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 11.4 kB

Release files / py-pepe-0.0.5.tar.gz

Download URL py-pepe-0.0.5.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
580547c870feab08169a7f05476ddbd8cb752e0ba6fa9e2338293d473afb109a
BLAKE2b-256 checksum
How to use checksums
53709a4c83e30a4fc5fb561b7e93b55fd8c564127a8d0c865905d1e9514ba5fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.13

Release files / py_pepe-0.0.5-py3-none-any.whl

Download URL py_pepe-0.0.5-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4301f88a531bf28cd1dfe32dafe321e84261f4cd6aa387e28be89cbf92d9a1c
BLAKE2b-256 checksum
How to use checksums
c22a84ff75793b1accc42fb6ee49d860c43f8882c03c9759a604ccc13ef9b7b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.13

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release 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