Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing source in Jupyter notebook/lab #93

Merged
merged 1 commit into from
Sep 5, 2021
Merged

Fix missing source in Jupyter notebook/lab #93

merged 1 commit into from
Sep 5, 2021

Conversation

ChrisAichinger
Copy link
Contributor

Profiling in Jupyter Notebooks or Jupyter Lab with recent ipykernel
versions (>= 6), resulted in the following error message:

Could not find file /tmp/ipykernel_8298/3242911465.py
Are you sure you are running this program from the same
directory that you ran the profiler from?
Continuing without the function's contents.

The timing output then does not include source code lines.

The problem is that line_profiler tries to determine when it runs in
side IPython/Jupyter using a simple heuristic based on the reported
filename. New ipykernel versions changed this filename pattern and broke
our test.

As a quick fix, amend the test so it continues working. Longer term, a
more robust solution would be desirable.

Fixes #86

Profiling in Jupyter Notebooks or Jupyter Lab with recent ipykernel
versions (>= 6), resulted in the following error message:

    Could not find file /tmp/ipykernel_8298/3242911465.py
    Are you sure you are running this program from the same
    directory that you ran the profiler from?
    Continuing without the function's contents.

The timing output then does not include source code lines.

The problem is that line_profiler tries to determine when it runs in
side IPython/Jupyter using a simple heuristic based on the reported
filename. New ipykernel versions changed this filename pattern and broke
our test.

As a quick fix, amend the test so it continues working. Longer term, a
more robust solution would be desirable.

Fixes #86
@codecov
Copy link

codecov bot commented Sep 2, 2021

Codecov Report

Merging #93 (e7e1abb) into master (d4836b7) will increase coverage by 0.09%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #93      +/-   ##
==========================================
+ Coverage   52.74%   52.84%   +0.09%     
==========================================
  Files           5        5              
  Lines         419      422       +3     
  Branches       60       60              
==========================================
+ Hits          221      223       +2     
- Misses        178      179       +1     
  Partials       20       20              
Impacted Files Coverage Δ
line_profiler/line_profiler.py 42.42% <50.00%> (+0.27%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d4836b7...e7e1abb. Read the comment docs.

@Erotemic Erotemic merged commit e7cace1 into pyutils:master Sep 5, 2021
Erotemic added a commit that referenced this pull request Sep 7, 2021
Erotemic added a commit that referenced this pull request Sep 7, 2021
* Add CHANGELOG note related to #93

* Bump to version 3.3.1
Erotemic added a commit that referenced this pull request Sep 24, 2021
* Add CHANGELOG note related to #93

* Bump to version 3.3.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No source is visible in line_profiler output in Jupyter notebook
2 participants