Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Might as well toss out Plumbum: https://plumbum.readthedocs.io/en/latest/

No more bash! No more subprocess! Write shell-like code with the convenience of Python!

Seriously, it's a great module. A bit of a learning curve, but then it feels natural.



I raise you xonsh: bash in your Python and vice versa, all in the shell! https://xon.sh/

Also have to mention the fantastic Python Prompt Toolkit, which xonsh is based on - https://python-prompt-toolkit.readthedocs.io/en/master/

I mirror another commenter's excitement on this thread about the cool libraries we have at this age, and the tools that are made possible by them.


i have a subprocess wrapper, might also be of help: https://github.com/MoserMichael/subb


wow, didn't know this existed. I've been using ipython as shell-ish replacement for not-so-serious-thing. I need to take a detail look at this from my initial glance over. thanks


Plumbum is great but I actually use the bang notation in Jupyter even more.

Actually, for me Jupyter (I use lab but I'm sure NB is amazing too) is the tool that boosts my productivity the most. (And omg vim mode.)


Also sh.


`from tqdm import tqdm; [i for i in tqdm(range(10))]`

...bit of a learning curve?


I think what OP is referring to is how fiddly it is to run a subprocess and capture the output. By the way, also super annoying in Java - you have to faff about with a thread (and you can't even really do that in python, which as much as I love the language, is quite pathetic) that drains stdout before it gets jettisoned by the OS, and in both cases long story short is that it's easy to write something that works when the output is short, but getting it to work on long output is an exercise in frustration. One neatly solved by plumbum, and so I'm definitely with OP it's use makes code measurably less shit.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: