METK-171: Add API for mars key parsing#236
Draft
caraghbiner wants to merge 7 commits into
Draft
Conversation
caraghbiner
force-pushed
the
feature/enriched-mars-api
branch
from
July 17, 2026 17:43
7b2f87b to
6fd9d0b
Compare
caraghbiner
force-pushed
the
feature/enriched-mars-api
branch
from
July 17, 2026 17:46
6fd9d0b to
659f222
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #236 +/- ##
===========================================
- Coverage 50.51% 50.40% -0.11%
===========================================
Files 385 385
Lines 15438 15471 +33
Branches 1307 1312 +5
===========================================
Hits 7798 7798
- Misses 7640 7673 +33 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Param needs most of the marsrequest machinery because it is highly context dependent and requires two passes. I don't think this is worth exposing directly to pymetkit so it will just use a marsrequest
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.
Description
There are a number of environments (e.g. in the CDS, in polytope, ...) where python scripts need the expansion functionality of metkit (e.g. 1/to/10/by/1 --> [1,2,3,...]). This functionality is currently only exposed via a MarsRequest object in pymetkit. However, in these environments requests have keys that are not part of the mars language (e.g. "feature" in polytope), but yet still need to do a mars-like expansion on a subset of the keys.
As a result, everyone just implements their own python version of how they think the language expansion behaves for the subset of keys they are interested in. This results in lots of code duplication and wasted effort. It is also likely to be incorrect for the more complex keys: it is not really possible to do a python implementation from scratch of context dependent expansions (e.g. param) without using the metkit language yaml files. These files also update frequently, so other implementations quickly become stale.
I propose we add some plumbing in (py)metkit to support the expansion of mars keys without requiring the construction of a mars request object.
Contributor Declaration
By opening this pull request, I affirm the following: