Epycs v1.4.0 is out!

Epycs v1.4.0 has been released, it brings direct piping of python functions, which should free you from ever using awk or sed again!

Epycs v1.4.0 is out!

Epycs has been released in version 1.4.0: https://pypi.org/project/epycs/

Using this version, you will now be able to do some dark magic things 🧙🏻 such as deleting an environnement variable from a subprocess you spawn

>>> from epycs.subprocess import cmd
>>> cmd.shell("-c", "echo $SHELL", out_filter=str)
'/usr/bin/zsh\n'
>>> cmd.shell("-c", "echo $SHELL", out_filter=str, additional_env={"SHELL": None})
'\n'

Or, and that's a big news, executing python code directly as a piped subprocess, meaning you can now very easily add python scripts into your pipes. These allow you to do tons of new things that would absolutely require awk or sed otherwise, and I don't think anyone has time to properly learn these anymore!

This feature works well, but it is quite limited in how it can use the external env, and I expect it to break easily on any kind of convoluted functions, so be warned: here be dragons 🐲

import subprocess
from epycs.subprocess import cmd, python_to_subprocess

def headers_as_csv(open_f):
    print(f"header,content")
    for line in sys.stdin:
        if ": " in line:
            name, content = line.strip().split(": ", 1)
            print(f"{name},{content!r}")

if __name__ == "__main__":
    curl = cmd.curl("--head", "www.example.org",
            stdout=subprocess.PIPE, background=True)
    out = python_to_subprocess(headers_as_csv)(stdin=curl.stdout)

I'll let you try and tell me what's broken, I'm always appreciative of a good bug report 🐛 either directly or through the GitLab project issue tracker.

Happy witching with this version!