You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Breaking:parser_mode now defaults to json instead of yaml, so behavior no longer depends on whether pyyaml happens to be installed (it became optional in pyyaml is no longer a required dependency #970). YAML configs and YAML-syntax values, e.g. --list=[a, b] or --flag=yes, now fail unless parser_mode="yaml" is given.
New parser_mode setting in set_parsing_settings and JSONARGPARSE_PARSER_MODE environment variable, so users can restore YAML globally without changing every parser.
The jsonnet parser mode no longer silently accepts YAML.
The v5 migration guide explains the change and how to keep YAML, including parser_mode="yaml", which also works in v4.
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (632b1dd) to head (4119ba3).
✅ All tests successful. No failed tests found.
Changes the default parser mode to JSON, adds a global setting and environment override, and makes basic-type and Jsonnet loading follow the selected mode.
Updates documentation and the v5 migration guide for the breaking default change.
Adds mode-specific tests, although the suite-wide YAML override leaves the new default insufficiently exercised.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Parser has explicit mode?] -->|Yes| B[Use explicit mode]
A -->|No| C{Environment override?}
C -->|Yes| D[Use JSONARGPARSE_PARSER_MODE]
C -->|No| E[Use global setting: JSON by default]
B --> F[Load values and configs]
D --> F
E --> F
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
enhancementNew feature or requestrefactorImprovements to the quality of the code
2 participants
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.
What does this PR do?
parser_modenow defaults tojsoninstead ofyaml, so behavior no longer depends on whetherpyyamlhappens to be installed (it became optional in pyyaml is no longer a required dependency #970). YAML configs and YAML-syntax values, e.g.--list=[a, b]or--flag=yes, now fail unlessparser_mode="yaml"is given.parser_modesetting inset_parsing_settingsandJSONARGPARSE_PARSER_MODEenvironment variable, so users can restore YAML globally without changing every parser.jsonnetparser mode no longer silently accepts YAML.parser_mode="yaml", which also works in v4.Before submitting