Releases: BrianPugh/cyclopts
v3.1.4
Features
- Add
App.update
method. by @BrianPugh in #281
Bug Fixes
- Fix subapp default command/parameter/argument groups. by @BrianPugh in #283
- fix handling for when
Annotated
is inside another type; namelylist[Annotated[...]]
. by @BrianPugh in #289
Full Changelog: v3.1.3...v3.1.4
v3.1.3
Bug Fixes
- Do not interpret choices/default as rich markup by @BrianPugh in #278
- Various speed optimizations. by @BrianPugh in #279
Full Changelog: v3.1.2...v3.1.3
v3.1.2
What's Changed
- Fix
NewType
token count for python >=3.10. by @BrianPugh in #265
Full Changelog: v3.1.1...v3.1.2
v3.1.1
Bug Fixes
- Correctly handle
NewType
type annotations by @BrianPugh in #263
Full Changelog: v3.1.0...v3.1.1
v3.1.0
What's Changed
- New attribute
App.sort_key
that controls command-order in the help page. by @BrianPugh in #258
Full Changelog: v3.0.1...v3.1.0
v3.0.1
Bug Fixes
- Allow for
list[bool]
and similar (list of flags). by @BrianPugh in #251
Full Changelog: v3.0.0...v3.0.1
v3.0.0
Features
- Advanced parsing of user-defined classes (including pydantic/attrs/dataclasses/namedtuple).
- Support parsing of typeddict/dict.
- Improved error message precision/accuracy/helpfulness.
- New convenience types:
UInt8
,Int8
,UInt16
,Int16
,Uint32
,Int32
,Json
. Number
andPath
validators now work with sequences (e.g.list[Path]
).- Additional
POSITIONAL_ONLY
parameters may follow an iterablePOSITIONAL_ONLY
parameter. This allows for programs like:@app.default def foo(inputs: list[Path], output: Path, /): pass
$ python my-program.py input_files/*.txt output.txt
- Now supports the bare
--
special token for forcing all subsequent CLI tokens to be parsed as positional argument. This mimics getopt behavior. - Add "new" group validator
cyclopts.validators.MutuallyExclusive
. Performs same action as the defaultLimitedChoice()
, but may be more intuitive/obvious for developers reading application code. - Improved help-page formatting.
- Various minor bug fixes.
Breaking Changes/Features
-
Drop python3.8 support; add python3.13 support.
-
Remove
Group.converter
andApp.converter
. Their use-cases are a bit contrived, don't provide much value, and increase the maintenance burden of the Cyclopts codebase. -
Change in custom
Parameter.converter
. Previously, the converter had signature:def converter(type_, *values: str): ...
The new signature is:
def converter(type_, tokens: Sequence[Token]): ...
See the new
Token
class. This allows for raising aCoercionError
for the particular offending token, which will result in a more helpful error message for the user. -
App.parse_args
andApp.parse_known_args
now return an additional value,ignored
, which is a dictionary mapping python-variable-names to their type annotation of parameters withparse=False
. -
Different CLI parsing scheme that is more directly similar to python's function rules. If a python variable is
POSITIONAL_OR_KEYWORD
, and a value is specified by keyword, subsequentPOSITIONAL_OR_KEYWORD
parameters in the function signature must be specified by keyword. -
When an iterable-like datatype is specified by keyword, only a single element's worth of tokens will be consumed. To restore the old behavior where tokens are consumed until an option-like argument is reached, set
Parameter.consume_multiple = True
. -
Parameter.negative_bool
values must no longer start with--
. E.g. if it was previously--no-
, it should now beno-
. AValueError
is raised if it starts with a hyphen. -
Parameter.negative_iterable
values must no longer start with--
. E.g. if it was previously--empty-
, it should now beempty-
. AValueError
is raised if it starts with a hyphen. -
Parameter.required
field actually impacts whether or not the Parameter is mandatory. Previously it was only reflected in the help page.
v2.9.9
What's Changed
- Improve program load-time and
--help
performance. by @BrianPugh in #223
Full Changelog: v2.9.8...v2.9.9
v2.9.8
What's Changed
- Use last command's help/version flags. by @BrianPugh in #220
Full Changelog: v2.9.7...v2.9.8