Repository navigation
Conversation
TopoJson takes a tooltip but no popup, so per-feature popups need a separate GeoJsonPopup(...).add_to(topojson) call. Accept popup the same way tooltip is accepted: a GeoJsonPopup or Popup is added as a child and a string is wrapped in a Popup. Closes python-visualization#1461 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1461.
The gap
GeoJsontakes bothtooltip=andpopup=, butTopoJsononly takestooltip=. Passingpopup=fails withTypeError: TopoJson.__init__() got an unexpected keyword argument 'popup'. That's what the issue asks for: TopoJson renders faster than GeoJson for the reporter's data, but they couldn't find a way to attach per-feature popups.Per-feature popups on a TopoJson already work at render time.
GeoJsonDetail.render()handles aTopoJsonparent, and since #2250test_topojson_non_collection_geometry_detailcoversGeoJsonPopup(...).add_to(topojson). So the only missing piece is the constructor argument.The change
TopoJson.__init__getspopup=None, handled the same way it already handlestooltip:GeoJsonPopuporPopupis added as a childPopupThe docstring documents the new parameter. Nothing changes when
popupisn't passed.Tests
test_topojson_popup, parametrized over aGeoJsonPopup, aPopupand a plain string. It checks that the popup is the layer's child and that the rendered map binds it with<topojson>.bindPopup(. All three cases fail onmainwith theTypeErrorabove and pass with this change.pytest tests(without selenium/playwright/snapshots): 397 passed. 4 failed, and the same 4 fail on unmodifiedmainin my environment: three PNG-export tests (ImportError) andtest_timedynamic_geo_json(geodatasetsnot installed).black --checkandruff checkpass on the touched files.🤖 Generated with Claude Code