Conversation
This allows us to extend stats with less boilerplate code. i.e. DEFAULT_PARAMS becomes optional.
Signal that these are raw, unpartitioned kwargs consumed once by the layer during construction. This is a preparatory rename for the layer creation refactor.
…_geom - Move stat and position instantiation from geom.__init__ to layer.from_geom, making geom construction side-effect-free - Replace module-level _verify_layer_arguments with layer._verify_arguments staticmethod, removing the redundant kwargs parameter - Delete dead geom._verify_arguments method - Update tests to call .to_layer() where stat/position access is needed
- Add layer.from_stat staticmethod that creates a geom from the stat then delegates to layer.from_geom - Simplify stat.to_layer to just call layer.from_stat(self)
- Change layer.setup_data to set geom.params["stat_params"] instead of flat-merging stat.params into geom.params, preventing namespace collisions and keeping geom params clean - Update geom_dotplot to access stat params via params["stat_params"]
Accept strings, classes, or instances for geom/stat/position in layer.__init__. Add _resolve_geom, _resolve_stat, _resolve_position module-level helpers. Simplify from_geom/from_stat to thin delegates.
…yer resolvers These factory methods are now inlined into the layer.py resolver functions (_resolve_stat, _resolve_position, layer.from_stat), centralising all component resolution in one place. Tests updated to exercise resolution through the layer API.
… and layer(stat=...) Extract _lookup_stat for pure spec→class/instance resolution and add stat-first detection in layer.__init__ so that layer(stat="bin") derives the correct geom. This makes from_geom, from_stat, and to_layer redundant — all callers now use layer() directly.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1041 +/- ##
==========================================
- Coverage 86.83% 86.79% -0.04%
==========================================
Files 203 203
Lines 13806 13812 +6
Branches 1702 1706 +4
==========================================
Hits 11988 11988
- Misses 1273 1275 +2
- Partials 545 549 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
API Changes
Removed
geom.to_layer(),stat.to_layer(),annotate.to_layer(),layer.from_geom()andlayer.from_stat(). Uselayer(geom=...)andlayer(stat=...)directly.The constructor now handles both geom-first and stat-first creation. When only a
statis provided, the geom is automatically derived from the stat's default.