-
Notifications
You must be signed in to change notification settings - Fork 311
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
Expose all settings in ydata-profiling ProfileReport #2921
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ pandas | |
plotly | ||
pygments | ||
ydata-profiling | ||
lxml |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -14,6 +14,7 @@ | |||||||
TableRenderer, | ||||||||
) | ||||||||
from PIL import Image | ||||||||
from lxml import html | ||||||||
|
||||||||
from flytekit.types.file import FlyteFile, JPEGImageFile, PNGImageFile | ||||||||
|
||||||||
|
@@ -31,10 +32,29 @@ | |||||||
) | ||||||||
|
||||||||
|
||||||||
def test_frame_profiling_renderer(): | ||||||||
renderer = FrameProfilingRenderer() | ||||||||
assert "Pandas Profiling Report" in renderer.to_html(df).title() | ||||||||
@pytest.mark.parametrize( | ||||||||
"title, kwargs, expected_title", | ||||||||
[ | ||||||||
(None, {}, "Pandas Profiling Report"), | ||||||||
("Custom Title", {}, "Custom Title"), | ||||||||
(None, {"title": "from-kwargs"}, "from-kwargs"), | ||||||||
(None, {"minimal": False}, "Pandas Profiling Report"), | ||||||||
("Custom Title", {"minimal": False}, "Custom Title"), | ||||||||
(None, {"minimal": True}, "Pandas Profiling Report"), | ||||||||
("Custom Title", {"minimal": True}, "Custom Title"), | ||||||||
("Custom Title", { "minimal": True}, "Custom Title"), | ||||||||
Comment on lines
+44
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider removing duplicate test case
Consider removing the duplicate test case Code suggestionCheck the AI-generated fix before applying
Suggested change
Code Review Run #3d8b84 Is this a valid issue, or was it incorrectly flagged by the Agent?
|
||||||||
("Custom Title", {"missing_diagrams":{"heatmap": False}}, "Custom Title"), | ||||||||
# Test that title in kwargs takes precedence over title in constructor | ||||||||
("title in constructor", {"title": "title in kwargs"}, "title in kwargs") | ||||||||
], | ||||||||
) | ||||||||
def test_frame_profiling_renderer(title, kwargs, expected_title): | ||||||||
fpr_kwargs = {"title": title} if title else {} | ||||||||
renderer = FrameProfilingRenderer(**fpr_kwargs) | ||||||||
profile_report = renderer.to_html(df, **kwargs) | ||||||||
|
||||||||
tree = html.fromstring(profile_report) | ||||||||
assert expected_title == tree.xpath('//title/text()')[0] | ||||||||
|
||||||||
def test_markdown_renderer(): | ||||||||
md_text = "#Hello Flyte\n##Hello Flyte\n###Hello Flyte" | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API wise, there are now two places to set kwargs for
ydata_profiling.ProfileReport
, in__init__
(for only title) and into_html
.By looking at the
Renderable
protocol, it looks like the design was to have configuration passed in__init__
, because theto_html
to restricted to one input:https://github.com/flyteorg/flytekit/blob/master/flytekit/deck/renderer.py#L17-L23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I saw that, but I don't think we quite adhering to the protocol everywhere, for example the pandera renderer.
This is an indication that all invocations of
to_html
happen in user-code, so the protocol is "just" a convention? Can we make it more strict (and if so, I think we should add kwargs to the protocol).