line_profiler
line_profiler copied to clipboard
Make module profiling easier
I want to run kernprof from the root of my package source like kernprof -l mylib\test\test.py -v but then any import within test.py fails, e.g. import mylib.foo because the current working dir is not added to the python path when running kernprof, which in my opinion should happen by default. The workaround is to temporarily hack sys.path within this specific module, but that's annoying.
I'm using the same workaround, but would this simpler command-line trick work?
PYTHONPATH=$PWD:$PYTHONPATH kernprof -lv mylib\test\test.py