Skip to content

Cleanup make MacroElements from Elements - #2066

Merged
hansthen merged 4 commits into
python-visualization:mainfrom
hansthen:cleanup_element
Jan 4, 2025
Merged

hansthen merged 4 commits into
python-visualization:mainfrom
hansthen:cleanup_element

Conversation

@hansthen

@hansthen hansthen commented Jan 1, 2025

Copy link
Copy Markdown
Collaborator

This change involves several classes that require being added to a Figure. Since these classes follow the render semantics of a MacroElement it makes more sense to make them also inherit from MacroElement.

Excluded from this change is actually making use of the template mechanics of the MacroElement.

This change involves several classes that require being added to a
Figure. Since these classes follow the `render` semantics of a
MacroElement it makes more sense to make them also inherit from
MacroElement.

Excluded from this change is actually making use of
the template mechanics of the MacroElement.
@hansthen
hansthen requested a review from Conengmo January 1, 2025 13:47

@Conengmo Conengmo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice change! It's interesting how these classes are not exactly MacroElements either, since they don't use macros. But at least we get the return type of the render method correct.

I added two comments about the todo comments, after addressing those this should be good to merge.

Comment thread folium/features.py Outdated
Comment thread folium/features.py Outdated
hansthen and others added 2 commits January 1, 2025 20:20
Co-authored-by: Frank Anema <33519926+Conengmo@users.noreply.github.com>
Co-authored-by: Frank Anema <33519926+Conengmo@users.noreply.github.com>
@hansthen

hansthen commented Jan 1, 2025

Copy link
Copy Markdown
Collaborator Author

Before you merge this, do you have some example usage of the Vega and VegaLite classes? I wanted to run some tests for myself, but I could not find anything in the documentation (or in the doc-string).

@hansthen
hansthen requested a review from Conengmo January 1, 2025 19:24
@Conengmo

Conengmo commented Jan 1, 2025

Copy link
Copy Markdown
Member

We have examples for both classes in the Popup documentation: https://python-visualization.github.io/folium/latest/user_guide/ui_elements/popups.html#Vega-chart-in-popup

@Conengmo Conengmo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code looks good! If you manually check these classes still work as expected, go ahead and merge it 👍 I'm less available next few days.

@hansthen
hansthen merged commit 3a2afb1 into python-visualization:main Jan 4, 2025
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.

2 participants

Sponsor
SponsoredKunjungi sekarang
Promo