Jsonargparse

Latest version: v4.37.0

Safety actively analyzes 706487 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 7 of 19

4.20.0

Not secure
--------------------

Added
^^^^^
- ``CLI`` support for callable class instances (`238
<https://github.com/omni-us/jsonargparse/issues/238>`__).
- ``add_dataclass_arguments`` now supports the ``fail_untyped`` parameter (`241
<https://github.com/omni-us/jsonargparse/issues/241>`__).

Fixed
^^^^^
- ``add_subcommands`` fails when parser has required argument and default config
available (`232 <https://github.com/omni-us/jsonargparse/issues/232>`__).

Changed
^^^^^^^
- When parsing fails, now ``argparse.ArgumentError`` is raised instead of
``ParserError``.
- Improved error messages when ``fail_untyped=True`` (`137
<https://github.com/omni-us/jsonargparse/issues/137>`__).
- ``CLI`` no longer uses the module's docstring as main parser description (`245
<https://github.com/omni-us/jsonargparse/issues/245>`__).

Deprecated
^^^^^^^^^^
- Path ``skip_check`` parameter is deprecated and will be removed in v5.0.0.
Instead use as type ``str`` or ``os.PathLike``.
- Modifying Path attributes is deprecated. In v5.0.0 they will be properties
without a setter and two renamed: ``rel_path -> relative`` and
``abs_path -> absolute``.
- ``ActionPathList`` is deprecated and will be removed in v5.0.0. Instead use as
type ``List[<path_type>]`` with ``enable_path=True``.
- ``ArgumentParser.error_handler`` is deprecated and will be removed in v5.0.0.
Instead use the new exit_on_error parameter from argparse.

4.19.0

Not secure
--------------------

Added
^^^^^
- ``CLI`` now supports the ``fail_untyped`` and ``parser_class`` parameters.
- ``bytes`` and ``bytearray`` registered on first use and decodes from standard
Base64.
- Support getting the import path of variables in modules, e.g.
``random.randint``.
- Specific error messages for when an argument link uses as source the target of
a previous parse link and vice versa (`208
<https://github.com/omni-us/jsonargparse/issues/208>`__).
- New resolver that identifies parameter types from stub files ``*.pyi``.
- Support for relative paths within remote fsspec/url config files.
- New context manager methods for path types: ``open`` and
``relative_path_context``.
- Path types now implement the ``os.PathLike`` protocol.
- New path mode ``cc`` to not require the parent directory to exists but that it
can be created.
- The parent parser class is now used to create internal parsers (`171
<https://github.com/omni-us/jsonargparse/issues/171>`__).

Fixed
^^^^^
- List type with empty list default causes failure (`PyLaia48
<https://github.com/jpuigcerver/PyLaia/issues/48>`__).
- Pure dataclass instance default being considered as a subclass type.
- Discard ``init_args`` after ``class_path`` change causes error (`205
<https://github.com/omni-us/jsonargparse/issues/205>`__).
- ``fail_untyped=False`` not propagated to subclass ``--*.help`` actions.
- Issues reported by CodeQL.
- Incorrect value when ``Path`` is cast to ``str`` and ``rel_path`` was changed.
- Argument links with target a subclass mixed with other types not working (`208
<https://github.com/omni-us/jsonargparse/issues/208>`__).
- Failures when using a sequence type and the default is a tuple.
- Parent parser logger not being forwarded to subcommand and internal parsers.

Changed
^^^^^^^
- Clearer error message for when an argument link targets a subclass and the
target key does not have ``init_args`` (`lightning16032
<https://github.com/Lightning-AI/lightning/issues/16032>`__).
- The ``signatures`` extras now installs the ``typeshed-client`` package.
- ``validators`` package is no longer a dependency.
- Path types are no longer a subclass of ``str``.
- Parsing steps logging now at debug level.
- Discarding ``init_args`` warning changed to log at debug level.
- Removed replacing list instead of append warning.

4.18.0

Not secure
--------------------

Added
^^^^^
- AST resolving for defaults with a class instance or a lambda that returns a
class instance.

Fixed
^^^^^
- ``bool`` values should not be accepted by ``int`` or ``float`` types.
- ``parse_string`` raises ``AttributeError`` when given a simple string.
- Added missing ``return_parser`` deprecation warning when ``CLI`` has
subcommands.
- Parsing fails for registered types that can't be cast to boolean (`196
<https://github.com/omni-us/jsonargparse/issues/196>`__).
- List append not working for ``default_config_files`` set in a subcommand
subparser (`lightning15256
<https://github.com/Lightning-AI/lightning/issues/15256>`__).
- Specifying only the class name through command line not working for
``Callable`` with class return type.
- ``init_args`` not discarded for nested subclasses provided through command
line (`lightning15796
<https://github.com/Lightning-AI/lightning/issues/15796>`__).
- Unable to set/get values in ``Namespace`` when key is the same as a method
name.

Changed
^^^^^^^
- ``CLI`` no longer adds ``--config`` and ``--print_config`` if no arguments
added to subcommand.
- ``CLI`` now uses the component's docstring short description for subparser
descriptions.
- Slightly nicer type hint unexpected value error messages, in particular less
redundancy for ``Union`` types.

4.17.0

Not secure
--------------------

Added
^^^^^
- AST resolver now ignores if/elif/else code when condition is a global constant
(`187 <https://github.com/omni-us/jsonargparse/issues/187>`__).
- AST resolver support for conditional ``**kwargs`` use in multiple calls (`187
comment
<https://github.com/omni-us/jsonargparse/issues/187#issuecomment-1295141338>`__).

Fixed
^^^^^
- ``str`` type fails to parse value when pyyaml raises ``ConstructorError``
(`189 <https://github.com/omni-us/jsonargparse/issues/189>`__).
- ``Namespace`` clone should not deepcopy leaf values (`187
<https://github.com/omni-us/jsonargparse/issues/187>`__).
- ``_ActionHelpClassPath`` actions fail to instantiate when base class uses new
union type syntax.

Changed
^^^^^^^
- Improved help usage and description for ``--print_config``.
- Registering ``pathlib.Path`` types so that they are not shown as subclass
types.

4.16.0

Not secure
--------------------

Added
^^^^^
- Type ``Any`` now parses and instantiates classes when given dict that follows
subclass specification (`lightning15115
<https://github.com/Lightning-AI/lightning/issues/15115>`__).
- Signature methods now accept skipping a number of positionals.
- Callable type hint with return type a class can now be given a subclass which
produces a callable that returns an instance of the class.
- Support for Python 3.11.

Fixed
^^^^^
- Fail to import on Python 3.7 when typing_extensions not installed (`178
<https://github.com/omni-us/jsonargparse/issues/178>`__).
- Crashing when using set typehint with specified dtype (`183
<https://github.com/omni-us/jsonargparse/issues/183>`__).

Changed
^^^^^^^
- Using ``set_defaults`` on a config argument raises error and suggests to use
``default_config_files`` (`lightning15174
<https://github.com/Lightning-AI/lightning/issues/15174>`__).
- Trying to add a second config argument to a single parser raises an exception
(`169 <https://github.com/omni-us/jsonargparse/issues/169>`__).

4.15.2

Not secure
--------------------

Fixed
^^^^^
- Regression introduced in `6e7ae6d
<https://github.com/omni-us/jsonargparse/commit/6e7ae6dca41d2bdf081731c042bba9d08b6f228f>`__
that produced cryptic error message when an invalid argument given (`172
<https://github.com/omni-us/jsonargparse/issues/172>`__).
- ``default_env`` not forwarded to subcommand parsers, causing environment
variable names to not be shown in subcommand help (`lightning12790
<https://github.com/Lightning-AI/lightning/issues/12790>`__).
- Cannot override Callable ``init_args`` without passing the ``class_path``
(`174 <https://github.com/omni-us/jsonargparse/issues/174>`__).
- Positional subclass type incorrectly adds subclass help as positional.
- Order of types in ``Union`` not being considered.
- ``str`` type fails to parse values of the form ``^\w+: *``.
- ``parse_object`` does not consider given namespace for previous ``class_path``
values.

Page 7 of 19

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.