What does HackerNews think of pyp?

Easily run Python at the shell! Magical, but never mysterious.

Language: Python

#53 in Python
#13 in Shell
I have bookmarked/tried so many Python/Shell mashups over the years.

IMHO the following is about the only one that's tasteful in terms of project scope and not going off the deep end: https://github.com/hauntsaninja/pyp

> The submission is about a non-standard dialect of Awk

True, but the comment I responded to also has this:

> You won't need to learn Awk

Regardless, let's accept the claim that it's only about non-standard frawk.

> If it's between that and Pyp, why not use Pyp?

Because, as the instructions[0] point out

> Run pip install pypyp (note the extra "yp"!)

> pyp requires Python 3.6 or above.

It's necessary to install pip and Python at least to do so, I expect that I can produce a binary for frawk and drop it in far more easily. I'm not even sure what advantage Pyp has over using a Python REPL (or Ruby or perl etc).

> And also, in the technology business, you are supposed to make progress happen.

I do that by writing good code and improving processes.

As I've pointed out, I fail to see how needing to include the Python ecosystem is "progress" over a binary that is tiny, fast, and works. Calling things obsolete because they're "old" is the argument of a teenager. I apologise if that sounds rude, but I don't know how else to put it, that's what it is.

[0] https://github.com/hauntsaninja/pyp

I wrote a similar tool a while back. My solution for this was to statically analyse the input to discover unused names. The cool part of doing transformations statically is that you're able to see the exact Python code you'd run without running it, e.g. `pyp --explain x[:5]`. https://github.com/hauntsaninja/pyp
This looks like an unmaintained version of (the much more complete) pyp:

https://github.com/hauntsaninja/pyp

Thank you for the extensive and thoughtful comment! This does help clarify your approach quite considerably. I wonder, since you are hoping to attract collaborators, whether there is some kind of formal spec for the language somewhere? For example, you mentioned parallel efforts: suppose I wanted to write a port to pure C; is there any way, short of reading every one of your posts and trying to contain the whole language in my head at once, for me to know exactly what I need to implement?

Something I've been trying to figure out: what is the exact relationship at present between OSH and Oil? When you say "OSH" do you mean the language, or the shell itself "oil shell"? If Oil is not something I can download, why exactly does that `const v = max(1, 2)` statement work in osh? It's clearly not just a Bash implementation, it's got other features. Is that a subset of Oil's features? Which subset?

Since you're also interested in other shells, you might have a look at pyp [1]. It captures a lot of the way I personally would like to use some future shell. If the features of pyp were integrated into the shell itself, you wouldn't need an external command, you could just (for example) pipe the output of one program into a python-like statement that mangles the incoming strings in some way, and pipe that out to some xargs-like program to use in a subshell. (The fact that you apparently can't use the pipe in what Xonsh calls "Python mode" is for me the central limiting feature of that shell.)

[1] https://github.com/hauntsaninja/pyp

I've enjoyed using pyp[1] with fish to make some nice one-liners

For example, custom history command to make early commands at the top, scroll to the bottom, and show the date and command on the same line

function hist; history -t -R | pyp '["\t".join(pair) for pair in zip(lines[::2],lines[1::2])]' | less +G; end; funcsave hist

[1] https://github.com/hauntsaninja/pyp

I feel that most of the tools mentioned here are quite outdated already and in 2019 alternatives should be recommended.

find -> fd

grep -> ripgrep

wget/curl -> httpie

awk/sed are just horrible to learn for beginners, would advise to just pick up python instead via xonsh[1] or pyp[2]

How about we don't teach new users these legacy tools and we can finally progress a little?

1 - http://xon.sh

2 - https://github.com/hauntsaninja/pyp