Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

argparse

Python-style command options.

Dev workflow and configNPM

GitHubWebsite

1. License

“PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version”

Any use is allowed; keep the PSF copyright notice with the code.

github.com/nodeca/argparse/blob/master/LICENSE

From the package registry and GitHub, checked daily; card checked Nov 11, 2026. Tap a verdict to see its source.How we checkedReport an error

What argparse does

This argparse is a free JavaScript library that reads the options typed after a command in Node.js programs. It copies the argparse module built into Python, so the help screen, error messages and option names work the same way. It is not Python's own module; it is the Node.js version of it.

What people build with it

Options for a build script

A script that builds your site takes --pages 120 or --dry-run, checks that numbers really are numbers and prints a help screen with -h.

One tool with several commands

A small admin tool for your project has separate build and publish commands, each with its own options and help.

Catch a typo in a command name

Someone types "pubish"; the tool answers "maybe you meant 'publish'?" instead of only an error.

Bring a Python tool to Node.js

Your team has a Python script with argparse options; the Node.js version keeps the same option names and help text with few changes.

Handle bad input inside your code

A tool that runs inside a bigger program catches a wrong value as an error object instead of quitting the whole process.

argparse popularity

47 / 100
Gid Score, #2277 overall
385M
downloads a week, npm
515
GitHub stars
2
agent projects use it
argparse: downloads per weeknpm, argparse 384,858,248
argparse: GitHub starsnodeca/argparse 515

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How argparse is used

  • argparse joined the catalog on its public numbers (384,858,248 downloads a week on npm and 515 GitHub stars), not on our project count: it is a dependency in 5 public GitHub projects of our scan, 2 of them set up for AI coding agents.
  • The most used alternative in our scan is Commander (174 projects).
  • Projects that use it most often also use dotenv (100.0%), glob (100.0%), cssnano (80.0%).

Often used with

In 100.0% of its projects
In 100.0% of its projects
In 80.0% of its projects
In 100.0% of its projects
In 60.0% of its projects
In 60.0% of its projects

More about argparse

Funding
  • GitHub Sponsors: https://github.com/puzrin
  • GitHub Sponsors: https://github.com/nodeca
  • 2 GitHub sponsors

See all

More in Dev workflow and config

Alternatives

argparse This page

PSF-2.0Gid 47385M/wk

Commander

Pick Commander for the most common Node.js way to describe commands and options, with chained method calls and many examples.

MITGid 82788M/wk

yargs

Pick yargs when you want commands, help and validation described as one object, plus shell completion.

minimist

Pick minimist when you only need to split --name value pairs into an object, with no help screen or checks.

Compare argparse with another tool

Get started

Tell your AI assistant

“Use the npm package argparse (pin argparse@3.0.4) to parse this Node.js script's options with snake_case names (add_argument, parse_args, store_true), string types like 'int', subcommands via add_subparsers, and suggest_on_error true; read the Python 3.14 argparse docs for details.”

  1. Read the Python argparse documentation for the options; this package has only notes on the differences.

    From github.com/nodeca/argparse/blob/master/README.md

  2. Pass options as one object instead of Python's keyword arguments.

    new ArgumentParser({ description: 'example', add_help: true })

    From github.com/nodeca/argparse/blob/master/README.md

  3. Name types as strings such as 'int', 'float' or 'str'.

    .add_argument('-b', { type: 'int', help: 'help' })

    From github.com/nodeca/argparse/blob/master/README.md

Mistakes to avoid

parser.addArgument('--foo') and parser.parseArgs(), copied from argparse 1.x examples
parser.add_argument('--foo') and parser.parse_args()

Version 3 removed the camelCase aliases; in our run on 3.0.4 both methods were undefined.

new ArgumentParser({ addHelp: false }) or { action: 'storeTrue' }
new ArgumentParser({ add_help: false }) and { action: 'store_true' }

Old option and action names were removed; in our run addHelp threw "got an unexpected keyword argument 'addHelp'".

parser.add_argument('--width', { type: Number }) or type: int as in Python
parser.add_argument('--width', { type: 'int' })

JavaScript has no Python int type, so types are named with strings.

Reading args.dryRun after add_argument('--dry-run')
Read args.dry_run (or set dest explicitly)

Dashes inside option names become underscores; our run printed {"dry_run":true}.

Expecting suggest_on_error on the main parser to also fix typos in a subcommand's choices
Pass suggest_on_error true to each add_parser() call too

In our run the main parser suggested 'publish' for 'pubish', but the publish subcommand did not suggest 'production' for 'prodution' until its own parser had the option.

Questions

Is this Python's argparse?

No. It is a JavaScript copy of Python's module for Node.js, following Python 3.14.6.

Can I use it in a paid product?

Yes. The PSF-2.0 license allows any use; keep the copyright notice.

What changed in version 3?

It follows Python 3.14.6, adds colored help, typo suggestions and built-in TypeScript types, and drops the old camelCase names.

How does it behave on a wrong value?

It prints the usage line and an error and exits with code 2, unless exit_on_error is false; our run showed exit code 2.

Is it still maintained?

Yes. Version 3.0.4 came out on 2026-10-24, after five years at 2.0.1.