Vigia

Upgrading argparse from 2.x to 3.x

Comparison of the public API of argparse 2.0.1 and 3.0.2, computed automatically from their TypeScript types. A changed signature is a candidate for a breaking change, not a certainty.

Summary

Removed import paths0
Removed exports1
Changed signatures18
Removed class or interface members1
Changed class or interface members45
Newly deprecated0
Requirement changes (engines, peer dependencies)0
New exports24

Removed exports

importexportkindBefore
argparseSubParserclassclass

Changed signatures

exportBeforeAfter
argparse · Actionclassinterface
argparse · PARSERstring"A..."
argparse · OPTIONALstring"?"
argparse · SUPPRESSstring"==SUPPRESS=="
argparse · Namespaceclassinterface
argparse · REMAINDERstring"..."
argparse · ONE_OR_MOREstring"+"
argparse · ZERO_OR_MOREstring"*"
argparse · ArgumentErrorclassinterface
argparse · ArgumentGroupclassinterface
argparse · HelpFormatterclassinterface
argparse · ArgumentParserclassinterface
argparse · ArgumentTypeErrorclassinterface
argparse · RawTextHelpFormatterclassinterface
argparse · BooleanOptionalActionclassinterface
argparse · ActionConstructorOptionsnumber & { _: "ActionConstructorOptions"; }interface
argparse · RawDescriptionHelpFormatterclassinterface
argparse · ArgumentDefaultsHelpFormatterclassinterface

Removed class or interface members

memberimportBefore
ArgumentGroup.add_argument_groupargparse(options?: ArgumentGroupOptions | undefined): ArgumentGroup

Changed class or interface members

memberBeforeAfter
Action.call(parser: ArgumentParser, namespace: Namespace, values: string | string[], optionString: string | null): void(parser: ArgumentParser, namespace: Namespace, values: unknown, option_string?: string | undefined): void
Action.constructor(options: ActionConstructorOptions): Action
Namespace.constructor(options: object): Namespace
ArgumentError.constructor(argument: Action, message: string): ArgumentError
ArgumentGroup.constructor(): ArgumentGroup
ArgumentGroup.get_default(dest: string): any(dest: string): unknown
ArgumentGroup.add_argument(arg: string, options?: ArgumentOptions | undefined): void | (arg1: string, arg2: string, options?: ArgumentOptions | undefined): void(name: string, ...names: string[]): Action | (name: string, ...namesAndOptions: [...string[], ArgumentOptions]): Action
ArgumentGroup.set_defaults(options?: {} | undefined): void(options: object): void
ArgumentGroup.add_mutually_exclusive_group(options?: { required: boolean; } | undefined): ArgumentGroup(options?: MutuallyExclusiveGroupOptions | undefined): MutuallyExclusiveGroup
HelpFormatter.constructor(): HelpFormatter
ArgumentParser.exit(status: number, message: string): void(status?: number | undefined, message?: string | undefined): void
ArgumentParser.error(err: string | Error): void(message: string): void
ArgumentParser.parse_args(args?: string[] | undefined, ns?: object | Namespace | undefined): any<T extends object = Namespace>(args?: string[] | undefined, namespace?: T | undefined): T
ArgumentParser.print_help(): void(file?: Writable | undefined): void
ArgumentParser.constructor(options?: ArgumentParserOptions | undefined): ArgumentParser
ArgumentParser.get_default(dest: string): any(dest: string): unknown
ArgumentParser.print_usage(): void(file?: Writable | undefined): void
ArgumentParser.add_argument(arg: string, options?: ArgumentOptions | undefined): void | (arg1: string, arg2: string, options?: ArgumentOptions | undefined): void(name: string, ...names: string[]): Action | (name: string, ...namesAndOptions: [...string[], ArgumentOptions]): Action
ArgumentParser.set_defaults(options?: {} | undefined): void(options: object): void
ArgumentParser.add_subparsers(options?: SubparserOptions | undefined): SubParser(options?: SubparserOptions | undefined): SubparsersAction
ArgumentParser.parse_known_args(args?: string[] | undefined, ns?: object | Namespace | undefined): any[]<T extends object = Namespace>(args?: string[] | undefined, namespace?: T | undefined): [T, string[]]
ArgumentParser.add_argument_group(options?: ArgumentGroupOptions | undefined): ArgumentGroup(options?: ArgumentGroupOptions | undefined): ArgumentGroup | (title?: string | undefined, description?: string | undefined): ArgumentGroup
ArgumentParser.parse_intermixed_args(args?: string[] | undefined, ns?: object | Namespace | undefined): any<T extends object = Namespace>(args?: string[] | undefined, namespace?: T | undefined): T
ArgumentParser.convert_arg_line_to_args(argLine: string): string[](arg_line: string): string[]
ArgumentParser.parse_known_intermixed_args(args?: string[] | undefined, ns?: object | Namespace | undefined): any[]<T extends object = Namespace>(args?: string[] | undefined, namespace?: T | undefined): [T, string[]]
ArgumentParser.add_mutually_exclusive_group(options?: { required: boolean; } | undefined): ArgumentGroup(options?: MutuallyExclusiveGroupOptions | undefined): MutuallyExclusiveGroup
ArgumentOptions.typestring | Function | undefinedArgumentType | undefined
ArgumentOptions.constanyunknown
ArgumentOptions.nargsstring | number | undefinedNargs | undefined
ArgumentOptions.actionstring | (new (options: ActionConstructorOptions) => Action) | undefinedstring | ActionClass | undefined
ArgumentOptions.choicesstring | string[] | undefinedstring | object | readonly unknown[] | undefined
ArgumentOptions.defaultanyunknown
SubparserOptions.actionstring | undefinedstring | ActionClass | undefined
SubparserOptions.parser_class(new () => any) | undefinedArgumentParserClass | undefined
ArgumentTypeError.constructor(message: string): ArgumentTypeError
ArgumentGroupOptions.argument_defaultanyunknown
RawTextHelpFormatter.constructor(): RawTextHelpFormatter
ArgumentParserOptions.formatter_class(new () => HelpFormatter | ArgumentDefaultsHelpFormatter | RawDescriptionHelpFormatter | RawTextHelpFormatter) | undefinedHelpFormatterFactory | undefined
ArgumentParserOptions.argument_defaultanyunknown
BooleanOptionalAction.call(parser: ArgumentParser, namespace: Namespace, values: string | string[], optionString: string | null): void(parser: ArgumentParser, namespace: Namespace, values: unknown, option_string?: string | undefined): void
BooleanOptionalAction.constructor(options: ActionConstructorOptions): BooleanOptionalAction
SubArgumentParserOptions.formatter_class(new () => HelpFormatter | ArgumentDefaultsHelpFormatter | RawDescriptionHelpFormatter | RawTextHelpFormatter) | undefinedHelpFormatterFactory | undefined
SubArgumentParserOptions.argument_defaultanyunknown
RawDescriptionHelpFormatter.constructor(): RawDescriptionHelpFormatter
ArgumentDefaultsHelpFormatter.constructor(): ArgumentDefaultsHelpFormatter

Newly deprecated

None detected.

Requirement changes (engines, peer dependencies)

None detected.

New exports (24)
importexportkind
argparseNargstype
argparseFileTypeinterface
argparseWritableinterface
argparseActionClassinterface
argparseArgumentTypetype
argparseFileTypeResultinterface
argparseFileTypeOptionsinterface
argparseActionsContainerinterface
argparseSubparsersActioninterface
argparseActionConstructorinterface
argparseHelpFormatterClassinterface
argparseArgumentParserClassinterface
argparseFileTypeConstructorinterface
argparseHelpFormatterFactorytype
argparseHelpFormatterOptionsinterface
argparseNamespaceConstructorinterface
argparseMutuallyExclusiveGroupinterface
argparseArgumentErrorConstructorinterface
argparseHelpFormatterConstructorinterface
argparseMetavarTypeHelpFormatterinterface
argparseArgumentParserConstructorinterface
argparseArgumentTypeErrorConstructorinterface
argparseMutuallyExclusiveGroupOptionsinterface
argparseBooleanOptionalActionConstructorinterface

Frequently asked questions

What are the breaking changes when upgrading argparse from 2 to 3?

Between argparse 2.0.1 and 3.0.2, Vigia found 1 removed exports, 18 changed signatures and 46 removed or changed class or interface members.

What became deprecated in argparse 3?

0 exports or members are newly marked as deprecated in argparse 3.0.2.

For agents

GET https://vigia.coredls.cloud/v1/packages/npm/argparse/upgrade?from=2.0.1&to=3.0.2