Skip to content

Add config option plots.auto_open #7159

Merged
daavoo merged 2 commits into
mainfrom
live-open-flag
Jan 3, 2022
Merged

Add config option plots.auto_open #7159
daavoo merged 2 commits into
mainfrom
live-open-flag

Conversation

@daavoo
Copy link
Copy Markdown
Contributor

@daavoo daavoo commented Dec 15, 2021

Closes #6091
Closes treeverse/dvclive#201

dvc.org P.R: treeverse/dvc.org#3101

@daavoo daavoo requested a review from a team as a code owner December 15, 2021 19:19
@daavoo daavoo added product: VSCode Integration with VSCode extension p1-important Important, aka current backlog of things to do labels Dec 15, 2021
@daavoo daavoo self-assigned this Dec 15, 2021
@daavoo daavoo changed the title Add config option plots.auto_open and ENV var DVCLIVE_OPEN Add config option plots.auto_open and env var DVCLIVE_OPEN Dec 15, 2021
Copy link
Copy Markdown
Contributor

@rogermparent rogermparent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tried this out in CLI and VSCode and successfully didn't have a tab open! As long as the code is good on the DVC end, merging this will fix our issue.

Comment thread dvc/command/plots.py Outdated
Comment thread dvc/repo/live.py Outdated
@jorgeorpinel
Copy link
Copy Markdown
Contributor

Hi. Q: where will DVCLIVE_OPEN be documented? Is there a PR in dvc.org? Thanks

@daavoo
Copy link
Copy Markdown
Contributor Author

daavoo commented Dec 17, 2021

Not sure if It should be documented at all as It is intended for VSCode internal usage

@shcheklein
Copy link
Copy Markdown
Contributor

Thanks @daavoo for taking care of this quick! Should we name things in a similar way - DVC_PLOTS_AUTO_OPEN ?

Comment thread dvc/repo/live.py Outdated
Comment thread dvc/repo/live.py Outdated

webbrowser_open(index_path)
auto_open = out.repo.config["plots"].get("auto_open", False)
if auto_open and int(os.environ.get(DVCLIVE_OPEN, "1")):
Copy link
Copy Markdown
Collaborator

@skshetry skshetry Dec 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plots.auto_open vs DVCLIVE_OPEN are not symmetrical though. WDYT of DVC_PLOTS_OPEN since we have plans to do that automatically (#6091)?

Copy link
Copy Markdown
Collaborator

@skshetry skshetry Dec 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thought: should we be more general and implement core.no_browser/ui.no_browser and DVC_NO_BROWSER instead?

Copy link
Copy Markdown
Collaborator

@skshetry skshetry Dec 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's a thing to discuss in #6091 than here.

Copy link
Copy Markdown
Contributor Author

@daavoo daavoo Dec 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The env var, in this case, was added for VSCode specifically, not really for end-user usage (however, it's not clear yet if they will need it or not). The asymmetry was intentional in order to allow VSCode to reactive DVCLIVE HTML even if user had plots.auto_open enabled.

Regardless, if going for the general approach, is there a reason to have both a dvc config field and an env var for the same purpose?

Copy link
Copy Markdown
Contributor

@rogermparent rogermparent Dec 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've decided on the VSCode end, at least for now, to respect the user's configuration for browser opening. Something like DVC_NO_BROWSER could be useful in the future for us and/or other integrations should we get user requests for a VSCode extension feature to disable browser opening outside the config.

Having an env var alongside the config option could help us do so in a more temporary manner, but if dvc config is able to do the same with some sort of invocation option then the env var would be rendered redundant.

@daavoo daavoo force-pushed the live-open-flag branch 2 times, most recently from f24ea56 to 3387ac1 Compare December 20, 2021 19:48
@daavoo daavoo changed the title Add config option plots.auto_open and env var DVCLIVE_OPEN Add config option plots.auto_open Dec 20, 2021
Option for enabling automatically open webbrowser with generated html.
Defaults False.

Closes #6091
@daavoo daavoo merged commit 760c8fc into main Jan 3, 2022
@daavoo daavoo deleted the live-open-flag branch January 3, 2022 15:07
@efiop efiop added the feature is a feature label Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature is a feature p1-important Important, aka current backlog of things to do product: VSCode Integration with VSCode extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dvc: Add option to disable automatic open plots diff/show: configure --open flag

8 participants