diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9e323970..8abe128e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -57,7 +57,7 @@ Deprecated - ``dict_to_namespace`` is deprecated and will be removed in v5.0.0. No replacement 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 `__). + confusion (`#797 `__). v4.42.0 (2025-10-14) @@ -477,11 +477,11 @@ Fixed - 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 - `__). + `__). Changed ^^^^^^^ @@ -825,18 +825,18 @@ Added `__). - 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. Fixed ^^^^^ - ``--print_config`` fails when parser has shallow links. - Argument links unnecessarily applied when ``--print_config`` used and parser - has subcommands (`#311 `__). + has subcommands (`#311 `__). - Parsing fails when data type is a ``Callable`` with multiple input arguments (`#372 `__). - Postponed annotations not working for dataclasses. @@ -844,7 +844,7 @@ Fixed (`lightning#18616 `__). - Pydantic models and dataclasses not working for ``pydantic>=2.0.0`` (`#361 - `__). + `__). Changed ^^^^^^^ @@ -852,12 +852,12 @@ Changed 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 `__). + 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. @@ -2009,7 +2009,7 @@ v3.16.0 (2021-07-05) -------------------- Added ------ +^^^^^ - ``lazy_instance`` function for serializable class type defaults. - Support for parsing multiple matched default config files (`#58 `__). diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 0360937c..3fc029e1 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -4,14 +4,14 @@ Contributing Contributions to jsonargparse are very welcome. There are multiple ways for people to help and contribute, among them: -- Star ⭐ the github project ``__. +- Star ⭐ the GitHub project ``__. - `Sponsor 🩷 `__ its maintenance and development. - Spread the word in your community about the features you like from jsonargparse. - Help others to learn how to use jsonargparse by creating tutorials, such as blog posts and videos. -- Become active in existing github issues and pull requests. +- Become active in existing GitHub issues and pull requests. - Create `issues `__ for reporting bugs and proposing improvements. - Create `pull requests `__ with @@ -80,8 +80,8 @@ some time to complete. If you wish to push without running these hooks, use the command ``git push --no-verify``. Formatting of the code is done automatically by pre-commit. If some pre-commit -hooks fail and you decide to skip them, the formatting will be automatically -applied by a github action in pull requests. +hooks fail and you decide to skip them, formatting will be automatically applied +by a GitHub action in pull requests. Documentation ------------- @@ -101,8 +101,8 @@ Tests Running the unit tests can be done either using `pytest `__ or `tox `__. The tests are also installed with -the package, thus can be run in a production system. Also pre-commit runs some -additional tests. +the package and can be run in a non-development environment. Also pre-commit +runs some additional tests. .. code-block:: bash @@ -138,8 +138,8 @@ Then open the file ``jsonargparse_tests/htmlcov/index.html`` in a browser. Pull requests ------------- -When creating a pull request, it is recommended that in your fork, create a -specific branch for the changes you want to contribute, instead of using the +When creating a pull request, it is recommended that you create a specific +branch in your fork for the changes you want to contribute, instead of using the ``main`` branch. The required tasks to do for a pull request, are listed in diff --git a/README.rst b/README.rst index 16f4cdfb..8250dab9 100644 --- a/README.rst +++ b/README.rst @@ -36,8 +36,8 @@ CLI with minimal boilerplate: from jsonargparse import auto_cli - def main_function(...): # your main parameters and logic here - ... + def main_function(...): # your main parameters with type hints here + ... # your main code here if __name__ == "__main__": auto_cli(main_function) # parses arguments and runs main_function @@ -197,4 +197,4 @@ To install the latest development version, use the following command: .. code-block:: bash - pip install "jsonargparse[signatures] @ git+https://github.com/omni-us/jsonargparse.git@main" + pip install "jsonargparse[signatures] @ https://github.com/omni-us/jsonargparse/zipball/main" diff --git a/jsonargparse/_from_config.py b/jsonargparse/_from_config.py index 3c8d62cf..10508731 100644 --- a/jsonargparse/_from_config.py +++ b/jsonargparse/_from_config.py @@ -52,7 +52,7 @@ def from_config(cls: Type[T], config: Union[str, PathLike, dict]) -> T: def _parse_class_kwargs_from_config(cls: Type[T], config: Union[str, PathLike, dict], **kwargs) -> dict: - """Parse the init kwargs for `cls` from a config file or dict.""" + """Parse the init kwargs for ``cls`` from a config file or dict.""" parser = ArgumentParser(exit_on_error=False, **kwargs) parser.add_class_arguments(cls) if isinstance(config, dict): @@ -121,7 +121,7 @@ def _override_init_defaults_parent_classes(cls: Type[T], defaults: dict) -> None kwargs_param = parameters.pop() # Add new parameters - for param in reversed(override_parent_params): + for param in override_parent_params: parameters.append(param) # Add **kwargs back at the end