Recent Releases of https://github.com/brianpugh/cyclopts
https://github.com/brianpugh/cyclopts - v3.23.1
Bug Fixes
negative_iterablewith an empty string shouldn't appear in the help screen by @nachocab in https://github.com/BrianPugh/cyclopts/pull/530
Documentation
- Improve contributing docs and .gitignore by @nachocab in https://github.com/BrianPugh/cyclopts/pull/531
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.23.0...v3.23.1
- Python
Published by BrianPugh 10 months ago
https://github.com/brianpugh/cyclopts - v3.23.0
Features
NonExistent*convenience types by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/522
Bug Fixes
- When performing command-similarity search, do not recommend commands that have
show=False. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/521
Documentation
- Improve
consume_multipledocumentation by @nachocab in https://github.com/BrianPugh/cyclopts/pull/517
New Contributors
- @nachocab made their first contribution in https://github.com/BrianPugh/cyclopts/pull/517
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.22.5...v3.23.0
- Python
Published by BrianPugh 11 months ago
https://github.com/brianpugh/cyclopts - v3.22.5
Bug Fixes
- Fix broken command
aliaswhennameis also specified. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/509
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.22.4...v3.22.5
- Python
Published by BrianPugh 11 months ago
https://github.com/brianpugh/cyclopts - v3.22.4
Bug Fixes
- Fix parameter
aliasresolution in dataclass attributes. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/506
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.22.3...v3.22.4
- Python
Published by BrianPugh 12 months ago
https://github.com/brianpugh/cyclopts - v3.22.3
Bug Fixes
- Fix
DivideByZeroerror when countingtuple[bool, ...]by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/498 - Fix interpreting
collections.abc.Sequence[bool]as multiple boolean flags. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/499 - Include root import module in automatic version detection by @whatever60 in https://github.com/BrianPugh/cyclopts/pull/495
New Contributors
- @whatever60 made their first contribution in https://github.com/BrianPugh/cyclopts/pull/495
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.22.2...v3.22.3
- Python
Published by BrianPugh 12 months ago
https://github.com/brianpugh/cyclopts - v3.22.2
Bug Fixes
- Fix erroneous
MissingArgumentErrorif an empty iterable value is provided in a config file. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/492
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.22.1...v3.22.2
- Python
Published by BrianPugh about 1 year ago
https://github.com/brianpugh/cyclopts - v3.22.1
Bug Fixes
- Fix generating help for annotated enums with typealias by @Rubikoid in https://github.com/BrianPugh/cyclopts/pull/487
New Contributors
- @Rubikoid made their first contribution in https://github.com/BrianPugh/cyclopts/pull/487
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.22.0...v3.22.1
- Python
Published by BrianPugh about 1 year ago
https://github.com/brianpugh/cyclopts - v3.22.0
Features
- Add
App.aliasto conveniently assign additional names to commands. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/486
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.21.0...v3.22.0
- Python
Published by BrianPugh about 1 year ago
https://github.com/brianpugh/cyclopts - v3.21.0
Features
cyclopts.validators.LimitedChoiceimprovements (by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/483):- If
LimitedChoiceminvalue is negative, then all parameters in the group must be specified. - New
LimitedChoiceargumentallow_none=False. IfTrue, then also allow 0 CLI parameters (even ifminis greater than 0).
- If
- New group validator
all_or_none, which is just the instantiated objectLimitedChoice(-1, allow_none=True). - Mutually exclusive object
cyclopts.validators.mutually_exclusivefor convenience by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/482
Bug Fixes
- Fix multiple anonymous groups resolving to the same group. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/481
Documentation
- Add User-Specified Config File example. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/480
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.20.0...v3.21.0
- Python
Published by BrianPugh about 1 year ago
https://github.com/brianpugh/cyclopts - v3.20.0
This release contains changes that may change some behavior for some users, but is mostly benign. If using custom Group Validators, please give this release more attention.
Features
- Give Commands/Arguments/Parameters higher priority (in that order) on the help-page. This places "Commands" at the top, and "Arguments" next to "Parameters":
╭─ Commands ────────────────────────────────────────────────────────────╮ │ --help -h Display this message and exit. │ │ --version Display application version. │ ╰───────────────────────────────────────────────────────────────────────╯ ╭─ Arguments ───────────────────────────────────────────────────────────╮ │ * FOO [required] │ ╰───────────────────────────────────────────────────────────────────────╯ ╭─ Parameters ──────────────────────────────────────────────────────────╮ │ * BAR --bar [required] │ ╰───────────────────────────────────────────────────────────────────────╯SeeGroup.sort_keyfor more details. By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/476
Bug Fixes
- config.Env: recombine remaining_keys into a single key if the found argument doesn't have any sub-arguments. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/472
- Always call all group-validators; provide all arguments within the group. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/473
- Previously, only validators of groups that were provided arguments were executed. Also, only arguments that had parsed tokens were supplied. This was as bug and went against documented behavior.
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.19.0...v3.20.0
- Python
Published by BrianPugh about 1 year ago
https://github.com/brianpugh/cyclopts - v3.19.0
Features
- Add
Parameter.aliasby @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/460- Similar to
Parameter.name, but it adds additional option names/flags to cyclopts-generated names instead of completely overriding.
- Similar to
Bug Fixes
- Don't explicitly invoke pydantic validators if the type_adapter was used during conversion. Fixes double-invoking pydantic validators. By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/462
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.18.0...v3.19.0
- Python
Published by BrianPugh about 1 year ago
https://github.com/brianpugh/cyclopts - v3.18.0
Features
- Stop
KeyboardInterruptfrom printing tracebacks by @gremlation in https://github.com/BrianPugh/cyclopts/pull/448- The new behavior catches and suppresses
KeyboardInterruptfrom end-user ctrl-c action by default. This is done because generally the resulting stack trace is not useful to the end-user of the CLI. To disable this feature, setApp(suppress_keyboard_interrupt=False).
- The new behavior catches and suppresses
- Allow digit short flags (e.g.
-2). These flags can only exist if the developer explicitly sets them withParameter, and at that point they must be aware of the ambiguity between a digit-flag and a negative integer. By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/455
New Contributors
- @gremlation made their first contribution in https://github.com/BrianPugh/cyclopts/pull/448
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.17.0...v3.18.0
- Python
Published by BrianPugh about 1 year ago
https://github.com/brianpugh/cyclopts - v3.17.0
Features
- Add
Parameter.negative_nonefeature. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/446 - Parse combined short flags (e.g. like
ls -alh) by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/453
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.16.2...v3.17.0
- Python
Published by BrianPugh about 1 year ago
https://github.com/brianpugh/cyclopts - v3.16.2
Bug Fixes
- Only display COMMANDS in the help-page if there are registered commands (ignoring help/version flags). By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/441
- Don't erroneously print "Did you mean" message when a tuple is missing an argument. By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/444
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.16.1...v3.16.2
- Python
Published by BrianPugh about 1 year ago
https://github.com/brianpugh/cyclopts - v3.16.1
Bug Fixes
- Do not invoke
Parameter.show_defaultcallable with aninspect._empty. FixesHex*types exception when attempting to display defaults and a default is not present. By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/438
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.16.0...v3.16.1
- Python
Published by BrianPugh about 1 year ago
https://github.com/brianpugh/cyclopts - v3.16.0
Features
- Rename
format_cyclopts_error->CycloptsPaneland make it public. Useful if you want to format rich Panels similar to Cyclopts. By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/436
Bug Fixes
- Fix parsing message for class validator by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/433
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.15.0...v3.16.0
- Python
Published by BrianPugh about 1 year ago
https://github.com/brianpugh/cyclopts - v3.15.0
Features
- Add (optional)
triosupport by @aneeshusa in https://github.com/BrianPugh/cyclopts/pull/431
Bug Fixes
- Add package description by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/429
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.14.2...v3.15.0
- Python
Published by BrianPugh about 1 year ago
https://github.com/brianpugh/cyclopts - v3.14.2
Bug Fixes
- Fix
Parameter.negativeinheritance for classes. By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/426
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.14.1...v3.14.2
- Python
Published by BrianPugh about 1 year ago
https://github.com/brianpugh/cyclopts - v3.14.1
Bug Fixes
- Fix support of
Enummember aliases. Thanks @beskep for the fix! By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/424
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.14.0...v3.14.1
- Python
Published by BrianPugh about 1 year ago
https://github.com/brianpugh/cyclopts - v3.14.0
Features
- Show
cyclopts.config.Envvariables in the help-page by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/417- Defaults to be enabled, but can be disabled by setting
cyclopts.config.Env.show = False.
- Defaults to be enabled, but can be disabled by setting
- Treat classes with only
VAR_POSITIONALargument as a builtin. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/419- This allows cyclopts to have a higher chance of successfully parsing custom classes that only have
*argsand no other positional arguments.
- This allows cyclopts to have a higher chance of successfully parsing custom classes that only have
- Allow
Parameter.show_defaultto be a callable. AddHexUInt*types tocyclopts.typesthat display the default value as hexadecimal in the help-page. By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/410
Bug Fixes
- Fix
cyclopts.config.Enverror when aParameterre-uses the same environment variable. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/416 - Add missing setter for
App.sort_keyby @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/420
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.13.1...v3.14.0
- Python
Published by BrianPugh about 1 year ago
https://github.com/brianpugh/cyclopts - v3.13.1
Bug Fixes
- Fix
TypeAliasresolution for multi-token types (e.g. tuple). by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/414
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.13.0...v3.13.1
- Python
Published by BrianPugh about 1 year ago
https://github.com/brianpugh/cyclopts - v3.13.0
Features
- Handle the first block of docstring text as a potential multi-line short description. It is no longer possible to have a long-description without a short description. This should be more intuitive and lead to easier-to-debug docstrings. By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/401
Bug Fixes
- Somewhat fix false-positive of detecting
pytestwhen subprocessing a python script from within apytestenvironment. By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/404 - Improved
functools.partialsupport. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/396 - Don't use pydantic features if pydantic v1 is installed. Addresses #408 by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/409
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.12.0...v3.13.0
- Python
Published by BrianPugh about 1 year ago
https://github.com/brianpugh/cyclopts - v3.12.0
Features
- add
datetimeandtimedeltasupport. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/391
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.11.2...v3.12.0
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.11.2
Bug Fixes
- Respect individual class field annotated converters. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/386
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.11.1...v3.11.2
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.11.1
Bug Fixes
- Improve
Appsubclassing by @thejcannon in https://github.com/BrianPugh/cyclopts/pull/384
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.11.0...v3.11.1
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.11.0
Lots of pydantic-specific improvements in this release.
Features
- Completely disable cyclopts conversion mechanisms for
pydantictype hints and defer responsibility to pydantic. Notably, pydantic union discriminators now work correctly. By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/379 - Add pydantic
Field.descriptionto the help-resolution-hierarchy. By @pablospe in https://github.com/BrianPugh/cyclopts/pull/375 - If pydantic is used in your project (detected as pydantic being imported), pydantic will additionally validate coerced data. This means that pydantic validator types (e.g.
pydantic.PositiveInt) now work.
Bug Fixes
- Do not catch
pydantic.ValidationErrorfrom calling user's command. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/378 - Fix empty space in HelpPanel when combining panels (introduced in v3.10.0). by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/380
New Contributors
- @pablospe made their first contribution in https://github.com/BrianPugh/cyclopts/pull/375
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.10.1...v3.11.0
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.10.1
What's Changed
- Fix
Config.search_parentswhen used on relative paths. By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/371
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.10.0...v3.10.1
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.10.0
Features
- By default, registering a subapp will set it's help and version "show" attribute to
False, making--helpand--versionnot show up in the subapp's help page. This is done because the previous behavior (showing these flags) mostly cluttered the help-page and wasn't particularly useful. By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/363 - Always apply
Parameter.validatorto command-signature default-values. Consider the following code: ``` import cyclopts from pathlib import Path
def command(file: cyclopts.types.ExistingFile = Path("foo.bin")): pass
cyclopts.run(command)
``
Previously, if no file was specified,filewould bePath("foo.bin"), but the validator that checks if the file exists would have **not** ran. This is unintuitive/unexpected to the developer. Now Cyclopts always runs validators, even on default values.
* By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/364
* Render default/choices/required styling (colors!) in the help page. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/365
* More types:uint64/int64/Email/URL/Port` by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/366
Bug Fixes
- Fix some situations where
InvalidCommandErrordidn't result in printing command suggestions. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/358
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.9.3...v3.10.0
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.9.3
Bug Fixes
- Fix
from __future__ import annotationstype-resolution. By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/355- This does not solve issues when the annotated class is defined in a closure, but this should be pretty uncommon for Cyclopts use-cases.
Docs
- Add cookbook example for reading from path or stdin. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/354
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.9.2...v3.9.3
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.9.2
Features
- List available commands on
InvalidCommandError. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/349
Bug Fixes
- Fix
dataclasses.default_factoryon the help-page. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/350
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.9.1...v3.9.2
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.9.1
Bug Fixes
- Some typing fixes by @kiyoon in https://github.com/BrianPugh/cyclopts/pull/343
- Mildly breaking: remove
config.Env.splitattribute; it wasn't actually used/performing it's intended functionality. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/344
Docs
- Exit non-zero on exception when
pprinttraceback with rich by @thejcannon in https://github.com/BrianPugh/cyclopts/pull/340
New Contributors
- @thejcannon made their first contribution in https://github.com/BrianPugh/cyclopts/pull/340
- @kiyoon made their first contribution in https://github.com/BrianPugh/cyclopts/pull/343
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.9.0...v3.9.1
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.9.0
Features
- Add
end_of_options_delimiter="--"option toApp(and parsing methods). by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/333
Bug Fixes
- Fix incorrectly parsing json
nullvalues as the string "None". by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/334
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.8.1...v3.9.0
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.8.1
Bug Fixes
- Show choices in help output for
Sequenceby @aneeshusa in https://github.com/BrianPugh/cyclopts/pull/331
New Contributors
- @aneeshusa made their first contribution in https://github.com/BrianPugh/cyclopts/pull/331
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.8.0...v3.8.1
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.8.0
Features
- Add extension checking to
cyclopts.validators.Path. By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/329- e.g.
Annotated[Path, Parameter(validator=validators.Path(ext=(.jpg, .jpeg)))]. - Add some convenience types for common-extensions:
BinPath ExistingBinPath CsvPath ExistingCsvPath ImagePath ExistingImagePath JsonPath ExistingJsonPath Mp4Path ExistingMp4Path TomlPath ExistingTomlPath TxtPath ExistingTxtPath YamlPath ExistingYamlPathIf you have a suggestion for a common file extension to add, please open an issue and we can handle it on a case-by-case basis.
- e.g.
Bug fixes
- Fix incorrect parsing of
-jflag by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/330
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.7.0...v3.8.0
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.7.0
This release primarily extends the features of v3.6.0
Features
- Json data can now be passed both positionally, and via keyword to lists. I.e.
bash $ myscript '[1,2,3]'This feature is enabled by default, EXCEPT for the case where each element is a string (e.g.list[str]). To enable it for these cases, see next bullet point. - 2 new
Parameterconfigurations:Parameter.json_dict: Optional[bool]- Whether or not to allow json-like data for dicts.Nonebe default, which is the same asTrueexcept when the annotated class is union'd with astr.Parameter.json_list: Optional[bool]- Whether or not to allow json-like data for lists.Nonebe default, which is the same asTrueexcept when each element of the annotated class isstr.
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.6.0...v3.7.0
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.6.0
New Features
- Allow parsing of json data if object is dict-like. Works for both environment variables, as well as cli variables. For example, the following are equivalent:
bash $ movie-maintainer add --movie.title 'Furiosa: A Mad Max Saga' --movie.year 2024 $ movie-maintainer add --movie='{"title": "Mad Max: Fury Road", "year": 2024}' $ MOVIE='{"title": "Mad Max: Fury Road", "year": 2024}' movie-maintainer addBy @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/285
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.5.1...v3.6.0
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.5.1
Bug Fixes
cyclopts.run: fix type-hints for coroutines by @Tinche in https://github.com/BrianPugh/cyclopts/pull/323
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.5.0...v3.5.1
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.5.0
Features
- Add argument/attribute
App.help_on_errorthat will print the command's help-page before printing any Cyclopts runtime error. Disabled by default by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/316 - Add "did you mean" suggestions to
MissingArgumentError. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/317
Bug Fixes
- Fairly big bugfix: Fix Pydantic attribute annotations. Previously any
Annotated[..., Parameter(...)]on a pydanticBaseModelattribute was accidentally not applied. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/321 - fix obj check in
Parameter.__call__; only fixes an unnecessary copy and code semantics. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/322
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.4.1...v3.5.0
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.4.1
Bug Fixes
- Further improve config-file-caching that was introduced in v3.4.0. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/315
- Unit tests should "just work" when chdir after a configuration has been initially read. Configurations will be automatically re-read if a change in path or contents has been detected. Calling
importlib.reloadis no longer required.
- Unit tests should "just work" when chdir after a configuration has been initially read. Configurations will be automatically re-read if a change in path or contents has been detected. Calling
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.4.0...v3.4.1
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.4.0
Feature
cyclopts.runconvenience function for terser, simpler short scripts by @Tinche in https://github.com/BrianPugh/cyclopts/pull/305 Simple applications can now be written like: ```python import cyclopts
def main(name: str, age: int): print(f"Hello {name}, you are {age} years old.")
cyclopts.run(main) ```
Bug Fixes
- Fix incorrect cache-hits for config-reads. This would happen if the cwd changes after initial config file read (highly uncommon except in unit-tests). By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/310
New Contributors
- @Tinche made their first contribution in https://github.com/BrianPugh/cyclopts/pull/305
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.3.1...v3.4.0
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.3.1
Breaking Changes / Bug Fixes
The breaking changes are minimal and probably negatively impacts 0 users, but are listed here for completeness.
* Cyclopts now properly resolves aliases (and similar) for attrs and pydantic.
- The
cyclopts.field_info.FieldInfono longer is a subclass ofinspect.Parameter; it is now an independent class that mimics many ofinspect.Parameterattributes. The class's__init__now takesnames: tuple[str, ...]instead of a singlename: str. This is because certain-dataclass-like objects (namely, pydantic) allows for multiple python-variables to be mapped to the same attribute. The class still maintains aname: strproperty that returns the first element of thenamesattribute. This single name is used whenever an arbitrary choice for selecting a field's name needs to be used.
It was never intended for users to directly instantiate this class, and the name property makes it backwards compatible for those accessing the object. Probably noone actually accesses FieldInfo objects outside of Cyclopts' internals.
- In some situations, an
ArgumentOrderErrorcould be erroneously raised when anUnknownOptionErrorwould have been more appropriate. In those situations, anUnknownOptionErroris now raised.
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.3.0...v3.3.1
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.3.0
Features
cyclopts.edit()to launch text editor for user input. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/303
Bug Fixes
- improved pytest warning variable-name detection. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/301
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.2.1...v3.3.0
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.2.1
Features
- Warn if cyclopts application is invoked with no python arguments within pytest. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/300
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.2.0...v3.2.1
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.2.0
Features
- Allow Parameter to be used as a decorator. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/295 ```python from cyclopts import App, Parameter from dataclasses import dataclass
app = App(name="movie-maintainer")
@Parameter(name="*") @dataclass class Movie: title: str year: int
@app.command def add(movie: Movie): print(f"Adding movie: {movie}")
app() ``` See docs example for more information.
Internal
- To allow the
@Parameterdecorator, we Introduce a hidden__cyclopts__attribute that gets attached to decorated objects. Currently only created/used when@Parameteris used.
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.1.5...v3.2.0
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.1.5
What's Changed
- Better handling of nested meta apps by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/291
- Fix converters/validators getting the wrong type for nested Annotated[Parameter(...)] by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/293
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.1.4...v3.1.5
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.1.4
Features
- Add
App.updatemethod. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/281
Bug Fixes
- Fix subapp default command/parameter/argument groups. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/283
- fix handling for when
Annotatedis inside another type; namelylist[Annotated[...]]. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/289
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.1.3...v3.1.4
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.1.3
Bug Fixes
- Do not interpret choices/default as rich markup by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/278
- Various speed optimizations. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/279
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.1.2...v3.1.3
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.1.2
What's Changed
- Fix
NewTypetoken count for python >=3.10. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/265
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.1.1...v3.1.2
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.1.1
Bug Fixes
- Correctly handle
NewTypetype annotations by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/263
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.1.0...v3.1.1
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.1.0
What's Changed
- New attribute
App.sort_keythat controls command-order in the help page. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/258
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.0.1...v3.1.0
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v3.0.1
Bug Fixes
- Allow for
list[bool]and similar (list of flags). by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/251
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v3.0.0...v3.0.1
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts -
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. NumberandPathvalidators now work with sequences (e.g.list[Path]).- Additional
POSITIONAL_ONLYparameters may follow an iterablePOSITIONAL_ONLYparameter. This allows for programs like:python @app.default def foo(inputs: list[Path], output: Path, /): passbash $ 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.converterandApp.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:python def converter(type_, *values: str): ...The new signature is:python def converter(type_, tokens: Sequence[Token]): ...See the newTokenclass. This allows for raising aCoercionErrorfor the particular offending token, which will result in a more helpful error message for the user. App.parse_argsandApp.parse_known_argsnow 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_KEYWORDparameters 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_boolvalues must no longer start with--. E.g. if it was previously--no-, it should now beno-. AValueErroris raised if it starts with a hyphen.Parameter.negative_iterablevalues must no longer start with--. E.g. if it was previously--empty-, it should now beempty-. AValueErroris raised if it starts with a hyphen.Parameter.requiredfield actually impacts whether or not the Parameter is mandatory. Previously it was only reflected in the help page.
- Python
Published by BrianPugh over 1 year ago
https://github.com/brianpugh/cyclopts - v2.9.9
What's Changed
- Improve program load-time and
--helpperformance. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/223
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.9.8...v2.9.9
- Python
Published by BrianPugh almost 2 years ago
https://github.com/brianpugh/cyclopts - v2.9.8
What's Changed
- Use last command's help/version flags. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/220
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.9.7...v2.9.8
- Python
Published by BrianPugh almost 2 years ago
https://github.com/brianpugh/cyclopts - v2.9.7
Improvements
- Optimize
--helpperformance by passing down the App version to the help/version commands by @daudef in https://github.com/BrianPugh/cyclopts/pull/217
New Contributors
- @daudef made their first contribution in https://github.com/BrianPugh/cyclopts/pull/217
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.9.6...v2.9.7
- Python
Published by BrianPugh almost 2 years ago
https://github.com/brianpugh/cyclopts - v2.9.6
Bug Fixes
- Fix
--helpcrash when a mutable default is assigned to a parameter by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/216 - Fix chaining example in docs. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/214
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.9.5...v2.9.6
- Python
Published by BrianPugh almost 2 years ago
https://github.com/brianpugh/cyclopts - v2.9.5
Bug Fixes
- Fix type hints for
@app.defaultdecorator. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/211
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.9.4...v2.9.5
- Python
Published by BrianPugh almost 2 years ago
https://github.com/brianpugh/cyclopts - v2.9.4
What's Changed
- loosen python version from
^3.8to>=3.8by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/201
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.9.3...v2.9.4
- Python
Published by BrianPugh almost 2 years ago
https://github.com/brianpugh/cyclopts - v2.9.3
What's Changed
- Improved type hints by @andersjel in https://github.com/BrianPugh/cyclopts/pull/194
New Contributors
- @andersjel made their first contribution in https://github.com/BrianPugh/cyclopts/pull/194
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.9.2...v2.9.3
- Python
Published by BrianPugh about 2 years ago
https://github.com/brianpugh/cyclopts - v2.9.2
Bug Fixes
- More robustly resolve Unions when generating
--helpchoices from Literal/Enum. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/193
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.9.1...v2.9.2
- Python
Published by BrianPugh about 2 years ago
https://github.com/brianpugh/cyclopts - v2.9.1
Bug Fixes
- resolve help-choices for python3.12 type-statements. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/192
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.9.0...v2.9.1
- Python
Published by BrianPugh about 2 years ago
https://github.com/brianpugh/cyclopts - v2.9.0
Features
- Python 3.12 type statement support (
TypeAliasType). by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/191
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.8.0...v2.9.0
- Python
Published by BrianPugh about 2 years ago
https://github.com/brianpugh/cyclopts - v2.8.0
What's Changed
- Introduced new attribute,
App.version_format. The verstion string was previously printed as-is, but is now formatted with the specified format, falling back tohelp_formatif not specified. By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/188
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.7.1...v2.8.0
- Python
Published by BrianPugh about 2 years ago
https://github.com/brianpugh/cyclopts - v2.7.1
Bug Fixes
- Have meta apps inherit their parenting config. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/184
Misc
- deferred
import docstring_parserby @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/182
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.7.0...v2.7.1
- Python
Published by BrianPugh about 2 years ago
https://github.com/brianpugh/cyclopts - v2.7.0
Features
- New
App.configfield, that allows the loading of defaults from files.cyclopts.config.Json- Load defaults from a json file.-
cyclopts.config.Yaml- Load defaults from a yaml file. -
cyclopts.config.Toml- Load defaults from a toml file. -
cyclopts.config.Env- Load defaults from environment variables.
- New
Parameter.env_var_splitattribute. Defaults tocyclopts.env_var_split, which behaviors similarly to Click's multiple values from environment values.
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.6.2...v2.7.0
- Python
Published by BrianPugh about 2 years ago
https://github.com/brianpugh/cyclopts - v2.6.2
Features
- New
App.help_format="rich"option.
Bug Fixes
- Consistent help formatting (that respects
help_format) across the different sections of the generated help-page. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/166 help_formatis now keyword only. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/164- Improve type inference when using decorators with pyright by @breathe in https://github.com/BrianPugh/cyclopts/pull/172
New Contributors
- @breathe made their first contribution in https://github.com/BrianPugh/cyclopts/pull/172
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.6.1...v2.6.2
- Python
Published by BrianPugh about 2 years ago
https://github.com/brianpugh/cyclopts - v2.6.1 - Faster Importing
Significantly improve cyclopts import speed by lazy loading dependencies.
What's Changed
- defer
asyncioandimportlibimport by @OrHayat in https://github.com/BrianPugh/cyclopts/pull/154 - defer optional
pydanticimport, speeding up initial import by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/155 - defer
richimport. Also defer difflib by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/156
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.6.0...v2.6.1
- Python
Published by BrianPugh about 2 years ago
https://github.com/brianpugh/cyclopts - v2.6.0
Features
- Add
App.name_transformby @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/147 - Add
Parameter.name_transformby @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/149
This release adds two new fields: App.name_transform and Parameter.name_transform. The function's responsibility is to convert python identifiers to their CLI counterparts and has signature:
def name_transform(s: str) -> str:
...
These name transforms can be set at a global level for your app:
app = App(
name_transform=lambda name: name, # don't modify the name at all. This applies to command names.
default_parameter=Parameter(name_transform=lambda name: name), # This applies to parameter names.
)
They can also be set in individual subapps (subapps inherit name_transform from their parent), or in individual Annotated[...., Parameter(name_transform=my_custom_transform)] definitions.
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.5.1...v2.6.0
- Python
Published by BrianPugh about 2 years ago
https://github.com/brianpugh/cyclopts - v2.5.1
Bug Fixes
- Fix displaying default if
required=Trueand no default is present. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/146
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.5.0...v2.5.1
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v2.5.0
What's Changed
- Added support for Postponed Evaluation of types annotations (PEP-563) by @OrHayat in https://github.com/BrianPugh/cyclopts/pull/138
- Move special-flag parsing logic from parseargs into parseknown_args by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/130
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.4.2...v2.5.0
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v2.4.2
Bug Fixes
- Unfreeze helpflags and versionflags; create/delete commands on set/get by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/127. Addresses #126
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.4.1...v2.4.2
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v2.4.1
Bug Fixes
- fixed showing choices of list,tuples and set type annotations by @OrHayat in https://github.com/BrianPugh/cyclopts/pull/123
- Handle bare tuple annotation; more robust union logic. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/125
New Contributors
- @OrHayat made their first contribution in https://github.com/BrianPugh/cyclopts/pull/123
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.4.0...v2.4.1
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v2.4.0
Features
- Added
asyncfunction support by @nesb1 in https://github.com/BrianPugh/cyclopts/pull/112 - Introduces a new exception:
UnknownOptionError(see "Breaking Changes" below).
Breaking Changes
The following outlines incredibly-minor breaking changes:
* Introduces a new exception: UnknownOptionError.
* Change negative-flag-assignment-exception from ValidationError to generic CycloptsError (ValidationError inherits from CycloptsError).
* e.g. --no-flag=True now raises CycloptsError instead of ValidationError.
* This may only impact people who were specifically catching a ValidationError for this in a meta-app. This is an esoteric scenario that I imagine it doesn't exist in the wild.
* Change exception for unknown option token from ValidationError to UnknownOptionError.
* I also imagine this is a rare currently-in-the-wild scenario; anyone attempting to catch this exception in a meta-app is probably catching a CycloptsError instead of a ValidationError.
Bug Fixes
- Fixed incorrectly pythonvariable->clioption translated names. Addresses #110.
- Fixes indexing errors when validators/converters raise exceptions without messages.
New Contributors
- @nesb1 made their first contribution in https://github.com/BrianPugh/cyclopts/pull/112
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.3.2...v2.4.0
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v2.3.2
Bug Fixes
- More fixes for parsing list of tuples with insufficient arguments by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/109
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.3.1...v2.3.2
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v2.3.1
Bug Fixes
- Fix
convertofTuple[str]. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/106 - Populate missing console for some cyclopts errors by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/107
- Fix poor handling of missing or non-divisible
token_countvalues. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/108
Mentions
- Shoutout to @OrHayat for the well-crafted bug reports!
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.3.0...v2.3.1
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v2.3.0
Features
- Allow specifying a Rich console in App.init by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/99
- Allow deleting of commands, e.g.
del app['foo']. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/91
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.2.0...v2.3.0
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v2.2.0
What's Changed
- Added
App.help_formatwhich allows for rst and markdown docstring formatting. Defaults to rst. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/85
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.1.2...v2.2.0
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v2.1.2
Bug Fixes
- Fix recursive-parent default_parameter resolution by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/83
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.1.1...v2.1.2
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v2.1.1
Bug Fixes
- Support python3.10 pipe unions. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/80
- Double check function docstring if it has a valid short-description by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/82
- Improve type hints. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/79
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.1.0...v2.1.1
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v2.1.0
Features
- Expose
App.parse_commandsto public API (previously internally named_parse_command_chain).
Bug Fixes
- Fix crash when displaying help where the only parameter has
show=False.
Documentation
- Added a cookbook example of how to use
pyproject.tomlin a CLI project. - Fixed out-of-date meta-app info.
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v2.0.0...v2.1.0
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v2.0.0
Cyclopts v2 introduces many new features, and more robust handling of complicated applications. Cyclopts v2 is mostly backwards compatible with v1. Most breaking changes fall under the "advanced users" category and can be fixed with minimal changes.
Features & Improvements
- Command & Parameter Groups:
- Every command & parameter belongs to one-or-more groups now.
- The name of the group is the title of the panel it will show up in on the help-page.
- A group can have
converterandvalidator:- New Group Validator:
cyclopts.validator.LimitedChoice:- Allows for only a certain number of CLI specifications within the group.
- Default behavior is "mutually-exclusive" within the group.
- New Group Validator:
- New default group assignment based on parameter positioning:
- Positional-only arguments now default to being parsed into the
App.group_argumentsgroup. This group defaults toGroup("Arguments").- All other arguments now default to being parsed into the
App.group_parametersgroup. This group defaults toGroup("Parameters").
- All other arguments now default to being parsed into the
- Positional-only arguments now default to being parsed into the
- Improved Pydantic
@validate_callsupport. - Commands can now be hidden via
App.show=False. I.e. decorate a function with@app.command(show=False). - A custom "usage" string can now be specified via
App.usage. - Improved default error messages by not allowing values that begin with a hyphen by default (and instead treating them as keyword options). This is controlled with the new
Parameter.allow_leading_hyphen=Falsefield. - Iterable types (e.g.
List) now consume all remaining valid tokens, regardless if specified as positional or keyword. - Untyped parameters' type is now inferred from the non-None default value's type. If
Noneor no default is provided, falls back tostr. - The
intcoercion logic now accepts decimal numbers from the CLI. It will firstround, then cast to anint. cyclopts.convert(previouslycyclopts.coerce) now takes an optional callableconverter, allowing custom-converters to leverageconvert's list/tuple/etc parsing abilities, while leaving final element-conversion to a custom function.- Introduce the following
Pathannotated types:ExistingPath, ResolvedPath, ResolvedExistingPath, Directory, ExistingDirectory, ResolvedDirectory, ResolvedExistingDirectory, File, ExistingFile, ResolvedFile, ResolvedExistingFile - Introduce the following
Numberannotated types:PositiveFloat, NonNegativeFloat, NegativeFloat, NonPositiveFloat, PositiveInt, NonNegativeInt, NegativeInt, NonPositiveInt
Breaking Changes
Cyclopts v2 is mostly backwards compatible with v1. Most breaking changes fall under the "advanced users" category.
* The new Parameter.allow_leading_hyphen=False feature's default is opposite of the default behavior in Cyclopts v1. For most use-cases, the new behavior is better. This primarily impacts those using a meta-app.
If using a meta-app, the signature should probably be updated to be like:
@app.meta.default
def main(*tokens: Annotated[str, Parameter(show=False, allow_leading_hyphen=True)]):
...
* If Parameter.allow_leading_hyphen==False, Iterable types (e.g. List) now consume all remaining tokens until an option is reached.
* If Parameter.allow_leading_hyphen==True, Iterable types (e.g. List) now consume all remaining tokens.
* Parameter.token_count has been removed. The feature was kind of broken to begin with, and significantly increased code complexity. We can revisit this feature in the future if someone needs it.
* App.help_title_commands has been removed. Use the new App.group_commands feature to modify the default parameters help-page panel title. E.g. app.group_commands = "My Different Commands Title"
* App.help_title_parameters has been removed. Use the new App.group_arguments and App.group_parameters feature to modify the default parameters help-page panel title.
* Renamed cyclopts.coerce to cyclopts.convert for naming consistency.
* Untyped parameters' types are now inferred from the non-None default value's type. If the default is None or no default is provided, falls back to str. E.g.
``
# old behavior
def foo(value = 5):
#value` would be interpreted as a string.
# new behavior
def foo(value = 5):
# value would be interpreted as a int because thats type(5).
``
* TheValidatorandConverterprotocols (type-hinting) have been removed and replaced with justCallable. The more-specific type-hinting made typical use-case a bit more tedious than it really needed to be.
*createboundarguments` is no longer part of the public API.
Bug Fixes
- Allow explicit value setting of a positive boolean flag with an
=. I.e.--my-flag=Trueor--my-flag=false. - Fixed
cyclopts.validators.Patherror messages. Pathvalidator now only checks if the path is a file/directory if it exists. Previously it would always try to check.- Many, many, many more...
Special Thanks
Special thanks to @ravencentric for user-testing and providing quick and useful feedback!
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v1.3.0
Features
- Configurable boolean and iterable negative prefixes. Defaults are
--no-and--empty-, respectively. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/38 - Support multiple validators for each
Parameter. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/43 - Allow specified
App.versionto be a callable. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/44
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v1.2.0...v1.3.0
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v1.2.0
Features
Appnow takes an optional parameterdefault_parameter: Parameterthat allows the configuration of what values a defaultParameteruses. Parameters now have a resolution order for determining configuration values. Basically it goes (highest-to-lowest priority)annotated parameter->parenting app default->parenting-parenting app default->.... by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/33- New classmethod
Parameter.combinewhich can construct a new, single, Parameter from multiple Parameters. - New classmethod
Parameter.defaultwhich is similar toParameter(), but it will override all parenting Parameters. AppandParameter's repr strings have been greatly simplified to only include non-default supplied parameters.
Bug Fixes
- conditionally import
typing_extensionsby @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/34 - use
importlib.metadatato check distribution version. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/36 - Handle mutable signature parameter defaults. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/37
Breaking Changes
This release technically contains some breaking changes, but realistically no-one should be impacts.
* Removed MultipleParameterAnnotationError; we now handle multiple Parameter resolution. Specifically, for mutliple Parameter in an Annotated, they are evaluated left->right (right-most has highest precedence/priority).
* All of Parameter's defaults are now None. No change in default functionality.
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v1.1.1...v1.2.0
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v1.1.1
Bug Fixes
- Fix error-handling of POSITIONALONLY, VARKEYWORD, and VAR_POSITIONAL arguments. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/27
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v1.1.0...v1.1.1
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v1.1.0
Features
- Add environment variable parsing via
Parameter.env_var. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/20 - Allow multiple names for a command. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/22
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v1.0.2...v1.1.0
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v1.0.2
Bugfix
- attempt to import
readlineso that arrows work ininteractive_shell.
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v1.0.1...v1.0.2
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v1.0.1
What's Changed
- Add unsupported
Tuple[type_, ...]check. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/15
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v1.0.0...v1.0.1
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v1.0.0
Major release; I'm happy with the API and overall performance.
What's Changed
- Make show_choices be optional to not close any doors for future comptability. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/12
- Make converter be Optional to not close any doors for future compatility by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/13
New Contributors
- @dependabot made their first contribution in https://github.com/BrianPugh/cyclopts/pull/11
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v0.2.0...v1.0.0
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v0.2.0
What's Changed
- add dispatcher argument to interactive_shell by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/8
- Fix Optional[Annotated[...]] resolution. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/9
- Don't display defaults if the default value is None. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/10
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v0.1.2...v0.2.0
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v0.1.2
What's Changed
- Don't consider
show=Falseorparse=Falseparameters when determining column layout in help text by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/5 - Simplify name when autoderived from
sys.argv[0]by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/6 - Fix fallback meta default help by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/7
- If an
Appdoesn't have explicithelptext, it should fallback toapp.default_command.__doc__, thenapp.meta.default_command,app.meta.meta.default_command, and so on.
- If an
- Fixes displaying meta commands in help screen.
- Added pages for "--help" and "--version" to the docs.
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v0.1.1...v0.1.2
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v0.1.1
What's Changed
- Removed
app.__len__, causes more confusion than convenience it provided. - fix annotations not properly resolving in python3.8 by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/3
- Fix help parameters special columns by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/4
Full Changelog: https://github.com/BrianPugh/cyclopts/compare/v0.1.0...v0.1.1
- Python
Published by BrianPugh over 2 years ago
https://github.com/brianpugh/cyclopts - v0.1.0 - Initial Release
Full Changelog: https://github.com/BrianPugh/cyclopts/commits/v0.1.0
- Python
Published by BrianPugh over 2 years ago