- 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.annotations
attribute 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_view
exposes strictly more information, and in a nicer interface.
- The
-
feat: User defined parsers can access the
TypeView
by 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.choices
is inferred whenT | None
whereT
would have inferredchoices
is encountered.
- fix: Route arg help formatting through markdown processing.
- feat: Allow "attribute docstrings" as additional method of documenting args.
- fix: action inference when
default
is anEnv
.
- feat: Update automatic inference to support
date
,time
, anddatetime
parsing (for isoformat).
- feat: Add
help_formatter
system 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
msgspec
based class definitions.
- feat: Add
deprecated
option, allowing deprecation of args, options, and subcommands
- feat: Add
default_short=False
anddefault_long=False
options 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=N
values which would produce sequences. I.e. inferaction=ArgAction.set
in such cases to avoid e.x.num_args=3, action=ArgAction.append
; resulting in nonsensical nested sequence["[]"]
- feat: Add
hidden=True/False
option 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
Dep
on function based commands.
- feat: Add support for
BinaryIO
andTextIO
for 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
action
inference, 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
False
when 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
Env
is used, but no default is supplied.
- Support
yield
in 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 | None
beforeparse
.
- Add
invoke_async
to 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_format
option to allow customizing output formatting.
- Disallow explicit
required=False
in combination with the lack of a field level default.
- Fix regression resulting from
value_name
/field_name
split.
- Split Arg
value_name
/field_name
.value_name
controls help/error output naming.field_name
controls 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
Subcommands
abstraction into Subcommand -
Renames
Subcmd
toSubcommands
-
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
Output
implicit dependency option -
Adds new theme option (currently only applied to custom parser)
-
Adds group option to
Arg
to 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