Align CLI arguments with reader APIs for full parameter consistency#321
Merged
LucaMarconato merged 11 commits intomainfrom May 5, 2026
Merged
Conversation
…m_hd, and macsima Co-authored-by: LucaMarconato <2664412+LucaMarconato@users.noreply.github.com>
Co-authored-by: LucaMarconato <2664412+LucaMarconato@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Align CLI Arguments in __main__.py with API Specifications in Readers
Align CLI arguments with reader APIs for full parameter consistency
Sep 5, 2025
- Move import json to top-level and introduce _parse_json_param helper to eliminate repeated try/except blocks in every wrapper function - Add missing --imread-kwargs option to macsima_wrapper (the reader exposes it but the CLI did not) - Fix trailing whitespace in multi-line function signatures from the PR Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #321 +/- ##
==========================================
+ Coverage 61.85% 62.77% +0.91%
==========================================
Files 26 26
Lines 3138 3175 +37
==========================================
+ Hits 1941 1993 +52
+ Misses 1197 1182 -15
🚀 New features to boost your workflow:
|
CLI fixes (all matching current reader APIs): - xenium: remove deprecated --n-jobs, fix cells_as_circles default False, add --gex-only (default True) - visium_hd: add missing type=bool to --load-segmentations-only, add --gex-only (default False) - seqfish: change --rois from IntRange to str (reader uses list[str]), change --raster-models-scale-factors from float to int Tests (test_xenium.py, no real data required): - test_cli_xenium_invalid_json_rejected: all three kwargs options reject malformed JSON with a clear error message - test_cli_xenium_valid_json_forwarded: valid JSON is parsed and forwarded to the reader as a dict (verified via mock) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
tests/test_cli_alignment.py checks that every non-path parameter of each reader function is exposed by its CLI wrapper. The test runs in CI on every PR so future reader additions automatically turn the suite red until __main__.py catches up. Design notes: - Uses inspect.signature on wrapper.callback (Click replaces the function with a Command object; the Python signature lives in .callback) - _READER_EXCEPTIONS allows intentionally hidden params (currently: xenium n_jobs, which is deprecated and has no effect) - No real data required; pure import + introspection Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Check both directions (symmetric difference): reader params absent from CLI *and* CLI params absent from reader (stale options) - Expand docstring to explain what the test does NOT cover (types, defaults) and include a ready-to-run claude command for manual type/default audits Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
LucaMarconato
approved these changes
May 5, 2026
Member
|
The CLI is now brought back in sync with the readers. In particular this PR adds all those remaining missing arguments to the CLI that required a JSON representation (dict arguments) and also adds a test to help spotting divergences between the readers and the CLI. |
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.
Fixes inconsistencies between the CLI interface (
__main__.py) and reader APIs by ensuring all reader parameters are available through the command line interface.Problem
The CLI exposed only a subset of reader API parameters, creating inconsistency between programmatic and command-line interfaces. Users could not access full reader functionality via CLI, limiting automation and advanced use cases.
Specific issues identified:
raster_models_scale_factorsin seqfish,var_names_make_uniquein visium readers)imread_kwargs,image_models_kwargs,labels_models_kwargs) not accessible via CLISolution
1. Added Missing Parameters
Fixed real parameter mismatches where non-kwargs parameters were missing from CLI:
--raster-models-scale-factorsparameter--var-names-make-uniqueparameter--var-names-make-uniqueparameter--parsing-styleparameter with proper choice validation2. JSON String Support for kwargs Parameters
Implemented JSON string parsing for complex
Mapping[str, Any]parameters that cannot be directly represented as CLI arguments:All kwargs parameters now support JSON string input with:
'{}'maintains existing CLI behavior3. Comprehensive Coverage
Updated all 15 reader CLI commands to achieve 100% parameter alignment:
codex,cosmx,curio,dbit,iss,macsima,mcmicro,merscope,seqfish,steinbock,stereoseq,visium,visium-hd,xeniumExamples
Backward Compatibility
All existing CLI usage patterns continue to work unchanged. The new parameters are optional with sensible defaults that preserve current behavior.
Testing
The CLI now provides complete functional parity with all reader APIs while maintaining usability for common use cases.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.