Live data from Hacker News

Show HN: Sultan – Pythonic interface to your shell

sultan.readthedocs.io

21–30 of 54 posts

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

#23

Earlier quoted context omitted.

I looked at the source code. Under the hood, it's just a thin wrapper around `subprocess`.

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-...

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

#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 the actual calling interface. Now you're handling branching logic in your application code based on platform, version, etc.

Interfacing with a command line tool shouldn't be thought of much different than a remote HTTP/ReST API talking text/plain instead of application/json. You're looking for your "client wrapper" to handle argument validation, parsing, versioning, etc.

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

#26
post #11
post #7

Earlier quoted context omitted.

And your point is??

At the risk of simply putting words into noobiemcfoob's mouth: "Xonsh is " NOT " how to do this."

OK. I thought this would be so obvious that people would see it. Sultan says "Sultan was created to help with scripts that we create with Bash, that tend to get complex." If one has an open mind, one should be asking "why would I use bash for this at all, when there exists a far superior command shell, xonsh, which incorporates all of bash's capability, with all of python, in one piece?"

Why are we trying to interface with bash to run commands from python in the first place? Cut out the middleman, bash, which is just a nuisance in the way.

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

#27
post #12

When I dabble with Python to get a job done, I invariably end up using subprocess at some stage and going through some contortions. I like the look of Sultan, it seems well thought out and has loads of well written docs. Anyone know how the name came about?

Sultan means king If you see the tag line for project

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

#29
post #26
post #11

Earlier quoted context omitted.

At the risk of simply putting words into noobiemcfoob's mouth: "Xonsh is " NOT " how to do this."

OK. I thought this would be so obvious that people would see it. Sultan says "Sultan was created to help with scripts that we create with Bash, that tend to get complex." If one has an open mind, one should be asking "why would I use bash for this at all, when there exists a far superior command shell, xonsh, which incorporates all of bash's capability, with all of python, in one piece?" Why are we trying to interfac…

You don't need to interface with bash necessarily you need to interface with binaries on the system like apt for example

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

#30
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
Post reply on HN