- fix: Display Args with the same group identity as alternatives in helptext on the same line.
- fix: Ensure automatic bool variants (--foo/--no-foo) are mutually exclusive.
- fix: Allow negative number arguments and option values.
- fix: Precalculate implicit deps during class construction rather than traversing the output shape.
- fix: Allow options accepting zero-length unbounded num_args.
- feat: Apply default parsing automatically, with Arg.parse_inference == False to disable.
- fix: Use of a synchronous context manager inside an
invoke_asyncinvoke context. - fix: Stripped type aliases losing e.g. Dep metadata.
- fix: Scenario where static defaults were not being shown in helptext.
-
fix: Prioritize Arg.default over dataclass-level default.
Technically this might be considered a breaking change, but the original behavior was unintended.
Arg.defaultshould always take precedence over inferred defaults or class-level defaults.This only manifests in cases where someone was supplying both a class-level default and an
Arglevel default like:foo: Annotated[int, Arg(default=5)] = 10. This should result in a5default but was erroneously yielding10.There's no obvious practical reason to ever supply both with the old behavior because the
Arg.defaultwould never have an effect. Now, it's possible to use theArg.defaultdistinctly from the class level default outside the context of use with cappa.
- fix: Infer class constructor as default for
Destructuredclass.
-
fix: BREAKING CHANGE: Provide simpler
Destructured[T]annotation.Previously
Annotated[T, Arg(destructured=Destructured())], this was comparatively verbose, when there is currently practical use for configuringArgoptions on the destructured root argument.As such the
Destructuredname has been repurposed as a convenience annotation similar toSubcommands.The forms:
Annotated[T, Destructure],Annotated[T, Arg.destructured()],Annotated[T, Arg(destructure=True], andAnnotated[T, Arg(destructure=Destructure())]still remain in the event future use is assigned to configuration on the root field. -
fix: Destructured relative context, e.g. counting.
-
fix: Add support for explicit type alias
Deps. -
fix: Propagation of mutually exclusive options that map to the same
Arg.field_name.
- fix: Lower bounds of dependency versions and test for them.
- feat: Handle python 3.12 syntax for explicit
type <Type>aliases. - fix: Explicit choice sequence runtime error.
- fix: Undocumented completions.
- docs: Add argument validation documentation.
- feat: Test against python 3.14.
- fix: Apply pyright strict typing.
- fix: Function callables ability to depend on implicit Deps.
- docs: Improve docs relating to
Output.
- fix: Sphinx warning in docutils extension with
--jobs.
- feat: Allow
depsto be indirect function reference strings. - feat: Allow styling of individual sections of argument help text.
- fix: Make rich/typing-extensions version requirements more precise.
- fix: Ensure API doesnt yield pyright errors in user code.
- fix: Handle multiple = in explicit arg.
- feat: Add "Self" concept for invoke dependencies.
- fix: Typo in the exported member
HelpFormattable
- fix: Coerce
Env(default=None)toEmptyto avoid interpreting the value as a string.
- fix: Ensure
propagate=Trueargs supply the correct parent context to the arg's action handler.
- fix: Reexport Empty/EmptyType types at the root.
- fix: Optional positional arguments should not get a default value from their action.
- fix: Default formatting when value is None/Empty and formatter is supplied.
- feat: Add
Defaultobject with associated fallback semantics for sequences of default handlers. - feat: Add
ValueFromfor handling default_factory lazily, as well as arbitrary function dispatch. - feat: Add
Stateas object accessible to invoke, Arg.parse, and ValueFrom.callable for sharing state amongst different stages of argument parsing. - fix: Skip non-init fields in dataclasses.
- fix: Required positional arguments in the native parser.
- fix: Infer num_args on unbounded sequence options (e.g.
list[list[str]]annotation on an option). - feat: Add DefaultFormatter as optional input to
show_default.
- fix: Perform choices validation after parse/mapping time.
- feat: Add
Arg.propagate.
- fix: Incorrect handling of methods in Arg.parse.
- fix: Literal contained inside non-variadic tuple should not imply "choices".
- fix: Optional non-variadic tuple should be allowed (None shouldn't fail arity check).
- feat: Add Group.section to enable ordering of groups separately from the items within them.
- fix: invoke(help_formatter=...) not applying to explicitly decorated commands.
-
feat: Support native inference parser for dataclass-like annotation s. Note this contains a minor breaking changes:
- The
Arg.annotationsattribute was swapped forArg.type_view. This was never a documented feature, but rather a side-effect required to implement certain built-in parser inferences. Swapping totype_viewexposes strictly more information, and in a nicer interface.
- The
-
feat: User defined parsers can access the
TypeViewby accepting it as an argument. -
feat: Add new API for defining subcommands as methods.
-
feat: Add Arg.show_default option to optionally avoid displaying default in help text.
-
fix: Only show_default on
--*/--no-*pair bool arguments for the actual default.
- fix: Avoid storing has_value=False values in the parser.
- feat: Introduce
Arg.destructure()andArg.has_value. - chore: Swap custom MISSING/missing for EmptyType/Empty.
- refactor: Adopt the type-lens package.
- fix: Refactor parser combinators into dedicated module, and document the behavior more thoroughly.
- refactor: Pull handling of
--no-*bool arguments out of the parser - fix: Only apply
--no-*handling when there is both a positive and negative variant
- fix: Avoid applying annotated type parsing to default value.
- fix: Ensure compatibility with python 3.13
- fix: Ensure
Arg.choicesis inferred whenT | NonewhereTwould have inferredchoicesis encountered.
- fix: Route arg help formatting through markdown processing.
- feat: Allow "attribute docstrings" as additional method of documenting args.
- fix: action inference when
defaultis anEnv.
- feat: Update automatic inference to support
date,time, anddatetimeparsing (for isoformat).
- feat: Add
help_formattersystem wherein help text rendering can be customized to include or exclude things like default values, or choices. Notably changes to include default values in help text by default.
- feat: Improve union error message.
- feat: Implement exclusive argument groups.
- fix: Eagerly attempt pydantic BaseModel import to ensure its skipped if unavailable.
- feat: Add support for
msgspecbased class definitions.
- feat: Add
deprecatedoption, allowing deprecation of args, options, and subcommands
- feat: Add
default_short=Falseanddefault_long=Falseoptions to command for ease of defining option-heavy commands.
- fix: Ensure class default combined with
default=Env(...)still attempts to read env var (rather than just unconditionally taking the class default).
- Increase minimum typing_extensions bound to reflect actual dependency.
- Fixes bounded-tuple options like
tuple[str, str]to infer asnum_args=2 - Fixes bounded-tuple options to fail parsing if you give it a different number of values
- Fixes "double sequence" inference on explicit
num_args=Nvalues which would produce sequences. I.e. inferaction=ArgAction.setin such cases to avoid e.x.num_args=3, action=ArgAction.append; resulting in nonsensical nested sequence["[]"]
- feat: Add
hidden=True/Falseoption to Command, which allows hiding individual subcommands options.
- fix: Correct the testing.CommandRunner deps signature.
- fix: Error short help should be contextual to the failing command.
- fix: Ensure optional bool retains bool action inference.
- fix: Use eval_type_backport to allow new syntax in python 3.8/9.
- feat: Improve parse error formatting. Include short help by default.
- feat: Support
Depon function based commands.
- feat: Add support for
BinaryIOandTextIOfor representing preconfigured file objects to be returned the caller.
- feat: Support pydantic v1.
- fix: Incorrect error message when using an invalid base class type.
- fix: Process
actioninference, taking into accountOptional/| None.
- feat: Support explicit context managers as invoke dependencies.
- feat: Add docutils directive extension.
- fix: Handle TypeError in mapping failures
- fix: Default bool fields to
Falsewhen omitted.
- fix: zsh completion script error
- feat: Support functions as interface for simple CLIs.
- Support "discriminated unions" (i.e. unions which have type distinctions that affect how they're mapped.)
- Prefer the field default (if set), if an
Envis used, but no default is supplied.
- Support
yieldin invoke dependencies to support context-manager-like dependencies (for example those which require cleanup).
- When used in combination with
parse=..., handle the "optional" part ofT | Nonebeforeparse.
- Add
invoke_asyncto support async invoke functions and dependencies
- Disallow certain combinations of apparently incompatible annotations, i.e. sequences and scalars
- Fix double dash following an invalid option (with num_args>0)
- Fix num_args=-1 on options
- Continue to parse docstrings without docstring_parser extra
- Fix rendering issue with markdown in docstrings
- Make docstring_parser dependency optional
- Fix parser error if option followed unknown argument
- (Hopefully) Configure rich properly to deal with line overflow when printing terminal escape codes.
- Add option for explicit Output object, and add
error_formatoption to allow customizing output formatting.
- Disallow explicit
required=Falsein combination with the lack of a field level default.
- Fix regression resulting from
value_name/field_namesplit.
- Split Arg
value_name/field_name.value_namecontrols help/error output naming.field_namecontrols the the destination field on the dataclass object.
- Ensure output of missing required options is deterministically ordered
- Output all required options when listing out missing required options
- Fix ignore num_args=0 override
- Invoke the specific callable subcommand instance being targeted.
- Supply the parsed Command instance as an invoke dependency.
- Change default backend to
cappa.parser.backend. To opt into argparse backend, explicitly supply it withbackend=cappa.argparse.backend.
- Avoid mutating command when adding meta arguments
- Avoid setting global NO_COLOR env var when disabling color
- Clean up help text output formatting
- Show rich-style help text when using argparse backend
- Allow defining custom callable as an
action. - Improve behavior consuming concatenated short arguments
- Improve behavior consuming concatenated short arguments
- Add metadata to package distribution
- Loosen dependency version specifiers
- Fix
Literal["one", "two"]syntax vsLiteral["one"] | Literal["two"] - Apply custom completions to already "valid" arguments values
- Deduplicate the --completion helptext choices
- The command's name should now always translate to the prog name
- Explicitly provided argv should now not include the prog name
- Correct the version long name when long=True.
- Implement support for PEP-727 help text inference.
- Provide clear error message when a version Arg is supplied without a name.
- Documentation updates
-
Adds native cappa parser option vs argparse
-
Renames render option to "backend"
-
Collapse separate
Subcommandsabstraction into Subcommand -
Renames
SubcmdtoSubcommands -
Adds support for autocompletion when using new parser
-
Removes "rich" extra
-
Adds rich as a required extra dependency
- It is core to custom/colored help formatting for new parser, and the now more-unified stdout/stderr output.
-
rich-argparse needs to now be installed separately, if used
-
-
Adds a new
Outputimplicit dependency option -
Adds new theme option (currently only applied to custom parser)
-
Adds group option to
Argto control how arguments are grouped together in help text -
Adds hidden option to
Arg, to hide arguments from help text. -
Ensures
help=applies to all levels of subcommands