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

Add config option plots.auto_open #7159

Merged
merged 2 commits into from
Jan 3, 2022
Merged

Add config option plots.auto_open #7159

merged 2 commits into from
Jan 3, 2022

Conversation

daavoo
Copy link
Contributor

@daavoo daavoo commented Dec 15, 2021

Closes #6091
Closes iterative/dvclive#201

dvc.org P.R: iterative/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
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.

dvc/command/plots.py Outdated Show resolved Hide resolved
dvc/repo/live.py Outdated Show resolved Hide resolved
@jorgeorpinel
Copy link
Contributor

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

@daavoo
Copy link
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
Member

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

dvc/repo/live.py Outdated Show resolved Hide resolved
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
Member

@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
Member

@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
Member

@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
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
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
No open projects
Archived in project
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