Profile a script
CPU profile sorted by cumulative time
python3 -m cProfile -s cumulative script.py | head -30
- tool
- python15 commands
More python commands
-
python3 -m pdb script.pyRun a script under the Python debugger
-
breakpoint() # Python 3.7+ — drops into pdb at this lineBuilt-in breakpoint() works like import pdb; pdb.set_trace()
-
pytest -x -v --tb=short tests/Stop at the first failure, with verbose output and short tracebacks
-
python3 -m py_compile script.py && echo OKOnly compile to bytecode, to catch syntax errors
-
black --check --diff . && black .Show the diff first, then apply Black formatting