pythoncprofile

Using cProfile on application with entry point


I know cProfile can be used like this

python -m cProfile script.py

But suppose I have a packaged application (pip-installable) with an entry_point defined in setup.py, such that I can call the application from the terminal, without explicitly using any .py file. How can I use cProfile in that case?


Solution

  • I found the answer in this thread:

    python -m cProfile $(which application)