Jsonargparse

Latest version: v4.34.0

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

Scan your dependencies

Page 6 of 18

4.21.0

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

Added
^^^^^
- Support for dataclasses nested in a type (`243
<https://github.com/omni-us/jsonargparse/issues/243>`__).
- Support for pydantic `models <https://docs.pydantic.dev/usage/models/>`__ and
attrs `define <https://www.attrs.org/en/stable/examples.html>`__ similar to
dataclasses.
- Support for `pydantic types
<https://docs.pydantic.dev/usage/types/#pydantic-types>`__.
- Backport type stubs in python<=3.9 to support PEP `585
<https://peps.python.org/pep-0585/>`__ and `604
<https://peps.python.org/pep-0604/>`__ syntax.

Fixed
^^^^^
- `str` parameter in subclass incorrectly parsed as dict with implicit `null`
value (`262 <https://github.com/omni-us/jsonargparse/issues/262>`__).
- Wrong error indentation for subclass in union (`lightning17254
<https://github.com/Lightning-AI/lightning/issues/17254>`__).
- ``dataclass`` from pydantic not working (`100 comment
<https://github.com/omni-us/jsonargparse/issues/100#issuecomment-1408413796>`__).
- ``add_dataclass_arguments`` not forwarding ``sub_configs`` parameter.
- Failure to instantiate nested class group without arguments (`lightning17263
<https://github.com/Lightning-AI/lightning/issues/17263>`__).

Changed
^^^^^^^
- Switched from ``setup.cfg`` to ``pyproject.toml`` for configuration.
- Removed ``build_sphinx`` from ``setup.py`` and documented how to build.
- Include enum members in error when invalid value is given
(`lightning17247
<https://github.com/Lightning-AI/lightning/issues/17247>`__).
- The ``signatures`` extras now installs the ``typing-extensions`` package on
python<=3.9.
- ``CLI`` now when given a class without methods, the class instance is
returned.

Deprecated
^^^^^^^^^^
- Support for python 3.6 will be removed in v5.0.0. New features added in
>=4.21.0 releases are not guaranteed to work in python 3.6.

4.20.1

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

Fixed
^^^^^
- Dump not working for partial callable with return instance
(`lightning15340 comment
<https://github.com/Lightning-AI/lightning/issues/15340#issuecomment-1439203008>`__).
- Allow ``discard_init_args_on_class_path_change`` to handle more nested
contexts (`247 <https://github.com/omni-us/jsonargparse/issues/247>`__).
- Failure with dataclasses that have field with ``init=False`` (`252
<https://github.com/omni-us/jsonargparse/issues/252>`__).
- Failure when setting individual dict key values for subclasses and
``.init_args.`` is included in argument (`251
<https://github.com/omni-us/jsonargparse/issues/251>`__).

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.

Page 6 of 18

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.