Toolchest for Python shell scripters
Banish growing bash scripts
Every once in a while we end up with a shell-script that’s grown out of it’s suit. At this point we need some tools to transition it into a language such as Python. Therefor I’ve collected a small set of tools for achieving these results.
The personal favourite
wlan0 Link encap:Ethernet HWaddr 00:00:00:00:00:00 inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0 inet6…amoffat.github.io
A personal favourite of mine is sh, I’ve used it several times and is very happy with it.
For the docker pirate
ShutIt | Automation framework for programmersianmiell.github.io
ShutIt focuses on docker (container) build. In addition to their own extensive documentation there’s also a great tutorial on how to build shell scripts in python with ShutIt over at Learn x in y Minutes.
For the make hacker
Pythonic task management & command exectutionwww.pyinvoke.org
Tony Narlock (author of The Tao of tmux) describes invoke to me as “Invoke wraps subprocess commands into Makefile-like tasks”, I think that sums it up the purpose perfectly.
Following that advice Mr Narlock also recommended Fabric “Same as invoke, but catered to remote subprocess commands over SSH”, do check it out if you’re going to work with remote servers.
Fabric is a Python (2.5-2.7) library and command-line tool for streamlining the use of SSH for application deployment…www.fabfile.org
And when you’re at it don’t forget to checkout his libvcs tool which enables easy git (and other vcs systems) automation via python.
Not enough?
Don’t worry I added two great guides on python shell scripting and as a bonus I threw in a fun CLI UI library.
http://nvie.com/posts/writing-a-cli-in-python-in-under-60-seconds/
https://python-guide-pt-br.readthedocs.io/en/latest/scenarios/cli/