Strong article!
And yet I keep looking at the sh
package, but I never end up using it. I’m not sure it’s a good idea.
If you already understand subprocess
, sh
doesn't really make things much easier, and it only partially obscures what is actually happening.
The "attribute name turns into a program" magic is actively bad because it only works on Bash commands that are Python identifiers but not Python keywords, and there's the tacit assumption that all shell commands start with a program.
But DISABLE_PYTORCH_LIGHTNING=t NO_COLOR=t time make test
is taken from my recent history.
Often I want stdout
and stderr
to go to the terminal. Other times I want to capture stdout
and either suppress stderr
or send it to the terminal, or capture it separately. Occasionally I want to communicate with a long-running process.
subprocess
isn't that hard. It's better to take an hour or two and learn it properly now, and then you can use it for the rest of your career.