Live data from Hacker News

Show HN: Sultan – Pythonic interface to your shell

sultan.readthedocs.io

31–40 of 54 posts

Re: Show HN: Sultan – Pythonic interface to your shell

#32
post #2

Very nice! I've been using somewhat similar sh [1] for the same purpose. It's nice seeing more alternatives. [1] https://amoffat.github.io/sh/

Two more resources on top of sh:

Invoke: http://www.pyinvoke.org/ wraps subprocess commands into Makefile-like tasks

Fabric: http://www.fabfile.org/ Same as invoke, but catered to remote subprocess commands over SSH

Re: Show HN: Sultan – Pythonic interface to your shell

#33
post #2

Very nice! I've been using somewhat similar sh [1] for the same purpose. It's nice seeing more alternatives. [1] https://amoffat.github.io/sh/

Two more resources on top of sh: Invoke: http://www.pyinvoke.org/ wraps subprocess commands into Makefile-like tasks Fabric: http://www.fabfile.org/ Same as invoke, but catered to remote subprocess commands over SSH

This was featured on HN the other day:

https://learnxinyminutes.com/docs/shutit/

https://news.ycombinator.com/item?id=14526567

Re: Show HN: Sultan – Pythonic interface to your shell

#34
post #18

This seems to be a simple wrapper around subprocess, but I'm afraid it is not changing things dramatically. Overall, I don't agree that Sultan's syntax is any more Pythonic than subprocess itself. +1 for https://sultan.readthedocs.io/en/latest/sultan-examples.html... I think it would be interesting if you could iterate on the results of "ls -l", where each row is represented by an object.

And then I remember that Windows PowerShell does (attempts to, to be fair) exactly that

attempts to, to be fair

Output of ls in PS is an Array of objects (DirectoryInfo or FileInfo instances). How is that merely an attempt?

Re: Show HN: Sultan – Pythonic interface to your shell

#36

Earlier quoted context omitted.

Cool subprocess is a little verbose. But did you happen to notice if it executes with shell=True or shell=False?

Do you include Python 3.5's subprocess.run in that assessment? I find it much cleaner for the common cases than the rest of the API: https://docs.python.org/3/library/subprocess.html#using-the-...

Doesn't seem that different from call()

Re: Show HN: Sultan – Pythonic interface to your shell

#37
post #5

Why not plumbum? (I know why not to use plumbum)

Thanks didn't know about plumbum. What do you know?

bash is the best tool to write bash in, and writing a shell in python doesn't automatically make it pythonic.

Re: Show HN: Sultan – Pythonic interface to your shell

#39
post #25

I wrote a pretty significant process wrapper in python at $PREVIOUS_JOB. The problem I have with these loose wrappers around subprocess is that they're, imho, solving the wrong problem. Or, maybe better put, not solving _enough_ of the problem. Imagine writing a wrapper for "grep". It may work in one environment, but if you need portability, you're going to quickly realize that there are nuances in implementation and…

> much different than a remote HTTP/ReST API

does that make subprocess module like urllib, and these wrappers like the ubiquitous requests package?

I think it's harder than you say: a given tool like grep has an API the size of an entire website, and then depending on usage, has different usage patterns which different optimizations.

Also, a REST API user is consuming an API, whereas a CLI wrapper is consuming an API to implement another. Much bigger fish to fry there, I think.

Post reply on HN