Draft
Conversation
Replace stdlib argparse with jsonargparse for enhanced argument parsing, using a compatibility layer in _argparse.py. Key changes: - Add _argparse.py: ArgumentParser subclass bridging Borg's argparse patterns with jsonargparse (type+action handling, namespace flattening) - Switch from add_subparsers/add_parser to add_subcommands/add_subcommand across all command modules - Replace set_defaults(func=) with COMMAND_DISPATCH table and get_func() - Highlander: handle type conversion internally (BoundHighlander pattern) since jsonargparse forbids combining type= and action= - TypeConvertingAction: wrapper for standard actions (append, store) that need type conversion - Pattern actions: handle None paths/patterns from jsonargparse - flatten_namespace: convert jsonargparse's nested subcommand namespaces to the flat namespace Borg's command handlers expect - Update argparsing_test.py for dispatch table (get_func vs args.func) Implemented by AI: Claude Opus 4.6 (Thinking).
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #9336 +/- ##
==========================================
+ Coverage 75.93% 76.15% +0.22%
==========================================
Files 86 86
Lines 14780 14902 +122
Branches 2202 2226 +24
==========================================
+ Hits 11223 11349 +126
+ Misses 2880 2870 -10
- Partials 677 683 +6 ☔ View full report in Codecov by Sentry. |
ThomasWaldmann
commented
Feb 15, 2026
Refactor jap_wrapper.py to explicitly define a custom ArgumentGroup class instead of relying on jsonargparse's dynamic subclass generation. jsonargparse attempts to create an ArgumentGroup subclass that inherits add_argument from the parser by reading source code with inspect.getsource(). This mechanism is fragile and can fail on Windows CI (and likely frozen binaries), causing it to fall back to the standard ArgumentGroup. When falling back, the standard ArgumentGroup lacks our add_argument wrapper that strips type when action is present. This results in ValueError: Providing both type and action not allowed because jsonargparse forbids this combination. By explicitly defining ArgumentGroup with our mixin and setting self._group_class, we ensure our compatibility logic is always used.
Open
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.
WIP