Update dependency jsonargparse to v4.52.0 - #368
Open
renovate[bot] wants to merge 1 commit into
Open
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
renovate
Bot
force-pushed
the
renovate/jsonargparse-4.x
branch
from
March 26, 2025 12:32
a058b87 to
5be4bf2
Compare
renovate
Bot
force-pushed
the
renovate/jsonargparse-4.x
branch
from
April 29, 2025 06:49
5be4bf2 to
77f6cea
Compare
renovate
Bot
force-pushed
the
renovate/jsonargparse-4.x
branch
from
May 16, 2025 07:03
77f6cea to
6a8d425
Compare
renovate
Bot
force-pushed
the
renovate/jsonargparse-4.x
branch
2 times, most recently
from
July 24, 2025 08:41
85dba8c to
869c2bb
Compare
renovate
Bot
force-pushed
the
renovate/jsonargparse-4.x
branch
from
August 6, 2025 05:22
869c2bb to
f6d6484
Compare
renovate
Bot
force-pushed
the
renovate/jsonargparse-4.x
branch
from
September 7, 2025 23:06
f6d6484 to
ee6ad13
Compare
renovate
Bot
force-pushed
the
renovate/jsonargparse-4.x
branch
from
October 14, 2025 09:01
ee6ad13 to
2e2388c
Compare
renovate
Bot
force-pushed
the
renovate/jsonargparse-4.x
branch
from
November 12, 2025 03:37
2e2388c to
05c120c
Compare
renovate
Bot
force-pushed
the
renovate/jsonargparse-4.x
branch
from
November 25, 2025 18:52
05c120c to
3932f5b
Compare
renovate
Bot
force-pushed
the
renovate/jsonargparse-4.x
branch
from
December 26, 2025 17:34
3932f5b to
0a03bec
Compare
renovate
Bot
force-pushed
the
renovate/jsonargparse-4.x
branch
from
February 2, 2026 13:57
0a03bec to
9671f08
Compare
renovate
Bot
force-pushed
the
renovate/jsonargparse-4.x
branch
from
March 13, 2026 15:51
9671f08 to
70c2f58
Compare
renovate
Bot
force-pushed
the
renovate/jsonargparse-4.x
branch
from
April 10, 2026 10:10
70c2f58 to
acceced
Compare
renovate
Bot
force-pushed
the
renovate/jsonargparse-4.x
branch
from
May 15, 2026 09:11
acceced to
e058cd8
Compare
renovate
Bot
force-pushed
the
renovate/jsonargparse-4.x
branch
from
July 22, 2026 06:36
e058cd8 to
94f2380
Compare
renovate
Bot
force-pushed
the
renovate/jsonargparse-4.x
branch
from
August 20, 2026 06:29
94f2380 to
b06d747
Compare
renovate
Bot
force-pushed
the
renovate/jsonargparse-4.x
branch
from
September 1, 2026 13:41
b06d747 to
5f9117f
Compare
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.
This PR contains the following updates:
==4.36.0→==4.52.0Release Notes
mauvilsa/jsonargparse (jsonargparse)
v4.52.0Compare Source
Added
^^^^^
import_path_denylistandimport_path_allowlistsettings inset_parsing_settingsthat limit which import paths a value is allowed toname, so that configs from an untrusted source can't reach arbitrary code. A
set of standard library paths that give code execution, e.g.
os,subprocessandpickle, is denied by default, see:ref:
untrusted-configs(#​959 <https://github.com/mauvilsa/jsonargparse/pull/959>,#​960 <https://github.com/mauvilsa/jsonargparse/pull/960>).tuple,set,frozensetor mapping, e.g.dict[str, SomeBaseClass], now have a--*.helpoption, and subclassesin any container are now included in the known subclasses shown in the help
(
#​960 <https://github.com/mauvilsa/jsonargparse/pull/960>__).jsonschemacompletion type, i.e.--print_completion=jsonschemaandparser.get_completion_script("jsonschema"), which generates a JSON Schema(draft 2020-12) that describes the config files accepted by the parser,
including descriptions from docstrings, defaults, required keys, type
restrictions, the types that the plain argparse actions give and one entry per
known subclass of subclass types. Configs can point to a schema with a
$schemakey, which is ignored when parsing. This feature isexperimental, so the details of the generated schema might change in non-major
releases (
#​961 <https://github.com/mauvilsa/jsonargparse/pull/961>__).__call__is now also implemented by afunction with a compatible signature, so the import path of a function is
accepted as value, see :ref:
type-hints(#​963 <https://github.com/mauvilsa/jsonargparse/pull/963>__).fail_untyped="all"for the add signature methods andauto_cli,which raises an exception for all parameters that don't have a type
annotation, not only the required ones (
#​965 <https://github.com/mauvilsa/jsonargparse/pull/965>__).NamedTupleas a type. The value is an object with the fieldsas keys or an array of positional values, parsing gives an instance of the
named tuple and dumping gives an object. It has a
--*.helpoption thatshows the accepted fields, is accepted by
add_class_argumentsand workssubscripted when generic, see :ref:
type-hints(#​967 <https://github.com/mauvilsa/jsonargparse/pull/967>__).TypedDictnow acceptsReadOnlyfor its keys (#​967 <https://github.com/mauvilsa/jsonargparse/pull/967>__).NewTypeandLiteralStringas types. Previously they werenot validated, i.e. any value was accepted. Now a
NewTypeis validated asthe supertype it stands for and a
LiteralStringas astr, in bothcases the help showing the name as in the source code, see :ref:
type-hints(
#​967 <https://github.com/mauvilsa/jsonargparse/pull/967>__).Fixed
^^^^^
Callabletypes that have a class as return type, e.g.Callable[..., Model], and instance factory protocols, accepted any class whose instancesare callable and any function, instead of only subclasses of the return type
and functions that return it (
#​959 <https://github.com/mauvilsa/jsonargparse/pull/959>__).__call__that takes no parametersinstantiated the class instead of giving a factory (
#​959 <https://github.com/mauvilsa/jsonargparse/pull/959>__).Literalwith arguments that are attributes of the class in whose body themethod is defined failed to resolve when annotations are postponed (
#​960 <https://github.com/mauvilsa/jsonargparse/pull/960>__).setandfrozensetof a class type failed to parse because subclassspecs are not hashable (
#​960 <https://github.com/mauvilsa/jsonargparse/pull/960>__).--*.helpoption gave wrong choices when the classtype is nested in a container or optional, e.g.
builtins.NoneTypeforOptional[list[SomeBaseClass]](#​960 <https://github.com/mauvilsa/jsonargparse/pull/960>__).time.localtime, were rejected forCallabletypes with a class returntype, even when a stub file gives the return type. Now with the stubs resolver
the return type from the
.pyiis used (#​963 <https://github.com/mauvilsa/jsonargparse/pull/963>__).typingsequence aliases, i.e.List,Sequence,MutableSequence,Iterable,Collection,Container,ReversibleandDeque, raisedAttributeError: __args__, which madeclasses that have one in their signature, e.g.
torch.utils.data.DataLoader, impossible to add (#​963 <https://github.com/mauvilsa/jsonargparse/pull/963>__).typing.Hashableandtyping.Sizedwere not supported, while thecollections.abcspelling of the same types was. A bare one didn't validateand a composed one, e.g.
Optional[Hashable], raisedUnsupported type hint(#​963 <https://github.com/mauvilsa/jsonargparse/pull/963>__).Callabledefault that can't be imported back, was silently dumped as anon-importable
<locals>import path. Now the default is kept as the objectand dumping it gives the not serializable message and a warning (
#​966 <https://github.com/mauvilsa/jsonargparse/pull/966>__).register_typewere ignored when the type issubscripted, e.g.
os.PathLike[str]for a registeredPathLike. Now theregistration of the unsubscripted type is used (
#​966 <https://github.com/mauvilsa/jsonargparse/pull/966>__).TypeAliasType, e.g.Alias[int]fortype Alias[T] = list[T], raisedUnsupported type hint. Unsubscripted, itstype parameters now also stand for their default, constraints or bound, the
same as any other
TypeVar(#​967 <https://github.com/mauvilsa/jsonargparse/pull/967>__).Namespace.as_dictdid not convert the namespaces nested in adictorlistthat also holds values which are not namespaces, e.g. aTypedDictwith one key of a class type and another of a simple type. Dumping such a
config as json failed with
Object of type Namespace is not JSON serializable(#​967 <https://github.com/mauvilsa/jsonargparse/pull/967>__).add_class_argumentsgiven a subscripted generic class, e.g.SomeClass[int], did not instantiate it, giving aNamespaceinstead ofan instance (
#​967 <https://github.com/mauvilsa/jsonargparse/pull/967>__).Unionof a class type and an instance factory for it, e.g.Union[Optimizer, Callable[[Iterable], Optimizer]], accepted no value atall. The class subtype added as sub-default a placeholder for the parameter
that the factory receives when called, which made the value invalid for itself
and for the factory subtype (
#​968 <https://github.com/mauvilsa/jsonargparse/pull/968>__).shtab-bashcompletion script printedtput: command not foundonevery completion in environments that don't have
tput, e.g. somecontainers. Now the colors of the completion messages are resolved once when
the script is sourced and errors from
tputare ignored, giving uncoloredmessages when it is not available (
#​968 <https://github.com/mauvilsa/jsonargparse/pull/968>__).Changed
^^^^^^^
read, and corrected in the places where it did not describe what the code does
(
#​964 <https://github.com/mauvilsa/jsonargparse/pull/964>__).migrate-v5guide that describes what needs to be changed to migratefrom v4 to v5 (
#​964 <https://github.com/mauvilsa/jsonargparse/pull/964>__).Untypedinstead of
Any, so that the help makes evident that the value is notvalidated. A parameter that has a default gets
Union[<type of the default>, Untyped]as before, now also withfail_untyped=False, which previouslygave
Any(#​965 <https://github.com/mauvilsa/jsonargparse/pull/965>__).signature parameter is not what the signature says: no type annotation, a
parameter skipped because its name starts with
_, aNonedefault thatmakes the type optional, a
NotRequiredparameter without a default and aparameter that is the target of a link (
#​965 <https://github.com/mauvilsa/jsonargparse/pull/965>__).register_typeno longer fails when the type is already registered. The newregistration now replaces the previous one and a debug log informs about it,
naming the module of each registration. This way a new type registered by
jsonargparse doesn't break code that already registers it. The previous
behavior is available with
fail_already_registered=True(#​966 <https://github.com/mauvilsa/jsonargparse/pull/966>__).Deprecated
^^^^^^^^^^
class_pathofsubprocess.Popen, currently only emit a deprecation warning and the importproceeds. From v5.0.0 they will fail. Give a value to
import_path_denylistor
import_path_allowlistinset_parsing_settings, an empty listincluded, to get the future behavior now and silence the warning (
#​959 <https://github.com/mauvilsa/jsonargparse/pull/959>__).v4.51.0Compare Source
Added
^^^^^
validate_subclass_spec_in_anysetting inset_parsing_settingsso thatwhen a value looks like a subclass spec but is not a valid one, the parsing
fails instead of silently ignoring it. Applies to types that accept any value,
i.e.
Any,object,Unvalidated<...>and dicts that don't validatetheir values, e.g.
dict[str, Any]. For dicts the spec is only validated,since the value is kept as a dict. When disabled (the default), a debug log
now informs about the ignored invalid subclass spec (
#​938 <https://github.com/mauvilsa/jsonargparse/pull/938>,#​953 <https://github.com/mauvilsa/jsonargparse/pull/953>,#​958 <https://github.com/mauvilsa/jsonargparse/pull/958>__).paths to sub-config files, instead of this only being supported for the value
of an entire argument (
#​940 <https://github.com/mauvilsa/jsonargparse/pull/940>__).shtabcompletion scripts now include file and directory completions forarguments typed as pydantic's
FilePathandDirectoryPath(#​943 <https://github.com/mauvilsa/jsonargparse/pull/943>__).type[SomeTypedDict]such that the given class is accepted when itis structurally compatible, i.e. it has all the keys of the expected
TypedDict, with the same types and requiredness (#​945 <https://github.com/mauvilsa/jsonargparse/pull/945>__).types.ModuleTypeas a type. The value is the import path of amodule, which on parse is validated to be importable, and on
instantiateis replaced by the imported module object (
#​945 <https://github.com/mauvilsa/jsonargparse/pull/945>__).types.UnionTypeandtypes.GenericAliasas types, often seen inthird party libraries in unions such as
type | UnionType | dict. The valueis a string with a type expression, e.g.
"int | str"and"list[int]"(
#​945 <https://github.com/mauvilsa/jsonargparse/pull/945>__).Collection,ContainerandReversible, validated as a list,and
AbstractSet, validated as a set (#​950 <https://github.com/mauvilsa/jsonargparse/pull/950>__).shtabcompletion scripts now include the fields of a dataclass-like typethat is not added as a group, e.g.
Optional[SomeDataclass](#​952 <https://github.com/mauvilsa/jsonargparse/pull/952>__).TypeVarused as the type itself, i.e. not only as the subtype of atype[...], is now replaced by what it stands for: its PEP 696default,its constraints or its bound, also when given as a forward reference.
Previously the value was accepted without any validation, see
:ref:
generic-types(#​953 <https://github.com/mauvilsa/jsonargparse/pull/953>,#​958 <https://github.com/mauvilsa/jsonargparse/pull/958>).TypedDictnow have a--*.helpoption that showsthe keys that are accepted, their types and their descriptions. It receives no
value, unless the
TypedDictis in a union with other types that have ahelp, in which case the value is the name of the typed dict (
#​956 <https://github.com/mauvilsa/jsonargparse/pull/956>__).add_class_argumentsnow accepts aTypedDict, adding one argument perkey, analogous to a dataclass.
instantiategives the corresponding dict(
#​956 <https://github.com/mauvilsa/jsonargparse/pull/956>__).TypedDictkeys taken from its docstring are now shown inthe help of
**kwargs: Unpack[SomeTypedDict]parameters (#​956 <https://github.com/mauvilsa/jsonargparse/pull/956>__).shtabcompletion scripts now include the keys of aTypedDictargument, e.g.
--data.key, and the values that these keys accept (#​956 <https://github.com/mauvilsa/jsonargparse/pull/956>__).aliasandvalidation_aliasand attrs'aliasare nowaccepted as option and config keys, so that a parser accepts the same names as
the class itself. The parsed namespace and dumps use the name that the class
accepts, see :ref:
parameter-aliases(#​956 <https://github.com/mauvilsa/jsonargparse/pull/956>__).TypedDict, e.g.SomeDict[int], and aTypedDictthat inherits from one, e.g.class SubDict(SomeDict[int]),previously unsupported types. The type arguments are substituted into the keys
annotated with a
TypeVar, see :ref:type-hints(#​958 <https://github.com/mauvilsa/jsonargparse/pull/958>__).Fixed
^^^^^
TypeErrorwhen adding arguments for a class that has a parameter that hasa default and is annotated with a non-
@runtime_checkableProtocoltype(
#​935 <https://github.com/mauvilsa/jsonargparse/pull/935>__).TypedDictkeys inherited from a base defined in a different module notresolving the types only imported in the
TYPE_CHECKINGblock of thatmodule (
#​936 <https://github.com/mauvilsa/jsonargparse/pull/936>__).dumpwithwith_comments=True, i.e.--print_config=comments, notadding any comment for the
init_argsof subclasses and for the fields ofdataclass-like types that are not added as a group, including when nested in
lists and dicts (
#​939 <https://github.com/mauvilsa/jsonargparse/pull/939>__).shtabbash completion scripts not escaping choices and type messages, suchthat a value containing a single quote, e.g. a
Literaltype, produced ascript with invalid syntax (
#​947 <https://github.com/mauvilsa/jsonargparse/pull/947>__).shtabcompletions failing withshtab>=1.9.1due to a changein how it quotes the elements of the generated bash arrays. The completion
scripts themselves were not affected (
#​947 <https://github.com/mauvilsa/jsonargparse/pull/947>__).fail_untyped=Truefailing for mandatory parameters that do have a type,with an error that says the parameter "does not specify a type". Now it only
fails for parameters that have no type at all (
#​948 <https://github.com/mauvilsa/jsonargparse/pull/948>__).list[HttpUrl], being skipped (#​948 <https://github.com/mauvilsa/jsonargparse/pull/948>__).dump, and thus--print_config, failing when the value of anAnyorUnvalidated<...>typed argument is of a type that the config format doesnot represent, e.g. a class instance, or a
setwhen the format is json.Now a type is derived from the value and used to serialize it, class instances
are serialized as an import path or as a message that says that it was not
serializable, and a warning is raised when the dumped value does not
round-trip, see :ref:
unvalidated-types(#​948 <https://github.com/mauvilsa/jsonargparse/pull/948>,#​956 <https://github.com/mauvilsa/jsonargparse/pull/956>).AssertionErrorwithout a message when adding an argument typed as asubscripted user defined generic class, e.g.
Optional[Strategy[T]](#​950 <https://github.com/mauvilsa/jsonargparse/pull/950>__).Callabletype accepting values that are neither callable nor an importpath, e.g. a list, which in a union such as
Union[Callable, list[Callable]]prevented the list items from being resolved (#​950 <https://github.com/mauvilsa/jsonargparse/pull/950>__).type[T]never validating. Now theTypeVaris replaced by its bound,its constraints, or
objectwhen it has neither, so that the help showswhat is accepted, e.g.
type[object](#​950 <https://github.com/mauvilsa/jsonargparse/pull/950>__).PEP 604 union, e.g.
p: int | Nonein aGeneric[T]class added asMyClass[int](#​950 <https://github.com/mauvilsa/jsonargparse/pull/950>__).attributes, e.g. the attribute docstrings of a pydantic model declared in a
base model not being shown in the help. Now the entire method resolution order
is searched (
#​951 <https://github.com/mauvilsa/jsonargparse/pull/951>__).__init__docstring of a base class from another package, most notably pydantic models
without a docstring getting
Create a new model by parsing and validating input data from keyword arguments. Now the nearest class docstring in themethod resolution order is used, skipping base classes that only provide
machinery (
#​951 <https://github.com/mauvilsa/jsonargparse/pull/951>__).class_pathof a subclass when it isnot added as a group, e.g.
Optional[SomeDataclass], even though subclassesare disabled for these types by default. The error now says how to enable
subclass support for the type, see :ref:
subclasses-disabled(#​952 <https://github.com/mauvilsa/jsonargparse/pull/952>__).group, e.g.
Optional[SomeDataclass],list[SomeDataclass]anddict[str, SomeDataclass], not accepting a path to a sub-config file evenwhen added with
sub_configs=True, failing with e.g.No module named 'data'. Also, the path of a loaded sub-config was not kept, sosavewithmultifile=Truedid not write it back to its own file. See:ref:
sub-config-files(#​952 <https://github.com/mauvilsa/jsonargparse/pull/952>__).argument of a subcommand, e.g.
APP_SUB__DATA='{"p1": 2}'failing withNot a valid subclass of ...(#​952 <https://github.com/mauvilsa/jsonargparse/pull/952>__).dump, and thus--print_config, not being able to serialize a valuethat was given as an import path to an instance, unless the instance happened
to be defined in the module of its class. Instead of the import path it wrote
a message saying that the instance was not serializable, making the dump not
round-trippable. Now the import path that a value was resolved from is
remembered and dumped back (
#​953 <https://github.com/mauvilsa/jsonargparse/pull/953>__).--print_configas the mask**********,silently making the mask the actual secret. Now parsing the mask as a
SecretStr, both jsonargparse's and pydantic's, fails (#​953 <https://github.com/mauvilsa/jsonargparse/pull/953>__).Protocolnever being implementable, both unsubscripted andsubscripted, e.g.
ProtoandProto[int]. Now the type arguments aresubstituted and a
TypeVarthat remains matches any type, as static typecheckers do, see :ref:
type-hints(#​953 <https://github.com/mauvilsa/jsonargparse/pull/953>,#​958 <https://github.com/mauvilsa/jsonargparse/pull/958>).__new__, e.g.decorators that mark a class as deprecated or experimental. The parameters
were resolved from the wrapper instead of from
__init__(#​953 <https://github.com/mauvilsa/jsonargparse/pull/953>__).stripping of module names was done with a regex over the entire type string.
Affected floats, literals and ellipsis (
#​954 <https://github.com/mauvilsa/jsonargparse/pull/954>__).Nonein a PEP 604 union shown as is in the help, e.g.date | None,instead of as
date | null, which is what parsing requires (#​954 <https://github.com/mauvilsa/jsonargparse/pull/954>__).dumpwithskip_default=True, i.e.--print_config=skip_default,failing with
AttributeError: 'NoneType' object has no attribute 'get'whena subclass spec is given for an argument whose default is
None, e.g. anOptional[SomeClass]parameter. Now theclass_pathis kept in the dumpand only the
init_argsthat are defaults are removed (#​954 <https://github.com/mauvilsa/jsonargparse/pull/954>__).**kwargsdisappearing when the value isthen forwarded explicitly as a keyword, e.g.
x = kwargs.pop("x", None)followed by
super().__init__(x=x, **kwargs)(#​954 <https://github.com/mauvilsa/jsonargparse/pull/954>__).shtabbash completion not redrawing the prompt after printing the typeguidance message when there are zero completions, leaving the cursor on an
empty line, observed since bash 5.3 (
#​954 <https://github.com/mauvilsa/jsonargparse/pull/954>__).--print_configto--print_%schange (
#​955 <https://github.com/mauvilsa/jsonargparse/pull/955>__).shtabcompletions of**kwargs: Unpack[SomeTypedDict]parametersshowing
NotRequired[...]as the expected type and not completing thevalues of the keys that are not required (
#​956 <https://github.com/mauvilsa/jsonargparse/pull/956>__).body of its class. Now the namespace of the class that defines the method is
used as locals (
#​956 <https://github.com/mauvilsa/jsonargparse/pull/956>__).class_pathof an abstract class being accepted for a class typedargument, only to fail on
instantiatewithTypeError: Can't instantiate abstract class. Now the parsing fails withExpected an instantiatable class, but ... is abstract, also when theclass_pathis implicit, i.e.only init args given, and when the class is given by name (
#​956 <https://github.com/mauvilsa/jsonargparse/pull/956>__).alias and don't accept the attribute name, i.e. models and dataclasses without
populate_by_name. Now the alias is the accepted name, see:ref:
parameter-aliases(#​956 <https://github.com/mauvilsa/jsonargparse/pull/956>__).__init__parameter name differs from the attributename, i.e. an explicit
aliasor a private attribute, failing toinstantiate with
TypeError: got an unexpected keyword argumentor notbeing configurable at all (
#​956 <https://github.com/mauvilsa/jsonargparse/pull/956>__).RuntimeErrorwhen giving a value for aTypedDictkeyannotated with a
TypeVar, e.g. a genericTypedDict, see:ref:
generic-types(#​958 <https://github.com/mauvilsa/jsonargparse/pull/958>__).type[Any]rejecting every value, instead of accepting any class astypewithout an argument does (#​958 <https://github.com/mauvilsa/jsonargparse/pull/958>__).description and the parameter descriptions were missing in the help (
#​958 <https://github.com/mauvilsa/jsonargparse/pull/958>__).Changed
^^^^^^^
accepted, instead of the parameter being skipped and the key failing to parse.
Only the parts of the type that can't be validated accept any value, e.g. a
list[SomeType]still requires a list. These parts are shown in the help asUnvalidated<...>and a debug log states the reason. See the newdocumentation section :ref:
unvalidated-types(#​936 <https://github.com/mauvilsa/jsonargparse/pull/936>,#​944 <https://github.com/mauvilsa/jsonargparse/pull/944>,#​948 <https://github.com/mauvilsa/jsonargparse/pull/948>,#​958 <https://github.com/mauvilsa/jsonargparse/pull/958>).RequiredandNotRequiredgiven as the type of an argument are nolonger shown in the help. Now they must agree with whether the argument is
required, otherwise adding the argument fails (
#​937 <https://github.com/mauvilsa/jsonargparse/pull/937>__).Protocolis now decided by checking that itsmethods can be called in all the ways that the protocol methods can be called,
similar to what static type checkers do, instead of requiring the parameter
lists to be identical. This accepts more implementations than before.
Parameter and return types must still match exactly, except when the protocol
has no annotation or
Any(#​941 <https://github.com/mauvilsa/jsonargparse/pull/941>__).jsonargparse.Namespacenow raises aValueErrorwhen adding the arguments, instead of the parameter beingsilently skipped.
Namespaceis only intended for parsing results (#​948 <https://github.com/mauvilsa/jsonargparse/pull/948>__).Unionare now sorted when the argument is added, insteadof only while parsing, so the type shown in the help tells the order in which
the subtypes are attempted. The subtypes that accept any value, i.e.
Any,objectand the ones that can't be validated, are now moved to the end, sothat they no longer prevent the remaining subtypes from being attempted. See
the new documentation section :ref:
union-types(#​949 <https://github.com/mauvilsa/jsonargparse/pull/949>__).the
class_pathof the type itself, e.g.{"class_path": "Data", "init_args": {...}}, instead of failing withGroup 'data' does not accept option 'init_args....'. Dataclass-like types now accept the same valueswhether or not they are added as a group, see :ref:
subclasses-disabled(
#​952 <https://github.com/mauvilsa/jsonargparse/pull/952>__).inherit from
abc.ABC, now have subclass support enabled by default.Previously such a type was unusable, since the
class_pathof animplementation was rejected and giving its fields directly failed on
instantiate. See :ref:subclasses-disabled(#​956 <https://github.com/mauvilsa/jsonargparse/pull/956>__).objectas a type is now handled exactly likeAny, since in standardtyping every value is an instance of it (
#​958 <https://github.com/mauvilsa/jsonargparse/pull/958>__).Deprecated
^^^^^^^^^^
value, i.e.
Any,objectorUnvalidated<...>, is deprecated. Fromv5.0.0 the subclass spec will be kept as is, so that the code that receives it
decides whether to instantiate it. The new
instantiate_subclass_spec_in_anysetting inset_parsing_settingsallows getting the future behavior now,
False, or keeping the current one,True. Enabling it is discouraged since it means that a config is able toinstantiate any class, which can be a security risk (
#​955 <https://github.com/mauvilsa/jsonargparse/pull/955>__).v4.50.0Compare Source
Added
^^^^^
FromConfigMixin.from_configwithconfig_read_mode_fsspec_enabled=Truenow supports fsspec config loading including the resolving of relative paths
(
#​918 <https://github.com/mauvilsa/jsonargparse/pull/918>__)..Unsetsentinel andunset_sentinelsetting inset_parsing_settingsto distinguish between arguments not provided andthose explicitly set to
null(#​909 <https://github.com/mauvilsa/jsonargparse/pull/909>__).Fixed
^^^^^
class_pathfor subclass disabled typesto correctly support defaults from union of dataclasses (
#​921 <https://github.com/mauvilsa/jsonargparse/pull/921>__).parse_optionals_as_positionals=Trueandunrecognized non-positional arguments (
#​922 <https://github.com/mauvilsa/jsonargparse/pull/922>__).parameter is keyword-only (declared after
*) (#​933 <https://github.com/mauvilsa/jsonargparse/pull/933>__).**kwargs: Unpack[TypedDict]where theTypedDicthastotal=Falseincorrectly made the non-Requiredkeys required (#​934 <https://github.com/mauvilsa/jsonargparse/pull/934>__).TypedDictrequiredness of keys not correctly resolved when usingpostponed annotations (
from __future__ import annotations) together withRequired/NotRequiredor totality-flipping inheritance, affecting bothUnpackandtype=cases (#​934 <https://github.com/mauvilsa/jsonargparse/pull/934>__).TypedDictkeys annotated with types only imported inTYPE_CHECKINGblocks not being resolved (
#​934 <https://github.com/mauvilsa/jsonargparse/pull/934>__).Changed
^^^^^^^
3.10 (
#​916 <https://github.com/mauvilsa/jsonargparse/pull/916>__).(
#​926 <https://github.com/mauvilsa/jsonargparse/pull/926>__).Deprecated
^^^^^^^^^^
skip_noneparameter ofArgumentParser'sdump,save, andvalidatewas deprecated and will be removed in v5.0.0. Useskip_unsetinstead (
#​909 <https://github.com/mauvilsa/jsonargparse/pull/909>__).skip_nullflag for--print_configwas deprecated and will be removedin v5.0.0. Use
skip_unsetinstead (#​909 <https://github.com/mauvilsa/jsonargparse/pull/909>__).is deprecated and will be removed in v5.0.0. Provide an explicit subcommand
instead (
#​923 <https://github.com/mauvilsa/jsonargparse/pull/923>__).ArgumentParser.merge_configis deprecated and will be removed in v5.0.0.There is no replacement since it is considered internal (
#​925 <https://github.com/mauvilsa/jsonargparse/pull/925>__).Optionaltype parameters without a default and required parameterswithout a type annotation when using
fail_untyped=Falseare currently setto optional with default
None. In v5.0.0 they will be required. Warningsvisible with
JSONARGPARSE_DEPRECATION_WARNINGS=all(#​930 <https://github.com/mauvilsa/jsonargparse/pull/930>__).v4.49.0Compare Source
Added
^^^^^
DequeandFrozenSetin type hints (#​905 <https://github.com/mauvilsa/jsonargparse/pull/905>__).Fixed
^^^^^
an error showing the config chain instead of recursing indefinitely (
#​910 <https://github.com/mauvilsa/jsonargparse/pull/910>__).Changed
^^^^^^^
ArgumentParserclass instead ofinternal mixin classes (
#​901 <https://github.com/mauvilsa/jsonargparse/pull/901>__).(
#​903 <https://github.com/mauvilsa/jsonargparse/pull/903>__).Deprecated
^^^^^^^^^^
auto_cli(calling without acomponentsargument) was deprecated and will be removed in v5.0.0. Pass components
explicitly; explicit is better than implicit (
#​895 <https://github.com/mauvilsa/jsonargparse/pull/895>__).instantiate_classesis deprecated and will be removed in v5.0.0. Insteaduse
instantiate(#​896 <https://github.com/mauvilsa/jsonargparse/pull/896>__).ArgumentParser.add_instantiatoris deprecated and will be removed inv5.0.0. Use the global function
jsonargparse.add_instantiatorinstead(
#​899 <https://github.com/mauvilsa/jsonargparse/pull/899>__).Namespace.get_sorted_keysandNamespace.get_value_and_parentaredeprecated and will be removed in v5.0.0. Instead run
.keys()and thensort or get the parent and leaf separately. (
#​900 <https://github.com/mauvilsa/jsonargparse/pull/900>__).Path.get_contentis deprecated and will be removed in v5.0.0. Instead usePath.read_textfor text andPath.openfor binary content (#​906 <https://github.com/mauvilsa/jsonargparse/pull/906>__).enable_pathparameter ofArgumentParser.add_argumentwas deprecatedand will be removed in v5.0.0. Use
sub_configsinstead, which isconsistent with the
sub_configsparameter of the signature methods,ArgumentParser.add_class_argumentsetc. (#​907 <https://github.com/mauvilsa/jsonargparse/pull/907>__).enable_pathparameter ofActionJsonSchemawas deprecated and will beremoved in v5.0.0. Use
sub_configinstead (#​907 <https://github.com/mauvilsa/jsonargparse/pull/907>__).v4.48.0Compare Source
Added
^^^^^
module.submodule.function(**kwargs)(#​878 <https://github.com/mauvilsa/jsonargparse/pull/878>__).register_typenow supportsTypeAliasType(python 3.12+) in additionto classes, and registered aliases no longer add subclass help actions
(
#​875 <https://github.com/mauvilsa/jsonargparse/pull/875>__).add_class_argumentsskip support for callable return class parameters(
#​882 <https://github.com/mauvilsa/jsonargparse/pull/882>__).FromConfigMixinis now an official public API feature(
#​884 <https://github.com/mauvilsa/jsonargparse/pull/884>__).Fixed
^^^^^
list["ForwardReferenced"]) when the forward-referenced type is notimported in the using module (
#​871 <https://github.com/mauvilsa/jsonargparse/pull/871>__).auto_clino longer fails when a single function, a class__init__, ora function/class in a list/dict of components has a parameter named
config(#​873 <https://github.com/mauvilsa/jsonargparse/pull/873>__).Changed
^^^^^^^
#​876 <https://github.com/mauvilsa/jsonargparse/pull/876>__).class_from_functionandlazy_instanceare now located injsonargparse.typingwhile the previous import locations are kept forcompatibility (
#​877 <https://github.com/mauvilsa/jsonargparse/pull/877>__).jsonargparse. Also the explicit deviations from argparse are documented (
#​881 <https://github.com/mauvilsa/jsonargparse/pull/881>__).#​883 <https://github.com/mauvilsa/jsonargparse/pull/883>__).reconploggerintegration (#​886 <https://github.com/mauvilsa/jsonargparse/pull/886>__).speed up test suite (
#​887 <https://github.com/mauvilsa/jsonargparse/pull/887>__).requiredattributes to improve compatibility with third-partyargparse extensions (
#​890 <https://github.com/mauvilsa/jsonargparse/pull/890>,#​893 <https://github.com/mauvilsa/jsonargparse/pull/893>).v4.47.0Compare Source
Added
^^^^^
shtabbash typehint completions forUnionandLiteral:choices for unions that also accept open values now require a prefix to be
completed, and literal booleans/
Nonenow complete asfalse/trueand
null(#​851 <https://github.com/mauvilsa/jsonargparse/pull/851>__).auto_clinow supports areturn_instanceparameter to instantiate classcomponents directly instead of exposing methods as subcommands (
#​855 <https://github.com/mauvilsa/jsonargparse/pull/855>__).ArgumentParser.get_completion_script(completion_type)public methodto generate completion scripts programmatically, and new
set_parsing_settings(add_print_completion_argument=...)setting andJSONARGPARSE_ADD_PRINT_COMPLETION_ARGUMENTenvironment variable to opt-inautomatic addition of
--print_completionwhenshtabis installed(
#​859 <https://github.com/mauvilsa/jsonargparse/pull/859>__).Fixed
^^^^^
nargs="*"ornargs="?"now correctly allowdefault values, matching standard argparse behavior (
#​846 <https://github.com/mauvilsa/jsonargparse/pull/846>__).-.5) not working (#​847 <https://github.com/mauvilsa/jsonargparse/pull/847>__).with the same name, fixing a failure during typed sub-default processing
(
#​853 <https://github.com/mauvilsa/jsonargparse/pull/853>__).--helpno longer fails withIndexErrorfor options without explicithelp text while keeping
argparsecompatibility forhelp=None(#​854 <https://github.com/mauvilsa/jsonargparse/pull/854>__).store_trueandstore_falsearguments now parse boolean environmentvariable values as
true/falseand raise a clear error for invalidvalues (
#​858 <https://github.com/mauvilsa/jsonargparse/pull/858>__).default_config_filesvalues for subcommands and nested subsubcommands(
#​862 <https://github.com/mauvilsa/jsonargparse/pull/862>__).omegaconf+incorrectly applied fordefault_config_files(#​865 <https://github.com/mauvilsa/jsonargparse/pull/865>__).ActionSubCommands.add_subcommand()missing from API reference(
#​863 <https://github.com/mauvilsa/jsonargparse/pull/863>__).Changed
^^^^^^^
jsonargparse_testswheel file for that (#​843 <https://github.com/mauvilsa/jsonargparse/pull/843>__).typeandactionis now allowed(
#​845 <https://github.com/mauvilsa/jsonargparse/pull/845>__).--print_shtabby default. Completion scriptgeneration now uses
shtab-*completion types, and whenget_completion_scriptis used the parser instance is invalidated forfurther use. A hidden
--print_shtabargument remains to guide users tothe new opt-in completion setting (
#​859 <https://github.com/mauvilsa/jsonargparse/pull/859>__).JSONARGPARSE_DEBUGcan only be enabled withtrue(case-insensitive)(
867 <https://github.com/mauvilsa/jsonargparse/pull/867>__).v4.46.0Compare Source
Added
^^^^^
#​817 <https://github.com/mauvilsa/jsonargparse/pull/817>__).Fixed
^^^^^
#​827 <https://github.com/mauvilsa/jsonargparse/pull/827>__).#​833 <https://github.com/mauvilsa/jsonargparse/pull/833>__).#​834 <https://github.com/mauvilsa/jsonargparse/pull/834>__).-(stdin) default(
#​837 <https://github.com/mauvilsa/jsonargparse/pull/837>__).#​839 <https://github.com/mauvilsa/jsonargparse/pull/839>__).v4.45.0Compare Source
Added
^^^^^
sub_configs=True, list of paths types cannow receive a file containing a list of paths (
#​816 <https://github.com/mauvilsa/jsonargparse/pull/816>__).FromConfigMixin.from_confignow supports subclasses (#​822 <https://github.com/mauvilsa/jsonargparse/pull/822>__).Fixed
^^^^^
#​824 <https://github.com/mauvilsa/jsonargparse/pull/824>__).not working correctly (
#​814 <https://github.com/mauvilsa/jsonargparse/pull/814>__).inheritance (
#​815 <https://github.com/mauvilsa/jsonargparse/pull/815>__).default_env=Trueconflicting withdefault_config_files(#​818 <https://github.com/mauvilsa/jsonargparse/pull/818>__).default_config_fileswith settings for multiple subcommands not workingcorrectly (
#​819 <https://github.com/mauvilsa/jsonargparse/pull/819>__).register_typenot checking that the given type is a class (#​820 <https://github.com/mauvilsa/jsonargparse/pull/820>__).Changed
^^^^^^^
paths like
'["PATH1",...]' | LIST_OF_PATHS_FILE | -(#​816 <https://github.com/mauvilsa/jsonargparse/pull/816>__).default_config_filesis now an error(
#​819 <https://github.com/mauvilsa/jsonargparse/pull/819>__).v4.44.0Compare Source
Fixed
^^^^^
stringified exception of an other subtype (
#​812 <https://github.com/mauvilsa/jsonargparse/pull/812>__).FromConfigMixinnot handling correctly required parameters (#​813 <https://github.com/mauvilsa/jsonargparse/pull/813>__).Changed
^^^^^^^
parser/subcommand the option was given to. Also suggests running
--helpfor the corresponding parser/subcommand (
#​809 <https://github.com/mauvilsa/jsonargparse/pull/809>__).yaml_commentsparameter ofArgumentParser.dumphas been renamed towith_commentsto allow future comments support of other formats (#​811 <https://github.com/mauvilsa/jsonargparse/pull/811>__).Deprecated
^^^^^^^^^^
ArgumentParser.default_metaproperty andwith_metaparameter ofArgumentParser.parse_*are deprecated and will be removed in v5.0.0.Instead use
.clone(with_meta=...)(#​810 <https://github.com/mauvilsa/jsonargparse/pull/810>__).yaml_commentsparameter ofArgumentParser.dumpis deprecated andwill be removed in v5.0.0. Use
with_commentsinstead (#​811 <https://github.com/mauvilsa/jsonargparse/pull/811>__).v4.43.0Compare Source
Added
^^^^^
from config (
#​800 <https://github.com/mauvilsa/jsonargparse/pull/800>__).Fixed
^^^^^
version actions and subcommands (
#​787 <https://github.com/mauvilsa/jsonargparse/pull/787>__).Unionwith path type and non-path value incorrectly dumped as string(
#​789 <https://github.com/mauvilsa/jsonargparse/pull/789>__).Literalstrings (#​790 <https://github.com/mauvilsa/jsonargparse/pull/790>__).omegaconf_absolute_to_relative_pathsnot taking effect afterparsing once (
#​805 <https://github.com/mauvilsa/jsonargparse/pull/805>__).Changed
^^^^^^^
parse_optionals_as_positionalsandapplied_instantiation_linksnolonger marked as experimental (
#​788 <https://github.com/mauvilsa/jsonargparse/pull/788>__).Pathclass fromjsonargparsetojsonargparse.typing(#​792 <https://github.com/mauvilsa/jsonargparse/pull/792>__).(
#​793 <https://github.com/mauvilsa/jsonargparse/pull/793>__).jsonargparse.*modules now use Python 3.9+ syntax (#​798 <https://github.com/mauvilsa/jsonargparse/pull/798>__).Deprecated
^^^^^^^^^^
Path.__call__is deprecated and will be removed in v5.0.0. Use theabsoluteorrelativeproperties instead (#​794 <https://github.com/mauvilsa/jsonargparse/pull/794>__).strip_metais deprecated and will be removed in v5.0.0. Instead use.clone(with_meta=False)(#​795 <https://github.com/mauvilsa/jsonargparse/pull/795>__).compose_dataclassesis deprecated and will be removed in v5.0.0. There isno direct replacement, whoever is interested can copy the code (
#​796 <https://github.com/mauvilsa/jsonargparse/pull/796>__).dict_to_namespaceis deprecated and will be removed in v5.0.0. Noreplacement is provided because blindly converting a dictionary to a namespace
may not yield the same results as using a parser, which could lead to
confusion (
#​797 <https://github.com/mauvilsa/jsonargparse/pull/797>__).v4.42.0Compare Source
Added
^^^^^
set_parsing_settingsnow supports settingallow_py_filesto enablestubs resolver searching in
.pyfiles in addition to.pyi(#​770 <https://github.com/mauvilsa/jsonargparse/pull/770>__).#​775 <https://github.com/mauvilsa/jsonargparse/pull/775>__).BaseModelsubclasses (#​781 <https://github.com/mauvilsa/jsonargparse/pull/781>__).Optional[Data],Union[Data1, Data2](#​783 <https://github.com/mauvilsa/jsonargparse/pull/783>__).set_parsing_settingsnow supportsomegaconf_absolute_to_relative_pathsto enable backward compatibility of
omegaconf+parser mode by convertingabsolute paths to relative in interpolations (
#​774 <https://github.com/mauvilsa/jsonargparse/pull/774>__).Fixed
^^^^^
#​770 <https://github.com/mauvilsa/jsonargparse/pull/770>__).dataclasswith default failing whenvalidate_defaults=True(#​771 <https://github.com/mauvilsa/jsonargparse/pull/771>__).(
#​772 <https://github.com/mauvilsa/jsonargparse/pull/772>__).omegaconf+parser mode failing when there areinf,-infornanvalues (
#​773 <https://github.com/mauvilsa/jsonargparse/pull/773>__).savewithmultifile=Truenot saving separate subconfigs for items in alist (
#​779 <https://github.com/mauvilsa/jsonargparse/pull/779>__).omegaconfparser mode failing on spawned processes (#​784 <https://github.com/mauvilsa/jsonargparse/pull/784>__).v4.41.0Compare Source
Added
^^^^^
#​753 <https://github.com/mauvilsa/jsonargparse/pull/753>__).#​758 <https://github.com/mauvilsa/jsonargparse/pull/758>__).ActionFailfor arguments that should fail parsing with a given errormessage (
#​759 <https://github.com/mauvilsa/jsonargparse/pull/759>__).omegaconf+parser mode that supports variable interpolationand resolving across configs and command line arguments. Depending on
community feedback, in v5.0.0 this new mode could replace the current
omegaconfmode, introducing a breaking change (#​765 <https://github.com/mauvilsa/jsonargparse/pull/765>__).Fixed
^^^^^
KEYWORD_ONLYparameters now correctly use--flagstyle (#​756 <https://github.com/mauvilsa/jsonargparse/pull/756>__).#​760 <https://github.com/mauvilsa/jsonargparse/pull/760>__).default_envis true (#​763 <https://github.com/mauvilsa/jsonargparse/pull/763>__).parse_objectnot parsing correctly configs (#​765 <https://github.com/mauvilsa/jsonargparse/pull/765>__).Changed
^^^^^^^
#​752 <https://github.com/mauvilsa/jsonargparse/pull/752>__).YAMLcomments feature is now implemented in a separate class to allowbetter support for custom help formatters without breaking the comments (
#​754 <https://github.com/mauvilsa/jsonargparse/pull/754>__).ruyamlwithruamel.yaml(
#​768 <https://github.com/mauvilsa/jsonargparse/pull/768>__).Deprecated
^^^^^^^^^^
DefaultHelpFormatter.*_yaml*_comment*methods are deprecated and will beremoved in v5.0.0. This logic has been moved to a new private class
YAMLCommentFormatter. If deemed necessary, this class might be made publicin the future (
#​754 <https://github.com/mauvilsa/jsonargparse/pull/754>__).ruyamloptional dependency is deprecated and will be removed inv5.0.0. Instead use the
ruameloptional dependency (#​768 <https://github.com/mauvilsa/jsonargparse/pull/768>__).v4.40.2Compare Source
Fixed
^^^^^
#​743 <https://github.com/mauvilsa/jsonargparse/pull/743>__).#​746 <https://github.com/mauvilsa/jsonargparse/pull/746>__).#​749 <https://github.com/mauvilsa/jsonargparse/pull/749>__).without-future-annotationstest not included in local coverage (#​751 <https://github.com/mauvilsa/jsonargparse/pull/751>__).v4.40.1Compare Source
Fixed
^^^^^
print_shtabincorrectly parsed from environment variable (#​726 <https://github.com/mauvilsa/jsonargparse/pull/726>__).adapt_class_typeused a locally definedpartial_instancewrapperfunction that is not pickleable (
#​728 <https://github.com/mauvilsa/jsonargparse/pull/728>__).#​736 <https://github.com/mauvilsa/jsonargparse/pull/736>__).typeshed-client(#​740 <https://github.com/mauvilsa/jsonargparse/pull/740>__).docstring-parserto avoid deprecation warnings(
#​741 <https://github.com/mauvilsa/jsonargparse/pull/741>__).v4.40.0Compare Source
Added
^^^^^
auto_parserfunction for convenience and more visibility of thecapture_parserfeature (#​721 <https://github.com/mauvilsa/jsonargparse/pull/721>__).Fixed
^^^^^
set_parsing_settings(validate_defaults=True)fails when the parser has aconfig action (
#​718 <https://github.com/mauvilsa/jsonargparse/pull/718>__).skip_link_targets=Trueandtarget being an entire required dataclass (
#​717 <https://github.com/mauvilsa/jsonargparse/pull/717>__).TypedDictvalues not validated when types are forward references (#​722 <https://github.com/mauvilsa/jsonargparse/pull/722>__).inspect.signatureavailableleading to missing parameter defaults (
#​724 <https://github.com/mauvilsa/jsonargparse/pull/724>__).Changed
^^^^^^^
(
#​682 <https://github.com/mauvilsa/jsonargparse/pull/682>__).Deprecated
^^^^^^^^^^
LoggerPropertyis deprecated and will be removed in v5.0.0. There is noreplacement since jsonargparse is not a logging libra
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.