Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a @pattern decorator to support rule composability by allowing reusable transformation patterns to be defined and documented. The decorator enables functions to be wrapped with metadata about their parameters, encouraging modular design in rule definitions.
Key Changes:
- Added
@patterndecorator andPatternclass for composable rule components - Implemented documentation support via
params_docparameter - Provided example usage showing pattern integration with rules
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #115 +/- ##
==========================================
+ Coverage 78.92% 82.74% +3.82%
==========================================
Files 35 51 +16
Lines 1362 1971 +609
==========================================
+ Hits 1075 1631 +556
- Misses 287 340 +53 ☔ View full report in Codecov by Sentry. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: fritz-astronomer <80706212+fritz-astronomer@users.noreply.github.com>
|
@pgagnon @odaneau-astro @aoelvp-astro It'd be an opt-in addition |
|
Was any other syntax other than |
|
@pgagnon here's a very recent example of it getting towards 'unwieldy'. In my recent ruleset development seems like a I don't think I mind it, as is, but don't have any particular ideas for other implementations. Am certainly open to suggestions, or a point towards a similar coding pattern that can be emulated or used as inspiration. My only other thoughts were maybe around things like structures in docstrings, or some introspection-majick to automatically find and compose things together. I do think the problem is worth solving: ending up with a solid and structured summary of which input produced which output - which can be fairly dynamic 🤔 |
Why
I have been having conversations with folks along the lines of "rule composability".
I am considering the idea that things like
task_common_argscould be a "Pattern", which I think fits with how creating translations is discussed.Ultimately the complexity of a translation is in the "number of patterns" that need to be covered.
WDYT?
Caveats
This addition doesn't enforce any structure of the pattern, nor that an
@ruleuses them(you can have a gigantic rule that does a million things - they are supposed to do one thing, but not required to)
This just gives an opportunity to document inputs/outputs and encourages composability and reuse
Example
Before / After
Is fairly similar - as this addition is just an indication / hint towards structure.