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 base64 support for markdown #129

Merged
merged 3 commits into from
May 15, 2023
Merged

add base64 support for markdown #129

merged 3 commits into from
May 15, 2023

Conversation

dberenbaum
Copy link
Contributor

@dberenbaum dberenbaum commented May 5, 2023

To support markdown reports in notebooks without needing to source from external files

@codecov-commenter
Copy link

codecov-commenter commented May 5, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +1.02 🎉

Comparison is base (8aab523) 94.49% compared to head (e9fc84c) 95.51%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #129      +/-   ##
==========================================
+ Coverage   94.49%   95.51%   +1.02%     
==========================================
  Files          19       19              
  Lines         726      758      +32     
  Branches       76      120      +44     
==========================================
+ Hits          686      724      +38     
+ Misses         27       19       -8     
- Partials       13       15       +2     
Impacted Files Coverage Δ
src/dvc_render/image.py 100.00% <100.00%> (ø)
src/dvc_render/markdown.py 81.08% <100.00%> (+20.47%) ⬆️
src/dvc_render/vega.py 86.90% <100.00%> (+1.37%) ⬆️
tests/test_image.py 100.00% <100.00%> (ø)
tests/test_markdown.py 100.00% <100.00%> (ø)
tests/test_vega.py 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -120,5 +121,8 @@ def generate_markdown(self, report_path=None) -> str:
plt.savefig(output_file)
plt.close()

return f"\n![{self.name}]({output_file.relative_to(report_folder)})"
Copy link
Contributor

@daavoo daavoo May 10, 2023

Choose a reason for hiding this comment

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

I think this actually breaks the integration with CML like:

https://github.com/iterative/example-get-started-experiments/blob/main/.github/workflows/run-studio-experiment.yml#L61

Because there is some logic that resolves the image paths and uses CML upload under the hood.

Could we make the base64 optional, default to the previous behavior, and explicitly enable it on the DVCLive side only for notebooks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to make the file optional and to return the markdown string if no file is passed. PTAL.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updating dvclive to use this option. Should work the same as before as long as a file is passed.

@dberenbaum dberenbaum force-pushed the base64-markdown branch 2 times, most recently from 393fcf8 to 510d294 Compare May 13, 2023 03:00
Comment on lines +71 to +73
return output_file

return document.embed()
Copy link
Contributor

Choose a reason for hiding this comment

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

Like this change, makes also sense for HTML

@dberenbaum dberenbaum merged commit fef2941 into main May 15, 2023
@dberenbaum dberenbaum deleted the base64-markdown branch May 15, 2023 16:35
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.

3 participants