nvdv / vprof

Visual profiler for Python
BSD 2-Clause "Simplified" License
3.95k stars 154 forks source link

Running on a package #19

Closed The-Compiler closed 8 years ago

The-Compiler commented 8 years ago

It'd be nice if it was easily possible to run this on a package, similar to python -m foo.

nvdv commented 8 years ago

Actually you can run this on a package, you just need to compile Javascript first: npm run build && npm run compress && python -m vprof m testscript.py

The-Compiler commented 8 years ago

Huh? That'd still launch a single script rather than a package, which means imports like from mypackage.foo import bar won't work.

nvdv commented 8 years ago

There's __main__.py file in vprof module and that's why python -m vprof works. Imports such as from vprof import profile_wrappers also work. Could you clarify this feature request in details? Thanks!

The-Compiler commented 8 years ago

I don't want to run vprof as a package, I want to run it on a package.

In other words, you mention vprof cm testscript.py in the readme. However, I have a package (with a __main__.py and many modules) I want to run vprof on, so I'd like to do something like vprof cm -m mypackage.

Does that make sense? :smile:

nvdv commented 8 years ago

I got it. Thanks!

nvdv commented 8 years ago

Hi, I've added experimental support for profiling packages. I haven't updated README.md yet, but vprof cmh my_package should work now. my_package can be installed package or path to package in filesystem.

The-Compiler commented 8 years ago

Thank you! I have some trouble getting npm/browserify running on the Debian machine I'm on currently, but I'll try later on Archlinux.

akvadrako commented 3 years ago

So this only works on packages? What about running modules, like python's -m ?