jsonargparse
Docs: https://jsonargparse.readthedocs.io/ | Source: https://github.com/mauvilsa/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.
The documentation is a reference that describes each feature in isolation, which is not always the best way to learn. If you would rather see the why behind the features and complete use cases built end to end, have a look at the talks and articles page, which collects presentations, blog posts and example projects.
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:
Automatic creation of CLIs, like Fire, Typer, Clize and Tyro.
Use type hints for argument validation, like Typer, Tap and Tyro.
Use of docstrings for automatic generation of help, like Tap, Tyro and SimpleParsing.
Parse from configuration files and environment variables, like OmegaConf, dynaconf, confuse and configargparse.
Dataclasses support, like SimpleParsing and Tyro.
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] @ https://github.com/mauvilsa/jsonargparse/zipball/main"
Release files for jsonargparse 4.52.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jsonargparse-4.52.0.tar.gz | 164.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jsonargparse-4.52.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 339.5 kB
Release files / jsonargparse-4.52.0.tar.gz
| Download URL | jsonargparse-4.52.0.tar.gz |
|---|---|
| Size | 164.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
103168510fab9d45a980fe7560dcbf20d1cce38320a43904583d23869af3bee1
|
|
BLAKE2b-256 checksum How to use checksums |
f11b86ab3c48f74609de566e6c6fea5493a7bea4c7de485e5a56fa1239c698b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / jsonargparse-4.52.0-py3-none-any.whl
| Download URL | jsonargparse-4.52.0-py3-none-any.whl |
|---|---|
| Size | 174.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1878b16b6be90c3e838aac569784a110fe1eb1806c28e56175cdc7f2e563d78c
|
|
BLAKE2b-256 checksum How to use checksums |
5270e9114d52e9e72daaaeec30ecafe1018a4fbe6288ec35e16822529676b671
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency log