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

plots: image converter return absolute paths #7664

Merged
merged 1 commit into from May 4, 2022

Conversation

pared
Copy link
Contributor

@pared pared commented Apr 29, 2022

Thank you for the contribution - we'll try to review it as soon as possible. πŸ™

In #7549 we rolled back to the behavior of writing images, instead of encoding them. I made it DVC's responsibility to provide proper path to the renderer. However, without knowing where we create HTML, it is impossible to do that. We need to modify dvc-render to be able to evaluate relative paths of the images. Marking as WIP, as we need a fix on dvc-render side first and a release.

Comment on lines -70 to 76
assert (
os.path.join("dvc_plots", "static", f"{version}_{filename}")
in html_content
)
assert os.path.join("static", f"{version}_{filename}") in html_content

# there should be no absolute paths in produced HTML
assert str(tmp_dir) not in html_content
# TODO uncomment once dvc-render is adjusted
# assert str(tmp_dir) not in html_content
assert (
tmp_dir / "dvc_plots" / "static" / f"{version}_{filename}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this belong to integration tests? HTML content is not really used by vscode, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is true, currently I implemented html checks to make sure everything works as expected. In further work we will need to split that. I am thinking how to do it without too much test duplication.

@pared pared changed the title [WIP] plots: image converter return absolute paths plots: image converter return absolute paths May 4, 2022
@pared
Copy link
Contributor Author

pared commented May 4, 2022

As iterative/dvc-render#39 takes a bit of discussion I think we should merge this one. Even if its not desired behavior, it works at least, contrary to the current main. We will fix relpaths once dvc-render counterpart gets released.
cc @daavoo

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.

None yet

2 participants