You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's a good idea. I'll support a PR adding the -m argument to kernprof.
However, the new docs outline a new alternative that is often easier than using kernprof. As of 4.1.x you can now just from line_profiler import profile and by default the decorator does nothing. But if you set the environment variable LINE_PROFILE=1 or pass a --line-profile on sys.argv the profile decorators will enable and dump a profile of your code at the end of running. This is how I test my modules when I use python -m.
Activity
shouldsee commentedon Aug 24, 2023
Is this supported yet?
Erotemic commentedon Aug 25, 2023
It's a good idea. I'll support a PR adding the
-margument to kernprof.However, the new docs outline a new alternative that is often easier than using kernprof. As of 4.1.x you can now just
from line_profiler import profileand by default the decorator does nothing. But if you set the environment variableLINE_PROFILE=1or pass a--line-profileon sys.argv theprofiledecorators will enable and dump a profile of your code at the end of running. This is how I test my modules when I usepython -m.You can also enable it programatically: e.g.
and
profilehas a configuration dictionary you can use to modify behavior. I'd also accept PRs if this config doesn't have everything necessary.