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

highlight user frames in interactive debugger #1421

Merged
merged 1 commit into from Dec 10, 2018
Merged

Conversation

@davidism
Copy link
Member

@davidism davidism commented Dec 10, 2018

Adds a new library CSS class to frames that look like they are from built-in or installed library code. This removes the blue background from those frames, emphasizing the frames that come from the user's code. Clicking to expand the line will add the background color back so that it's easy to pick out from the surrounding context.

screen shot 2018-12-10 at 12 24 30

screen shot 2018-12-10 at 12 25 04

Library frames are detected by comparing their filename to all paths returned by sysconfig.get_paths(). Other projects like tbvaccine check against the current working directory, but for the common setup where the env is a directory under the project, this would identify installed packages as user code.

If the detection thinks all or no frames are library code, it reverts to the old behavior of highlighting everything. This could happen, for example, if a project is installed in its virtualenv without using -e.

Unfortunately, virtualenv ships its own site.py which does not set these correctly, so code that was not installed to the env's site-packages dir (built-ins, system packages) will look like user code. This doesn't happen with venv or tools like Poetry and Pipenv which use it.

Due to the issue with virtualenv, which is what tox uses, I couldn't think of a reliable test for this, so this remains "untested" for now, although manual testing showed it working as expected.

Closes #1165

@davidism davidism added this to the 0.15 milestone Dec 10, 2018
@davidism davidism merged commit 1e61b7d into master Dec 10, 2018
1 check passed
@davidism davidism deleted the debugger-highlight branch Dec 10, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

1 participant