Skip to content
This repository has been archived by the owner on Jun 9, 2020. It is now read-only.

Allow user to add directories to the Python path. #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dalewis
Copy link

@dalewis dalewis commented Aug 4, 2016

This allows us to profile scripts that are located within a package hierarchy.
Multiple directories may be added, via either the short argument -p or long
argument --pythonpath.

Usage:
kernprof <other options> -p dir1 [-p dir2 -p dir3 ...] script_to_profile.py

Ex:
Script foo/bar/script.py, with directory structure:

base/
|---foo/
    |---__init__.py
    |---bar/
        |---__init__.py
        |---script.py

Script can normally be run via python -m foo.bar.script or python foo/bar/script.py.

To run kernprof:
From base:

kernprof -l -v -p . foo/bar/script.py

This allows us to profile scripts that are located within a package hierarchy.
Multiple directories may be added, via either the short argument -p or long
argument --pythonpath.

Usage:
kernprof <other options> -p dir1 [-p dir2 -p dir3 ...] script_to_profile.py

Ex:
Script foo/bar/script.py, with directory structure:

base/
|---foo/
    |---__init__.py
    |---bar/
        |---__init__.py
        |---script.py

Script can normally be run via python -m foo.bar.script or python foo/bar/script.py.

To run kernprof:
From base: kernprof -l -v -p . foo/bar/script.py
@dalewis
Copy link
Author

dalewis commented Aug 4, 2016

Hey Rob,

line_profiler/kernprof is great! Just came across it last week. I made a small change to allow profiling scripts located in package hierarchies. Let me know what you think.

-Darren

@caethan caethan added the being considered Actively being investigated by maintainers for merging label Feb 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
being considered Actively being investigated by maintainers for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants