All notable changes to this project will be documented in this file. Versions
follow Semantic Versioning
(<major>.<minor>.<patch>
). Backward incompatible (breaking) changes will
only be introduced in major versions with advance notice in the Deprecated
section of releases.
The semantic versioning only considers the public API as described in :ref:`api-ref`. Components not mentioned in :ref:`api-ref` or different import paths are considered internals and can change in minor and patch releases.
- Support for PEP 692, i.e.,
Unpack[TypedDict]
annotations for**kwargs
(#586).
- Empty tuples are now parsed correctly instead of raising an error (#592).
- Required and optional
TypedDict
keys are now correctly inferred when one inherits oneTypedDict
from another with different totality (#597). - Callables that return class not considering previous values (#603).
- Custom instantiators not working for nested dependency injection (#608).
- Failure when resolving forward references from dataclass parameter types (#611).
- Callables that return class with class default now normalizes the default to
a subclass spec with
class_path
(#603).
- Fix parse_argv_item to address the behavior change in argparse since Python 3.12.7 (#591).
- Use
jsonnet-sdist
for python 3.13 to be allowed to push package to pypi (#584).
- Support for Python 3.13 (#554).
- Support for
NotRequired
andRequired
annotations forTypedDict
keys (#571). dataclass
types now acceptclass_path
andinit_args
as value (#581).
- Callable type with subclass return not showing the
--*.help
option (#567). - Forward referenced types not compatible with
Type
typehint (#576). - Subclass nested in
Iterable
makes help fail (#578). Literal
mixing enum values and strings failing to parse (#580).
- Removed shtab experimental warning (#561).
- For consistency
add_subclass_arguments
now sets defaultNone
instead ofSUPPRESS
(#568). - Removed support for python 3.7 (#583).
dict
types not correctly forwarding previous nested values when parsing (#559).List
type incorrectly using defaults from previous item (#560).--print_shtab
not adding file completer for_ActionConfigLoad
(#562).parser_mode
not inherited by nested parsers (#564).
- Support for
MappingProxyType
as a type and as default for mapping types (#540). - Support for
OrderedDict
as a type (#545). - New function
get_loader
to get the current loader for a given parser mode (#479 comment, #536 comment).
dump
failing when a link target requires serialization andskip_link_targets=False
(#542).default_config_files
making parse fail for subcommands and nested subclass types (lightning-forums#5963).Fixes related to transformers
PreTrainedModel.from_pretrained
(lightning#19863 comment):- Import path of inherited classmethod not resolving correctly (#548).
- Resolved parameters leading to multiple values for keyword argument (#551).
- Function with return type a class in
class_path
in some cases fails with unexpectedinstantiate
parameter error (#551). - Ignore incorrectly resolved
config_file_name
parameter for transformers model ``from_pretrained``(#551).
- Support async functions and methods in
CLI
(#531). - Support for
Protocol
types only accepting exact matching signature of public methods (#526).
- Resolving of import paths for some
torch
functions not working (#535). --print_shtab
crashing on failure to get signature parameters from one class (lightning#10858 comment).
- Now
--*.help
output shows options withoutinit_args
(#533).
- Allow adding config argument with
action="config"
avoiding need to import action class (#512). - Allow providing a function with return type a class in
class_path
(lightning#13613). - Automatic
--print_shtab
option whenshtab
is installed, providing completions for many type hints without the need to modify code (#528).
- Parsing incorrectly provides file content when type is a union with a subclass, PathLike and string (#516).
--print_config
failing in some cases (#517).- Callable that returns class not using required parameter default from lambda (#523).
- Failing to parse list of dataclasses with nested optional dataclass (#527).
- List of union of classes not accepted by
add_subclass_arguments
inpython>=3.11
(#522). - Optional pydantic model failing to parse with __pydantic_private__ error (#521).
- Support for
TypedDict
(#457). - Directly providing a dict with parameters or a single parameter to a subclass
or callable with class return now implicitly tries using the base class as
class_path
if not abstract (#505).
- Parameter resolving falling back to assumptions resolver for optional
Union
types (#498). - Nested parameters failing to parse from command line when value includes space (#499).
format_usage()
not working (#501).- Not able to modify init args for callable with class return and default class (#504).
- Nested values not validated when type not subclass and nested keys for subclass (#503 comment).
- Dataclass with nested optional dataclass and default field factory failing to parse (#507).
- When parsing fails due to unexpected key, now there are specific error messages for the cases of groups and subcommands (#506).
- Support for "-" as value for Path class initialization so that user can ask to use standard input/output instead of file (#463).
- Option in
CLI
to provide subcommands help when components given in a dict (litgpt#996 comment). - TypeAliasType support added (#480).
- Account for breaking change in
argparse.ArgumentParser._parse_optional
affecting python>=3.11.9
and>=3.12.3
(#484). lazy_instance
not working for callable classes (#473 comment).Callable
type with class return and zero arguments not working (lightning#19574 comment).- Attrs and Pydantic 2 dataclasses with non-init fields fail to instantiate (#480).
- Default values/factories for Pydantic 2 dataclasses with Field initializers are not right (#480).
- Annotated fields in dataclass-likes (eg FastAPI types) resolve incorrectly (#480).
- Regression from 14456c2
that prevented
**kwargs
parameter resolving when anOptional[Callable]
type is used (#473).
- Failure when getting parameters from a class created with
class_from_function
from aclassmethod
without parameter types (#454). - Subsubcommand parse failing when
default_env=True
(#465). - Optional callable that returns a class instance with a lambda default, produces an invalid string default.
- dataclass single parameter change incorrectly resetting previous values (#464).
- Add function signature failing when conditionally calling different functions (#467).
- Importable class instances fail to parse and serialize (#446).
- Failure when trying to pickle instances created with
lazy_instance
. - Confusing error message when creating a link with a target that is already a target of another link.
argcomplete
not working when type and choices given (#442).- Confusing error message when
CLI
is used with a class that defines asubcommand
method (#430 comment). CLI
crashes when a method has aconfig
parameter. Due to redundancy,--config
argument should not be added.
- Argument links not working for target
init_args
in an optional list (#433). - Signature parameter default that doesn't match its type failing on instantiation and serialization (lightning#19289 comment).
- reconplogger's logger level being unexpectedly overwritten.
- Signature parameter default value that doesn't match its type considered invalid (lightning#19289 comment).
- Confusing error message when adding signature parameters that conflict with existing arguments.
- Deprecation warnings not printing the correct file and line of code.
sub_configs=True
not working for callable types that return a class (#419).
- Support for pydantic's
SecretStr
type. - New
SecretStr
type injsonargparse.typing
to provide secret support without additional dependency.
- Links applied on parse failing when source is a class with a nested callable.
- Failure to parse subclass added via add_argument and required arg as link target.
choices
working incorrectly whennargs
is+
,*
or number.- Unable link two deep level arguments sharing the same root class (#297).
- Failures when choices is a
dict_keys
object and value non-hashable. - AST resolver not using the correct component globals in some cases.
- Support for on parse argument links with target subclasses in a list (#394, lightning#18161).
- AST resolver now supports some local import cases.
- Failures with subcommands and default_config_files when keys are repeated (#160).
- Key related errors printing messages within single quotes.
- Choices not validated when value comes from config file (#404).
- Subclass types no longer allow class instance to be set as default (lightning#18731).
JSONARGPARSE_DEBUG
must now have a non-empty value to enable debug mode.
- Support for user-defined generic types (#366).
- New function
extend_base_type
for easy creation and registering of custom types that extend a base type (#195). - Support for
Annotated
types either ignoring the metadata or using it for validation in case of pydantic types (#384). - Support for Python 3.12.
--print_config
fails when parser has shallow links.- Argument links unnecessarily applied when
--print_config
used and parser has subcommands (#311). - Parsing fails when data type is a
Callable
with multiple input arguments (#372). - Postponed annotations not working for dataclasses.
- Unsupported pop/get default incorrectly sets default as
None
(lightning#18616). - Pydantic models and dataclasses not working for
pydantic>=2.0.0
(#361).
- Provide a more informative error message to remind user to select and provide a subcommand when a subcommand is required but not given (#371).
- Now when an argument link
compute_fn
fails, the error message will say this (#311). add_subclass_arguments
now shows a better error message when an empty tuple is given (lightning#18546).- Document the requirements for creating and using custom types (#195).
- Parameters with default and without type, now get as type
Union[type(default), Any]
. - Removed support for python 3.6.
- Remove private
linked_targets
parameter from API Reference (#317). - Dataclass nested in list not setting defaults (#357).
- AST resolver
kwargs.pop()
with conflicting defaults not setting the conditional default (#362). ActionJsonSchema
not setting correctly defaults when schema usesoneOf
.- Recommended
print_config
steps not working whendefault_config_files
used due to the config file initially being empty (#367).
- New option in
dump
for including link targets. - Support
decimal.Decimal
as a type. CLI
now accepts components as a dict, such that the keys define names of the subcommands (#334).- Resolve types that use
TYPE_CHECKING
blocks (#337 comment). - Improved resolving of nested forward references in types.
- The
ext_vars
for anActionJsonnet
argument can now have a default. - New method
ArgumentParser.add_instantiator
that enables developers to implement custom instantiation (#170).
ActionJsonnetExtVars
is deprecated and will be removed in v5.0.0. Instead usetype=dict
.
save
fails when a link target is a required parameter nested in a subclass (#332).typing.Literal
types skipped when typing_extensions is installed (lightning#18184).class_from_function
failing when called on the same function multiple times (lightning#18180).- Prevent showing errors when running
ps
on windows.
- Classes created with
class_from_function
now have a valid import path (#309).
- Invalid environment variable names when
env_prefix
is derived from aprog
containing dashes. - Pylance unable to resolve types from
jsonargparse.typing
. - Inconsistent
ARG:
and missingENV:
in help whendefault_env=True
. typing.Literal
types skipped on python 3.9 when typing_extensions is installed (lightning#18125 comment).
- Subcommands main parser help changes:
- Set notation of subcommands choices now only included in usage.
- In subcommands section, now each subcommand is always shown separately, including the name, and if available aliases and help.
- When
default_env=True
include subcommand environment variable name.
- Parameter without default and type optional incorrectly added as a required argument (#312).
class_from_function
not failing when return annotation is missing.add_subclass_arguments
with single base class and no docstring, incorrectly shown as tuple in help.- When all arguments of a group are derived from links, a config load option is incorrectly shown in help.
- Printing help fails for parsers that have a link whose target is an argument lacking type and help.
- Parameters that receive a path now also accept
os.PathLike
type. class_from_function
now supportsfunc_return
parameter to specify the return type of the function (lightning-flash#1564 comment).- Support for postponed evaluation of annotations PEP 563
from __future__ import annotations
(#120). - Backport types in python<=3.9 to support PEP 585 and 604 for postponed evaluation of annotations (#120).
- Support for
range
as a type.
- Regular expressions vulnerable to polynomial runtime due to backtracking.
attrs
fields with factory default causes parse to fail (#299).- Stop subclass dive if you hit bad import (#304).
- Added
_
prefix to module names to be explicit about non-public API.
- Importing from original non-public module paths (without
_
prefix) now gives aDeprecationWarning
. From v5.0.0 these imports will fail.
- Failure for nested argument in optional dataclass type (#289).
- Argument links applied on parse silently ignored when the source validation fails.
- AST resolver not working for dict used in a method when the dict is created using the curly braces syntax.
- Failure on multiple deep arguments linked on instantiation (#275).
- Support for dataclasses nested in a type (#243).
- Support for pydantic models and attrs define similar to dataclasses.
- Support for pydantic types.
- Backport type stubs in python<=3.9 to support PEP 585 and 604 syntax.
- str parameter in subclass incorrectly parsed as dict with implicit null value (#262).
- Wrong error indentation for subclass in union (lightning#17254).
dataclass
from pydantic not working (#100 comment).add_dataclass_arguments
not forwardingsub_configs
parameter.- Failure to instantiate nested class group without arguments (lightning#17263).
- Switched from
setup.cfg
topyproject.toml
for configuration. - Removed
build_sphinx
fromsetup.py
and documented how to build. - Include enum members in error when invalid value is given (lightning#17247).
- The
signatures
extras now installs thetyping-extensions
package on python<=3.9. CLI
now when given a class without methods, the class instance is returned.
- 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.
- Dump not working for partial callable with return instance (lightning#15340 comment).
- Allow
discard_init_args_on_class_path_change
to handle more nested contexts (#247). - Failure with dataclasses that have field with
init=False
(#252). - Failure when setting individual dict key values for subclasses and
.init_args.
is included in argument (#251).
CLI
support for callable class instances (#238).add_dataclass_arguments
now supports thefail_untyped
parameter (#241).
add_subcommands
fails when parser has required argument and default config available (#232).
- When parsing fails, now
argparse.ArgumentError
is raised instead ofParserError
. - Improved error messages when
fail_untyped=True
(#137). CLI
no longer uses the module's docstring as main parser description (#245).
- Path
skip_check
parameter is deprecated and will be removed in v5.0.0. Instead use as typestr
oros.PathLike
. - Modifying Path attributes is deprecated. In v5.0.0 they will be properties
without a setter and two renamed:
rel_path -> relative
andabs_path -> absolute
. ActionPathList
is deprecated and will be removed in v5.0.0. Instead use as typeList[<path_type>]
withenable_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.
CLI
now supports thefail_untyped
andparser_class
parameters.bytes
andbytearray
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).
- 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
andrelative_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).
- List type with empty list default causes failure (PyLaia#48).
- Pure dataclass instance default being considered as a subclass type.
- Discard
init_args
afterclass_path
change causes error (#205). fail_untyped=False
not propagated to subclass--*.help
actions.- Issues reported by CodeQL.
- Incorrect value when
Path
is cast tostr
andrel_path
was changed. - Argument links with target a subclass mixed with other types not working (#208).
- Failures when using a sequence type and the default is a tuple.
- Parent parser logger not being forwarded to subcommand and internal parsers.
- Clearer error message for when an argument link targets a subclass and the
target key does not have
init_args
(lightning#16032). - The
signatures
extras now installs thetypeshed-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.
- AST resolving for defaults with a class instance or a lambda that returns a class instance.
bool
values should not be accepted byint
orfloat
types.parse_string
raisesAttributeError
when given a simple string.- Added missing
return_parser
deprecation warning whenCLI
has subcommands. - Parsing fails for registered types that can't be cast to boolean (#196).
- List append not working for
default_config_files
set in a subcommand subparser (lightning#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 (lightning#15796).- Unable to set/get values in
Namespace
when key is the same as a method name.
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.
- AST resolver now ignores if/elif/else code when condition is a global constant (#187).
- AST resolver support for conditional
**kwargs
use in multiple calls (#187 comment).
str
type fails to parse value when pyyaml raisesConstructorError
(#189).Namespace
clone should not deepcopy leaf values (#187)._ActionHelpClassPath
actions fail to instantiate when base class uses new union type syntax.
- Improved help usage and description for
--print_config
. - Registering
pathlib.Path
types so that they are not shown as subclass types.
- Type
Any
now parses and instantiates classes when given dict that follows subclass specification (lightning#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.
- Fail to import on Python 3.7 when typing_extensions not installed (#178).
- Crashing when using set typehint with specified dtype (#183).
- Using
set_defaults
on a config argument raises error and suggests to usedefault_config_files
(lightning#15174). - Trying to add a second config argument to a single parser raises an exception (#169).
- Regression introduced in 6e7ae6d that produced cryptic error message when an invalid argument given (#172).
default_env
not forwarded to subcommand parsers, causing environment variable names to not be shown in subcommand help (lightning#12790).- Cannot override Callable
init_args
without passing theclass_path
(#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 previousclass_path
values.
compute_fn
of an argument link applied on parse not given subclass defaultinit_args
when loading from config.- Subclass
--*.help
option not available when type is aUnion
mixed with not subclass types. - Override of
dict_kwargs
items from command line not working. - Multiple subclass
init_args
given through command line not being considered (lightning#15007). Union
types required all subtypes to be supported when expected to be at least one subtype supported (#168).
set_defaults
now supports subclass by name and normalization of import path.
- Loop variable capture bug pointed out by lgtm.com.
- Issue with discard
init_args
whenclass_path
not a subclass. - No error shown when arguments given to class group that does not accept arguments (#161 comment).
- Incorrect replacement of
**kwargs
when*args
present in parameter resolver. - Override of
class_path
not discardinginit_args
when loading from config file. - Invalid values given to the
compute_fn
of a argument link applied on parse without showing an understandable error message.
- Now
UUID
andtimedelta
types are registered on first use to avoid possibly unused imports. - json/yaml dump sort now defaults to false for all python implementations.
add_class_arguments
will not add config load option if no added arguments.
- Making
import_docstring_parse
a deprecated function only for pytorch-lightning backward compatibility.
- Support for
os.PathLike
as typehint (#159). - Also show known subclasses in help for
Type[<type>]
. - Support for attribute docstrings (#150).
- Way to configure parsing docstrings with a single style.
- Subclass nested argument incorrectly loaded as subclass config (#159).
- Append to list not working for
default_config_files
in subcommands (#157).
- Failure to parse when subcommand has no options (#158).
- Optional packages being imported even though not used.
- Append to list not working for
default_config_files
(#157).
- Failure to print help when
object
used as type hint. - Failure to parse init args when type hint is union of str and class.
- Handle change of non-existent file exception type in latest fsspec version.
- Regression that caused parse to fail when providing
init_args
from command line and the subclass default set as a dict.
- Support setting through command line individual dict items without replacing (#133 comment).
- Support
super()
with non-immediate method resolution order parameter (#153).
- Mypy fails to find jsonargparse type hints (#151).
- For multiple
dict_kwargs
command line arguments only the last one was kept. - Positional
list
with subtype causing crash (#154).
- Instantiation links now support multiple sources.
- AST resolver now supports
cls()
class instantiation inclassmethod
(#146). - AST resolver now supports
pop
andget
from**kwargs
.
- file:/// scheme not working in windows (#144).
- Instantiation links with source an entire subclass incorrectly showed
--*.help
. - Ensure AST-based parameter resolver handles value-less type annotations without error (#148).
- Discarding
init_args
onclass_path
change not working forUnion
with mixed non-subclass types. - In some cases debug logs not shown even though
JSONARGPARSE_DEBUG
set.
- Instantiation links with source an entire class no longer requires to have a compute function.
- Instantiation links no longer restricted to first nesting level.
- AST parameter resolver now only logs debug messages instead of failing (#146).
- Documented AST resolver support for
**kwargs
use in property.
env_prefix
property now also accepts boolean. If set to False, no prefix is used for environment variable names (#145).link_arguments
support target being an entire subclass object (lightning#13539).
- Method resolution order not working correctly in parameter resolvers (#143).
env_prefix
property will no longer acceptNone
in v5.0.0.
- AST resolver fails for
self._kwargs
assign when a type hint is added.
- "Component not supported" crash instead of no parameters (#141).
- Default from
default_config_files
not shown in help when argument has no default. - Only
init_args
in later config overwrites instead of updates (#142).
- Signature parameters resolved by inspecting the source code with ASTs (lightning#11653).
- Support init args for unresolved parameters in subclasses (#114).
- Allow providing a config with
init_args
but noclass_path
(#113).
dump
withskip_default=True
not working for subclasses withoutinit_args
and when a default value requires serializing.JSONARGPARSE_DEFAULT_ENV
should have precedence over given value.- Giving an invalid class path and then init args would print a misleading error message about the init arg instead of the class.
- In some cases
print_config
could output invalid values. Now a lenient check is done while dumping. - Resolved some issues related to the logger property and reconplogger.
- Single dash
'-'
incorrectly parsed as[None]
.
dataclasses
no longer an optional, now an install require on python 3.6.- Parameters of type
POSITIONAL_OR_KEYWORD
now consideredKEYWORD
(#98). - Some refactoring mostly related but not limited to the new AST support.
JSONARGPARSE_DEBUG
now also sets the reconplogger level toDEBUG
.- Renamed the test files to follow the more standard
test_*.py
pattern. - Now
bool(Namespace())
evaluates toFalse
. - When a
class_path
is overridden, now only the config values that the new subclass doesn't accept are discarded.
logger
property will no longer acceptNone
in v5.0.0.
- ActionsContainer not calling
LoggerProperty.__init__
. - For type
Union[type, List[type]
when previous value isNone
then--arg+=elem
should result in a list with single element.
Literal
options now shown in metavar like choices (#106).tuple
metavar now shown as[ITEM,...]
.- Required arguments with
None
default now shown without brackets in usage. - Improved description of
--print_config
in help.
- Support append to lists both from command line and config file (#85).
- New
register_unresolvable_import_paths
function to allow getting the import paths of objects that don't have a proper__module__
attribute (lightning#13092). - New unit test for merge of config file
init_args
whenclass_path
does not change (#89).
- Replaced custom pre-commit script with a .pre-commit-config.yaml file.
- All warnings are now caught in unit tests.
- Moved
return_parser
tests to deprecated tests module.
sub_add_kwargs
not propagated for parameters of final classes.- New union syntax not working (#136).
- Make
import_docstring_parse
backward compatible to support released versions ofLightningCLI
(lightning#12918).
- Properly catch exceptions when parsing docstrings (lightning#12883).
- Failing to parse strings that look like timestamps (#135).
- Correctly consider nested mapping type without args as supported.
- New registered types incorrectly considered as class type.
- Final classes now added as group of actions instead of one typehint action.
@final
decorator now an import from typing_extensions if available.- Exporting
ActionsContainer
to show respective methods in documentation. - Raise ValueError when logger property given dict with unexpected key.
- Dump option to exclude entries whose value is the same as the default (#91).
- Support specifying
class_path
only by name for known subclasses (#84). add_argument
with subclass type now also adds--*.help
option.- Support shorter subclass command line arguments by not requiring to have
.init_args.
. - Support for
Literal
backport from typing_extensions on python 3.7. - Support nested subclass
--*.help CLASS
options.
class_path
's on parse are now normalized to shortest form.
capture_parser
function to get the parser object from a cli function.dump_header
property to set header for yaml/jsonnet dumpers (#79).Callable
type now supports callable classes (#110).
- Bug in check for
class_path
,init_args
dicts. - Module mocks in cli_tests.py.
- Moved argcomplete code from core to optionals module.
Callable
no longer a simple registered type.- Import paths are now serialized as its shortest form.
Callable
default now shown in help as full import path.- Moved typehint code from core to typehint module.
- Ignore argument links when source/target subclass does not have parameter (#129).
- Swapped order of argument links in help to
source --> target
.
CLI
'sreturn_parser
parameter will be removed in v5.0.0.
- Environment variables to enable features without code change:
JSONARGPARSE_DEFAULT_ENV
to enable environment variable parsing.JSONARGPARSE_DEBUG
to print of stack trace on parse failure.
- No error message for unrecognized arguments (lightning#12303).
- Use yaml.CSafeLoader for yaml loading if available.
- Incorrect use of
yaml_load
with jsonnet parser mode (#125). - Load of subconfigs not correctly changing working directory (#125).
- Regression introduced in commit 97e4567 fixed and updated unit test to prevent it (#128).
--print_config
fails for subcommands whendefault_env=True
(#126).
- Subcommands now also consider parent parser's
default_config_files
(lightning#11622). - Automatically added group config load options are now shown in the help #121.
- Dumper for
jsonnet
should be json instead of yaml (#123). jsonnet
import path not working correctly (#122).
ArgumentParser
objects are now pickleable (lightning#12011).
object_path_serializer
andimport_object
support class methods #99.parser_mode
is now a property that when set, propagates to subparsers.add_method_arguments
also add parameters from same method of parent classes when*args
or**kwargs
present.
- Optional Enum types incorrectly adding a
--*.help
argument. - Specific errors for invalid value for
--*.help class_path
.
- Subcommand parsers not using the parent's
parser_mode
. - Namespace
__setitem__
failing when key corresponds to a nested dict.
- String within curly braces parsed as dict due to yaml spec implicit values.
- Namespace TypeError with non-str inputs (#116).
print_config
failing on subclass with required arguments (#115).
- Bad config merging in
handle_subcommands
(lightning#10859). - Unit tests failing with argcomplete>=2.0.0.
set_loader
function to allow replacing default yaml loader or adding a new parser mode.set_dumper
function to allow changing default dump formats or adding new named dump formats.parser_mode='omegaconf'
option to use OmegaConf as a loader, adding variable interpolation support.
class_from_function
missing dereference of string return type (#105).
- Linking of attributes applied on instantiation ignoring compute_fn.
- Show full class paths in
--*.help
description to avoid misinterpretation. --*.help
action failing when fail_untyped and/or skip is required. (#101).- Raise exception if lazy_instance called with invalid lazy_kwargs.
- Only add subclass defaults on defaults merging (#103).
- Strict type and required only on final config check (#31).
- instantiate_classes failing for type hints with
nargs='+'
. - Useful error message when init_args value invalid.
- Specific error message when subclass dict has unexpected keys.
- Removed unnecessary recursive calls causing slow parsing.
- Command line parsing of init_args failing with subclasses without a default.
- get_default failing when destination key does not exist in default config file.
- Fixed issue with empty help string caused by a change in argparse python 3.9.
- Specifying init_args from the command line resulting in empty namespace when no prior class_path given.
- Fixed command line parsing of class_path and init_args options within subcommand.
- lazy_instance of final class leading to incorrect default that includes class_path and init_args.
- add_subclass_arguments not accepting a default keyword parameter.
- Make it possible to disable deprecation warnings.
- New Namespace class that natively supports nesting and avoids flat/dict conversions.
- python 3.10 is now supported and included in circleci tests.
- Readme changed to use doctest and tests are run in github workflow.
- More type hints throughout the code base.
- New unit tests to increase coverage.
- Include dataclasses extras require for tox testing.
- Automatic namespace to dict for link based on target or compute_fn type.
- Fixed issues related to conflict namespace base.
- Fixed the parsing of
Dict[int, str]
type (#87). - Fixed inner relative config with for commented tests for parse_env and CLI.
- init_args from default_config_files not discarded when class_path is overridden.
- Problems with class instantiation for parameters of final classes.
- dump/save not removing linked target keys.
- lazy_instance not working with torch.nn.Module (#96).
- General refactoring and cleanup related to new Namespace class.
- Parsed values from ActionJsonSchema/ActionJsonnet are now dict instead of Namespace.
- Removed support for python 3.5 and related code cleanup.
- contextvars package is now an install require for python 3.6.
- Deprecations are now shown as JsonargparseDeprecationWarning.
- ArgumentParser's
parse_as_dict
option will be removed in v5.0.0. - ArgumentParser's
instantiate_subclasses
method will be removed in v5.0.0.
- python 3.5 is no longer supported.
- self.logger undefined on SignatureArguments (#92).
- Fix linking for deep targets (#75).
- Fix import_object failing with "not enough values to unpack" (#94).
- Yaml representer error when dumping unregistered default path type.
- add_subclass_arguments with required=False failing on instantiation (#83).
- add_subclass_arguments with required=False failing when not given (#83).
- Repeated instantiation of dataclasses (lightning#9207).
save
now supports saving to an fsspec path (#86).
- Multifile save not working correctly for subclasses (#63).
link_arguments
not working for subcommands (#82).
- Multiple subcommand settings without explicit subcommand is now a warning instead of exception.
- Support for parsing
Mapping
andMutableMapping
types. - Support for parsing
frozenset
,MutableSequence
andMutableSet
types.
- Don't discard
init_args
with non-changing--*.class_path
argument. - Don't ignore
KeyError
in call to instantiate_classes (#81). - Optional subcommands fail with a KeyError (#68).
- Conflicting namespace for subclass key in subcommand.
instantiate_classes
not working for subcommand keys (#70).- Proper file not found message from _ActionConfigLoad (#64).
parse_path
not parsing inner config files.
- Docstrings no longer supported for python 3.5.
- Show warning when
--*.class_path
discards previousinit_args
. - Trigger error when
parse_args
called with non-string value. - ActionParser accepts both title and help, title having preference.
- Multiple subcommand settings allowed if explicit subcommand given.
datetime.timedelta
now supported as a type.- New function
class_from_function
to add signature of functions that return an instantiated class.
--*.init_args.*
causing crash when overriding value from config file.
- Signature functions not working for classes implemented with
__new__
. instantiate_classes
failing when keys not present in config object.
lazy_instance
function for serializable class type defaults.- Support for parsing multiple matched default config files (#58).
--*.class_path
and--*.init_args.*
arguments not being parsed.--help
broken when default_config_files fail to parse (#60).- Pattern in default_config_files not using sort.
- Decorator for final classes and an is_final_class function to test it.
- Support for final classes as type hint.
add_subclass_arguments
now supports multiple classes given as tuple.add_subclass_arguments
now supports the instantiate parameter.
- Parsing of relative paths inside inner configs for type hint actions.
- Method
instantiate_classes
that instantiates subclasses and class groups. - Support for
link_arguments
that are applied on instantiation. - Method
add_subclass_arguments
now supports skipping of arguments. - Added support for Type in type hints (#59).
- Custom string template to avoid problems with percent symbols in docstrings.
- Type hint Any not correctly serializing Enum and registered type values.
- Inner config file support for subclass type hints in signatures and CLI (#57).
- Forward fail_untyped setting to nested subclass type hints.
- With fail_untyped=True use type from default value instead of Any.
- Registered types and typing types incorrectly considered subclass types.
- Better structure of type hint error messages to ease understanding.
--print_config
can now be given before other arguments without value.- Fixed conversion of flat namespace to dict when there is a nested empty namespace.
- Fixed issue with get_defaults with default config file and parse_as_dict=False.
- Fixed bug in save which failed when there was an int key.
--print_config
now only receives a value with=
syntax.add_{class,method,function,dataclass}_arguments
now return a list of added arguments.
- Path support for fsspec file systems using the 's' mode flag.
- set_config_read_mode function that can enable fsspec for config reading.
- Option for print_config and dump with help as yaml comments.
- print_config only added to parsers when ActionConfigFile is added.
- set_url_support functionality now should be done with set_config_read_mode.
- Link argument arrow
<=
can be confused as less or equal, changed to<--
.
- add_dataclass_arguments not making parameters without default as required (#54).
- Removed from signature add methods required option included by mistake.
- CLI now has
--config
options at subcommand and subsubcommand levels. - CLI now adds subcommands with help string taken from docstrings.
- print_config at subcommand level for global config with implicit subcommands.
- New Path_drw predefined type.
- Type hint arguments now support
nargs='?'
. - Signature methods can now skip arguments within init_args of subclasses.
- Removed skip_check from ActionPathList which was never implemented.
- ActionPath should no longer be used, instead paths are given as type.
- Actions not being applied for subsubcommand values.
- handle_subcommands not correctly inferring subsubcommand.
- fail_untyped now adds untyped parameters as type Any and if no default then default set to None.
--*.help
option being added for non-subclass types.- Iterable and Sequence types not working for python>=3.7 (#53).
- set_defaults method now works for arguments within subcommands.
- CLI set_defaults option to allow overriding of defaults.
- CLI return_parser option to ease inclusion in documentation.
- save_path_content attribute to save paths content on config save.
- New
link_arguments
method to derive an argument value from others. - print_config now includes subclass init_args if class_path given.
- Subclass type hints now also have a
--*.help
option.
- Signature parameters whose name starts with "_" are skipped.
- The repr of Path now has the form
Path_{mode}(
.
- CLI now does instantiate_subclasses before running.
- New method add_dataclass_arguments.
- Dataclasses are now supported as a type.
- New predefined type Path_dc.
- Experimental Callable type support.
- Signature methods with nested key can be made required.
- Support for Literal types.
- New option in signatures methods to not fail for untyped required.
- Generation of yaml now uses internally pyyaml's safe_dump.
- New cleaner implementation for type hints support.
- Moved deprecated code to a module specific for this.
- Path types repr now has format Path(rel[, cwd=dir]).
- instantiate_subclasses now always returns a dict.
- ActionEnum should no longer be used, instead enums are given as type.
- Deserialization of types not being done for nested config files.
- Help fails saying required args missing if default config file exists (#48).
- ActionYesNo arguments failing when parsing from environment variable (#49).
- Path class now supports home prefix '~' (#45).
- yaml/json dump kwargs can now be changed via attributes dump_yaml_kwargs and dump_json_kwargs.
- Now by default dump/save/print_config preserve the add arguments and argument groups order (only CPython>=3.6) (#46).
- ActionParser group title now defaults to None if not given (#47).
- Add argument with type Enum or type hint giving an action now raises error (#45).
- Parser help now also considers default_config_files and shows which config file was loaded (#47).
- get_default method now also considers default_config_files.
- get_defaults now raises ParserError if default config file not valid.
- default_config_files property not removing help group when setting None.
- ActionParser now moves all actions to the parent parser.
- The help of ActionParser arguments is now shown in the main help (#41).
- Use of required in ActionParser parsers not working (#43).
- Nested options with names including dashes not working (#42).
- DefaultHelpFormatter not properly using env_prefix to show var names.
- Function to register additional types for use in parsers.
- Type hint support for complex and UUID classes.
- PositiveInt and NonNegativeInt now gives error instead of silently truncating when given float.
- Types created with restricted_number_type and restricted_string_type now share a common TypeCore base class.
- ActionOperators not give error if type already registered.
- List[Tuple] types not working correctly.
- Some nested dicts kept as Namespace by dump.
- Parsing of relative paths in default_config_files not working.
- Description of tuple type in the readme.
- Tuples with ellipsis are now supported (#40).
- Using dict as type incorrectly considered as class requiring class_path.
- Nested tuples were not working correctly (#40).
- CLI crashed for class method when zero args given after subcommand.
- Options before subcommand provided in config file gave subcommand not given.
- Arguments in groups without help not showing required, type and default.
- Required arguments help incorrectly showed null default value.
- Various improvements and fixes to the readme.
- Save with multifile=True now creates original jsonnet file for ActionJsonnet.
- default_config_files is now a property of parser objects.
- Table in readme to ease understanding of extras requires for optional features (#38).
- Save with multifile=True uses file extension to choose json or yaml format.
- Better exception message when using ActionJsonSchema and jsonschema not installed (#38).
- Changed actions so that keyword arguments are visible in API.
- Fixed save method short description which was copy paste of dump.
- Added missing docstring in instantiate_subclasses method.
- Fixed crash when using
--help
and ActionConfigFile not given help string. - Standardized capitalization and punctuation of: help, config, version.
- instantiate_subclasses work properly when init_args not present.
- Addressed a couple of issues pointed out by sonarcloud.
- New add_subclass_arguments method to add as type with a specific help option.
- Automatic Optional for arguments with default None (#30).
- CLI now supports running methods from classes.
- Signature arguments can now be loaded from independent config files (#32).
- add_argument now supports enable_path for type based on jsonschema.
- print_config can now be given as value skip_null to exclude null entries.
- Improved description of parser used as standalone and for ActionParser (#34).
- Removed
__cwd__
and top level__path__
that were not needed.
- ActionYesNo argument in help the type is now bool.
- Correctly skip self in add_method_arguments for inherited methods.
- Prevent failure of dump in cleanup_actions due to new _ActionConfigLoad.
- Prevent failure in save_paths for dict with int keys.
- Avoid duplicate config check failure message with subcommands.
- Support for multiple levels of subcommands (#29).
- Default description of subcommands explaining use of
--help
.
- add_class_arguments incorrectly added arguments from
__call__
instead of__init__
for callable classes.
- Functions to add arguments from classes, methods and functions.
- CLI function that allows creating a line command line interface with a single line of code inspired by Fire.
- Typing module that includes predefined types and type generator functions for paths and restricted numbers/strings.
- Extended support to add_argument type to allow complex type hints.
- Parsers now include
--print_config
option to dump defaults. - Support argcomplete for tab completion of arguments.
- ArgumentParsers by default now use as error_handler the usage_and_exit_error_handler.
- error_handler and formatter_class no longer accept as value a string.
- Changed SimpleNamespace to Namespace to avoid unnecessary differences with argparse.
- ActionOperators should no longer be used, the new alternative is restricted number types.
The change log was introduced in v3.0.0. For details of the changes for previous versions take a look at the git log. It more or less reads like a change log.