Skip to content

METK-171: Add API for mars key parsing#236

Draft
caraghbiner wants to merge 7 commits into
developfrom
feature/enriched-mars-api
Draft

METK-171: Add API for mars key parsing#236
caraghbiner wants to merge 7 commits into
developfrom
feature/enriched-mars-api

Conversation

@caraghbiner

Copy link
Copy Markdown
Member

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:

  • All authors agree to the Contributor License Agreement.
  • The code follows the project's coding standards.
  • I have performed self-review and added comments where needed.
  • I have added or updated tests to verify that my changes are effective and functional.
  • I have run all existing tests and confirmed they pass.

@caraghbiner
caraghbiner force-pushed the feature/enriched-mars-api branch from 7b2f87b to 6fd9d0b Compare July 17, 2026 17:43
@caraghbiner
caraghbiner force-pushed the feature/enriched-mars-api branch from 6fd9d0b to 659f222 Compare July 17, 2026 17:46
@codecov-commenter

codecov-commenter commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.40%. Comparing base (97063d8) to head (e6341f9).

Files with missing lines Patch % Lines
src/metkit/mars/MarsLanguage.cc 0.00% 17 Missing ⚠️
src/metkit/api/metkit_c.cc 0.00% 14 Missing ⚠️
src/metkit/mars/MarsExpansion.cc 0.00% 2 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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
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