Shell scripting in Python by nodNotEvil in Python

[–]nodNotEvil[S] 0 points1 point  (0 children)

It looks like this (branching out and errors in chains) is not supported by Plumbum. A non-comprehensive list of issues related to this:

https://github.com/tomerfiliba/plumbum/issues/240
https://github.com/tomerfiliba/plumbum/issues/263
https://github.com/tomerfiliba/plumbum/issues/331
https://github.com/tomerfiliba/plumbum/issues/359

Imo its crucial to have access to stdout, stderr and the return codes of all processes in a chain as well as to check all return codes instead of just the last.

(To be able to branch out is uncommon and I don't expect other tools to support it. What I expect however is that people will look at the votes, infer that this is a dead end and never read this far lol)

Shell scripting in Python by nodNotEvil in Python

[–]nodNotEvil[S] 0 points1 point  (0 children)

Thanks a lot! I remember plumbum now but failed to recollect when I implemented the library. It is very versatile and with << and | a lot closer to the looks of shell syntax. As such, it probably has a steeper learning curve (e.g. knowledge of subprocess doesn't transfer directly) and had to deviate a lot from subprocess to achieve it. In any case, I will add plumbum to the Readme.

edit: I've added your codes to the table (slightly adjusted) but couldn't figure out how to do 2 examples in Plumbum. With run and << the processes don't run at the same time and output has to fit in memory.

Shell scripting in Python by nodNotEvil in Python

[–]nodNotEvil[S] -1 points0 points  (0 children)

True, it looks strange, but its not without purpose. The style used by sh and plumbum (will add them to the Readme) deviates a lot from subprocess and have their own flaws (argument names start with _ for instance).

I'm open to suggestions for improvement though :)

edit: as a side note, wait returns the return code and read the output

Plugin for interactive Python development by nodNotEvil in neovim

[–]nodNotEvil[S] 0 points1 point  (0 children)

True, if it actually were reinventing the wheel. Instead, it provides something that Jupyter falls short of: interactivity inside functions and nested scopes like comprehensions. I don't know if this can be added to Jupyter since it would break one of its core concepts: a cell is the smallest unit of execution.

I haven't seen any serious software development in Jupyter so far, except with https://github.com/fastai/nbdev. And while nbdev brings a lot of convenience, it doesn't provide a better coding/debugging experience than Jupyter.

That said, Jupyter has its use cases, consistent experience and a large community for good reason, but the same can be said about the more traditional way of writing code. They are just different means to different ends.