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

Improve notebook detection #5201

Merged
merged 2 commits into from Jul 5, 2023
Merged

Improve notebook detection #5201

merged 2 commits into from Jul 5, 2023

Conversation

Hoxbro
Copy link
Member

@Hoxbro Hoxbro commented Jul 3, 2023

Fixes #5200

As far as I can see, VSCODE_CWD is always set in a VSCode Notebook.

@codecov
Copy link

codecov bot commented Jul 3, 2023

Codecov Report

Merging #5201 (5c43e28) into main (eaf5853) will increase coverage by 11.01%.
The diff coverage is 0.00%.

❗ Current head 5c43e28 differs from pull request most recent head e2767bb. Consider uploading reports for the commit e2767bb to get more accurate results

@@             Coverage Diff             @@
##             main    #5201       +/-   ##
===========================================
+ Coverage   72.62%   83.64%   +11.01%     
===========================================
  Files         274      274               
  Lines       39583    39591        +8     
===========================================
+ Hits        28749    33116     +4367     
+ Misses      10834     6475     -4359     
Flag Coverage Δ
ui-tests 39.51% <0.00%> (?)
unitexamples-tests 73.77% <0.00%> (+1.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
panel/config.py 76.41% <0.00%> (+7.87%) ⬆️

... and 73 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Hoxbro
Copy link
Member Author

Hoxbro commented Jul 4, 2023

@philippjfr, when we are in the part of the codebase, I was thinking if we should change the colab detection from:

try:
    import google.colab  # noqa
    config.comms = "colab"
    return
except ImportError:
    pass

To:

if "google.colab" in sys.modules:
    config.comms = "colab"
    return

Timing in a normal notebook:
image

Check in a colab notebook:
image

@philippjfr
Copy link
Member

Yep makes sense, didn't know it was automatically imported.

@Hoxbro Hoxbro changed the title Improve VS Code notebook detection Improve notebook detection Jul 4, 2023
@philippjfr philippjfr merged commit f21ab9b into main Jul 5, 2023
1 check passed
@philippjfr philippjfr deleted the improve_vscode_detection branch July 5, 2023 11:29
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.

Automatic vscode detection is not always working
2 participants