Scripts logo pyinstrument: scripts

1 2 3 4 5 6 7

To use pyinstrument, make sure that pyinstrument is installed first.

python -m pip install pyinstrument

Once installed, pyinstrument can be run from the command line to show pretty tree-based visualisations on where your python script spends the most time.

If you'd be used to calling a program via:

python folder/script.py

Then you can have pyinstrument profile that script via;

pyinstrument folder/script.py

Pretty

In case you didn't know, pyinstrument is using rich under the hood to make such pretty interactive visuals. If you're curious to learn how, you may enjoy our tutorial on trees in rich.