skillfed

simple-parsing

A small utility to simplify and clean up argument parsing scripts.

simple-parsing v0.1.9 4.3M downloads/30d#2,336 on PyPI
Permissive 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) Active released

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-parsing

uv

uv add simple-parsing

poetry

poetry add simple-parsing

Installing 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

typed argument parsingdataclass command line argumentsargparse wrapperstructured CLI argumentsnested command line configautomatic help from docstringsreusable argument groups
cli-frameworkdataclass-driven

More Utilities packages