simple-parsing
A small utility to simplify and clean up argument parsing scripts.
What it is and what it does
simple-parsing wraps Python's argparse to let you define command-line arguments as dataclasses instead of repeated add_argument() calls. It generates help text from docstrings and field comments, handles nested and inherited dataclasses, and supports serialization to json/yaml. The core idea is reducing boilerplate: instead of copy-pasting argument definitions, you define an Options dataclass once and reuse it with automatic prefixing for multiple argument groups.
You use it by creating a dataclass with typed fields, then passing it to ArgumentParser.add_arguments() or calling simple_parsing.parse() directly. It depends on docstring-parser to extract help text from comments and typing-extensions for type annotation support. The package requires Python 3.9 or later.
Use it for:
- Machine learning projects where you need to parse training, validation, and test configurations with identical structure but different prefixes.
- Reusing argument definitions across multiple CLI tools in the same codebase without copy-pasting argparse boilerplate.
- Generating clean, auto-documented --help output from dataclass field comments and docstrings.
- Saving and loading command-line configurations to/from json or yaml files for reproducibility.
- Building nested argument hierarchies where subcommands or modules each have their own configuration dataclass.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Transforms argparse scripts into structured, typed command-line interfaces using dataclasses, with support for nesting, inheritance, and automatic help generation from docstrings.
Yes. Low install friction, no known vulnerabilities, MIT license, and active maintenance make it a safe choice. It genuinely reduces argparse boilerplate for projects using dataclasses, especially those with reusable or nested argument groups. Suitable for both small scripts and larger CLI applications.
Install
simple-parsing on PyPI
pip
pip install simple-parsinguv
uv add simple-parsingpoetry
poetry add simple-parsingInstalling simple-parsing
Before you install
Low friction: pure Python wheel with only two runtime dependencies (docstring-parser and typing-extensions). Actively maintained with recent release.
License in practice
MIT License permits unrestricted use, modification, and distribution with minimal obligations—suitable for any project type.
Quickstart
from dataclasses import dataclass
from simple_parsing import ArgumentParser
@dataclass
class Options:
log_dir: str
learning_rate: float = 1e-4
parser = ArgumentParser()
parser.add_arguments(Options, dest="options")
args = parser.parse_args()
print(args.options)
Requires Python 3.9 or later.
Verify before relying
- Whether nesting depth has practical limits or performance implications at scale.
- Whether serialization to json/yaml handles all dataclass field types automatically or requires custom handlers.
- Performance characteristics when parsing very large numbers of arguments or deeply nested structures.
Package facts
| License | MIT License Copyright (c) 2019 Fabrice Normandin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — docstring-parser, typing-extensions |
| Maintenance | actively maintained — 18 days since the last release |
| First released | |
| Downloads | 4,306,956/month — #2,336 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: simple_parsing-0.1.9-py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
argparse-dataclassBuilds command-line interfaces declaratively by…
permissive · top 5,000 on PyPI
draccusDraccus parses command-line arguments and…
permissive · top 5,000 on PyPI
jsonargparsejsonargparse creates command-line interfaces…
permissive · top 5,000 on PyPI
typed-argument-parserA typed, modern replacement for Python's…
permissive · top 15,000 on PyPI
tyrotyro generates command-line interfaces and…
permissive · top 5,000 on PyPI
decliDecli wraps argparse to let you define…
permissive · top 5,000 on PyPI
flexparserflexparser lets you build parsers by writing…
permissive · top 5,000 on PyPI
argdanticBuilds typed command-line interfaces by…
permissive · top 15,000 on PyPI
coqpit-configCoqpit-config provides lightweight…
permissive · top 15,000 on PyPI
coqpitCoqpit provides configuration management…
unclear · top 15,000 on PyPI