Python CLI Tricks That Don’t Require Any Code Whatsoever

Start webserver, open browser, parse JSON, compress files and much more with Python commandline tools and without opening a single file or writing any code

Martin Heinz
7 min readOct 17, 2022
Generated with Stable Diffusion

Out-of-the-box, Python standard library ships with many great libraries some of which provide commandline interface (CLI), allowing us to do many cool things directly from terminal without needing to even open a .py file.

This includes things like starting a webserver, opening a browser, parsing JSON files, benchmarking programs and many more, all of which we will explore in this article.

Benchmarking

The one Python module you likely already saw being used directly from commandline is timeit. It can be used for simple benchmarking:

In many cases, single line of code is not enough to perform a test — if you need to do some setup, then you can use -s option to - for example - create variables or import modules. This option…

--

--