jsonargparse 4.42.0


pip install jsonargparse

  Latest version

Released: Oct 14, 2025


Meta
Author: Mauricio Villegas
Requires Python: >=3.9

Classifiers

Development Status
  • 5 - Production/Stable

Programming Language
  • Python
  • Python :: 3
  • Python :: 3 :: Only
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14

Intended Audience
  • Developers

Operating System
  • POSIX :: Linux
  • MacOS
  • Microsoft :: Windows
https://readthedocs.org/projects/jsonargparse/badge/?version=stable https://github.com/omni-us/jsonargparse/actions/workflows/tests.yaml/badge.svg https://codecov.io/gh/omni-us/jsonargparse/branch/main/graph/badge.svg https://sonarcloud.io/api/project_badges/measure?project=omni-us_jsonargparse&metric=alert_status https://badge.fury.io/py/jsonargparse.svg

jsonargparse

Docs: https://jsonargparse.readthedocs.io/ | Source: https://github.com/omni-us/jsonargparse/

jsonargparse is a library for creating command-line interfaces (CLIs) and making Python apps easily configurable. It is a well-maintained project with frequent releases, adhering to high standards of development: semantic versioning, deprecation periods, changelog, automated testing, and full test coverage.

Although jsonargparse might not be widely recognized yet, it already boasts a substantial user base. Most notably, it serves as the framework behind pytorch-lightning’s LightningCLI.

Teaser examples

CLI with minimal boilerplate:

from jsonargparse import auto_cli

def main_function(...):  # your main parameters and logic here
    ...

if __name__ == "__main__":
    auto_cli(main_function)  # parses arguments and runs main_function

Minimal boilerplate but manually parsing:

from jsonargparse import auto_parser

parser = auto_parser(main_function)
cfg = parser.parse_args()
...

Powerful argparse-like low level parsers:

from jsonargparse import ArgumentParser

parser = ArgumentParser()
parser.add_argument("--config", action="config")  # support config files
parser.add_argument("--opt", type=Union[int, Literal["off"]])  # complex arguments via type hints
parser.add_function_arguments(main_function, "function")  # add function parameters
parser.add_class_arguments(SomeClass, "class")  # add class parameters
...
cfg = parser.parse_args()
init = parser.instantiate_classes(cfg)
...

Features

jsonargparse is user-friendly and encourages the development of clean, high-quality code. It encompasses numerous powerful features, some unique to jsonargparse, while also combining advantages found in similar packages:

Other notable features include:

  • Extensive type hint support: nested types (union, optional), containers (list, dict, etc.), protocols, user-defined generics, restricted types (regex, numbers), paths, URLs, types from stubs (*.pyi), future annotations (PEP 563), and backports (PEP 604).

  • Keyword arguments introspection: resolving of parameters used via **kwargs.

  • Dependency injection: support types that expect a class instance and callables that return a class instance.

  • Structured configs: parse config files with more understandable non-flat hierarchies.

  • Config file formats: json, yaml, toml, jsonnet and extensible to more formats.

  • Relative paths: within config files and parsing of config paths referenced inside other configs.

  • Argument linking: directing parsed values to multiple parameters, preventing unnecessary interpolation in configs.

  • Variable interpolation: powered by OmegaConf.

  • Tab completion: powered by shtab or argcomplete.

Design principles

  • Non-intrusive/decoupled:

    There is no requirement for unrelated modifications throughout a codebase, maintaining the separation of concerns principle. In simpler terms, changes should make sense even without the CLI. No need to inherit from a special class, add decorators, or use CLI-specific type hints.

  • Minimal boilerplate:

    A recommended practice is to write code with function/class parameters having meaningful names, accurate type hints, and descriptive docstrings. Reuse these wherever they appear to automatically generate the CLI, following the don’t repeat yourself principle. A notable advantage is that when parameters are added or types changed, the CLI will remain synchronized, avoiding the need to update the CLI’s implementation.

  • Dependency injection:

    Using as type hint a class or a callable that instantiates a class, a practice known as dependency injection, is a sound design pattern for developing loosely coupled and highly configurable software. Such type hints should be supported with minimal restrictions.

Installation

You can install using pip as:

pip install jsonargparse

By default, the only dependency installed with jsonargparse is PyYAML. However, several optional features can be enabled by specifying one or more of the following extras (optional dependencies): signatures, jsonschema, jsonnet, urls, fsspec, toml, ruamel, omegaconf, shtab, and argcomplete. Additionally, the all extras can be used to enable all optional features (excluding tab completion ones). To install jsonargparse with extras, use the following syntax:

pip install "jsonargparse[signatures,urls]"  # Enable signatures and URLs features
pip install "jsonargparse[all]"              # Enable all optional features

To install the latest development version, use the following command:

pip install "jsonargparse[signatures] @ git+https://github.com/omni-us/jsonargparse.git@main"
4.42.0 Oct 14, 2025
4.41.0 Sep 04, 2025
4.40.2 Aug 06, 2025
4.40.1 Jul 24, 2025
4.40.0 May 16, 2025
4.39.0 Apr 29, 2025
4.38.0 Mar 26, 2025
4.37.0 Feb 14, 2025
4.36.0 Jan 17, 2025
4.35.0 Dec 16, 2024
4.34.1 Dec 02, 2024
4.34.0 Nov 08, 2024
4.33.2 Oct 07, 2024
4.33.1 Sep 26, 2024
4.32.1 Aug 23, 2024
4.32.0 Jul 19, 2024
4.31.0 Jun 27, 2024
4.30.0 Jun 18, 2024
4.29.0 May 24, 2024
4.28.0 Apr 17, 2024
4.27.7 Mar 21, 2024
4.27.6 Mar 15, 2024
4.27.5 Feb 12, 2024
4.27.4 Feb 01, 2024
4.27.3 Jan 26, 2024
4.27.2 Jan 18, 2024
4.27.1 Nov 23, 2023
4.27.0 Nov 02, 2023
4.26.2 Oct 26, 2023
4.26.1 Oct 23, 2023
4.26.0 Oct 19, 2023
4.25.0 Sep 25, 2023
4.24.1 Sep 06, 2023
4.24.0 Aug 23, 2023
4.23.1 Aug 04, 2023
4.23.0 Jul 27, 2023
4.22.1 Jul 07, 2023
4.22.0 Jun 23, 2023
4.21.2 Jun 08, 2023
4.21.1 May 09, 2023
4.21.0 Apr 21, 2023
4.20.1 Mar 30, 2023
4.20.0 Feb 20, 2023
4.19.0 Dec 27, 2022
4.18.0 Nov 29, 2022
4.17.0 Nov 11, 2022
4.16.0 Oct 28, 2022
4.15.2 Oct 20, 2022
4.15.1 Oct 07, 2022
4.15.0 Sep 27, 2022
4.14.1 Sep 26, 2022
4.14.0 Sep 14, 2022
4.13.3 Sep 06, 2022
4.13.2 Aug 31, 2022
4.13.1 Aug 05, 2022
4.13.0 Aug 03, 2022
4.12.0 Jul 22, 2022
4.11.0 Jul 12, 2022
4.10.2 Jul 01, 2022
4.10.1 Jun 29, 2022
4.10.0 Jun 21, 2022
4.10.0.dev2 Jun 16, 2022
4.10.0.dev1 Jun 14, 2022
4.9.0 Jun 01, 2022
4.8.0 May 26, 2022
4.8.0.dev2 May 25, 2022
4.8.0.dev1 May 23, 2022
4.7.3 May 10, 2022
4.7.2 Apr 29, 2022
4.7.1 Apr 26, 2022
4.7.0 Apr 20, 2022
4.6.0 Apr 11, 2022
4.6.0.dev3 Apr 08, 2022
4.6.0.dev1 Apr 05, 2022
4.5.0 Mar 29, 2022
4.4.0 Mar 18, 2022
4.3.1 Mar 01, 2022
4.3.0 Feb 22, 2022
4.2.0 Feb 09, 2022
4.1.4 Jan 26, 2022
4.1.3 Jan 24, 2022
4.1.2 Jan 20, 2022
4.1.1 Jan 13, 2022
4.1.0 Dec 06, 2021
4.0.4 Nov 29, 2021
4.0.3 Nov 23, 2021
4.0.2 Nov 22, 2021
4.0.1 Nov 22, 2021
4.0.0 Nov 16, 2021
4.0.0rc1 Nov 09, 2021
4.0.0.dev1 Nov 04, 2021
3.19.4 Oct 04, 2021
3.19.3 Sep 16, 2021
3.19.2 Sep 09, 2021
3.19.1 Sep 03, 2021
3.19.0 Aug 27, 2021
3.18.0 Aug 18, 2021
3.17.0 Jul 19, 2021
3.16.1 Jul 13, 2021
3.16.0 Jul 05, 2021
3.15.0 Jun 22, 2021
3.14.0 Jun 08, 2021
3.13.1 Jun 03, 2021
3.13.0 Jun 02, 2021
3.12.1 May 19, 2021
3.12.0 May 13, 2021
3.11.2 May 03, 2021
3.11.1 Apr 30, 2021
3.11.0 Apr 27, 2021
3.10.1 Apr 24, 2021
3.10.0 Apr 19, 2021
3.9.0 Apr 09, 2021
3.8.1 Mar 22, 2021
3.8.0 Mar 22, 2021
3.7.0 Mar 17, 2021
3.6.0 Mar 08, 2021
3.5.1 Feb 26, 2021
3.5.0 Feb 12, 2021
3.4.1 Feb 03, 2021
3.4.0 Feb 01, 2021
3.3.2 Jan 22, 2021
3.3.1 Jan 08, 2021
3.3.0 Jan 08, 2021
3.2.1 Dec 30, 2020
3.1.0 Dec 09, 2020
3.0.1 Dec 02, 2020
3.0.0 Dec 01, 2020
3.0.0rc4 Nov 30, 2020
3.0.0rc3 Nov 27, 2020
3.0.0rc2 Nov 23, 2020
3.0.0rc1 Nov 18, 2020
3.0.0.dev5 Nov 11, 2020
3.0.0.dev4 Nov 02, 2020
3.0.0.dev3 Oct 28, 2020
3.0.0.dev2 Oct 27, 2020
3.0.0.dev1 Oct 19, 2020
2.32.2 Jul 23, 2020
2.32.1 Jul 22, 2020
2.32.0 Jul 21, 2020
2.31.2 Jul 08, 2020
2.31.1 Jun 19, 2020
2.31.0 Jun 16, 2020
2.30.2 May 30, 2020
2.30.0 May 11, 2020
2.29.0 May 07, 2020
2.28.0 May 04, 2020
2.27.0 Apr 26, 2020
2.26.1 Apr 23, 2020
2.26.0 Apr 23, 2020
2.25.4 Apr 21, 2020
2.25.3 Apr 03, 2020
2.25.2 Mar 10, 2020
2.25.1 Mar 04, 2020
2.25.0 Mar 02, 2020
2.24.1 Feb 28, 2020
2.24.0 Feb 26, 2020
2.23.5 Feb 19, 2020
2.23.4 Feb 12, 2020
2.23.3 Feb 10, 2020
2.23.2 Feb 08, 2020
2.23.1 Jan 30, 2020
2.23.0 Jan 29, 2020
2.22.2 Jan 26, 2020
2.22.1 Jan 24, 2020
2.22.0 Jan 21, 2020
2.21.0 Jan 16, 2020
2.20.0 Jan 09, 2020
2.19.0 Dec 22, 2019
2.18.0 Dec 20, 2019
2.17.0 Dec 18, 2019
2.16.0 Dec 16, 2019
2.15.0 Dec 12, 2019
2.14.3 Dec 11, 2019
2.14.2 Dec 10, 2019
2.14.1 Dec 10, 2019
2.14.0 Dec 09, 2019
2.13.1 Dec 06, 2019
2.13.0 Dec 06, 2019
2.12.0 Nov 30, 2019
2.11.0 Nov 22, 2019
2.10.1 Nov 13, 2019
2.9.0 Oct 10, 2019
2.8.0 Oct 10, 2019
2.7.0 Oct 07, 2019
2.6.1 Sep 17, 2019
2.6.0 Sep 14, 2019
2.5.0 Sep 13, 2019
2.4.1 Sep 06, 2019
2.4.0 Sep 06, 2019
2.3.0 Sep 06, 2019
2.2.1 Sep 02, 2019
2.1.1 Aug 31, 2019
2.1.0 Aug 27, 2019
2.0.0 Aug 26, 2019

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras:
Dependencies:
PyYAML (>=3.13)