Recent Releases of https://github.com/brianpugh/cyclopts

https://github.com/brianpugh/cyclopts - v3.23.1

Bug Fixes

  • negative_iterable with 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_multiple documentation 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 alias when name is 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 alias resolution 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 DivideByZero error when counting tuple[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 MissingArgumentError if 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.alias to 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.LimitedChoice improvements (by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/483):
    • If LimitedChoice min value is negative, then all parameters in the group must be specified.
    • New LimitedChoice argument allow_none=False. If True, then also allow 0 CLI parameters (even if min is greater than 0).
  • New group validator all_or_none, which is just the instantiated object LimitedChoice(-1, allow_none=True).
  • Mutually exclusive object cyclopts.validators.mutually_exclusive for 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] │ ╰───────────────────────────────────────────────────────────────────────╯ See Group.sort_key for 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.alias by @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.

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 KeyboardInterrupt from printing tracebacks by @gremlation in https://github.com/BrianPugh/cyclopts/pull/448
    • The new behavior catches and suppresses KeyboardInterrupt from 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, set App(suppress_keyboard_interrupt=False).
  • Allow digit short flags (e.g. -2). These flags can only exist if the developer explicitly sets them with Parameter, 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_none feature. 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_default callable with an inspect._empty. Fixes Hex* 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 -> CycloptsPanel and 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) trio support 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.negative inheritance 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 Enum member 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.Env variables 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.
  • Treat classes with only VAR_POSITIONAL argument 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 *args and no other positional arguments.
  • Allow Parameter.show_default to be a callable. Add HexUInt* types to cyclopts.types that 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.Env error when a Parameter re-uses the same environment variable. by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/416
  • Add missing setter for App.sort_key by @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 TypeAlias resolution 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 pytest when subprocessing a python script from within a pytest environment. By @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/404
  • Improved functools.partial support. 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 datetime and timedelta support. 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 App subclassing 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 pydantic type 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.description to 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.ValidationError from 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_parents when 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 --help and --version not 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.validator to 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 InvalidCommandError didn'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 annotations type-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_factory on 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.split attribute; 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 pprint traceback 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 to App (and parsing methods). by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/333

Bug Fixes

  • Fix incorrectly parsing json null values 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 Sequence by @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 ExistingYamlPath If 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.

Bug fixes

  • Fix incorrect parsing of -j flag 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 Parameter configurations:
    • Parameter.json_dict: Optional[bool] - Whether or not to allow json-like data for dicts. None be default, which is the same as True except when the annotated class is union'd with a str.
    • Parameter.json_list: Optional[bool] - Whether or not to allow json-like data for lists. None be default, which is the same as True except when each element of the annotated class is str.

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 add By @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_error that 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 pydantic BaseModel attribute 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.reload is no longer required.

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.run convenience 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.FieldInfo no longer is a subclass of inspect.Parameter; it is now an independent class that mimics many of inspect.Parameter attributes. The class's __init__ now takes names: tuple[str, ...] instead of a single name: 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 a name: str property that returns the first element of the names attribute. 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 ArgumentOrderError could be erroneously raised when an UnknownOptionError would have been more appropriate. In those situations, an UnknownOptionError is 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 @Parameter decorator, we Introduce a hidden __cyclopts__ attribute that gets attached to decorated objects. Currently only created/used when @Parameter is 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.update method. 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 Annotated is inside another type; namely list[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 NewType token 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 NewType type 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_key that 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.
  • Number and Path validators now work with sequences (e.g. list[Path]).
  • Additional POSITIONAL_ONLY parameters may follow an iterable POSITIONAL_ONLY parameter. This allows for programs like: python @app.default def foo(inputs: list[Path], output: Path, /): pass bash $ 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 default LimitedChoice(), 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 and App.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 new Token class. This allows for raising a CoercionError for the particular offending token, which will result in a more helpful error message for the user.
  • App.parse_args and App.parse_known_args now return an additional value, ignored, which is a dictionary mapping python-variable-names to their type annotation of parameters with parse=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, subsequent POSITIONAL_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 be no-. A ValueError 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 be empty-. A ValueError 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.

- Python
Published by BrianPugh over 1 year ago

https://github.com/brianpugh/cyclopts - v2.9.9

What's Changed

  • Improve program load-time and --help performance. 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 --help performance 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 --help crash 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.default decorator. 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.8 to >=3.8 by @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 --help choices 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 to help_format if 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_parser by @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.config field, 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_split attribute. Defaults to cyclopts.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_format is 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 asyncio and importlib import by @OrHayat in https://github.com/BrianPugh/cyclopts/pull/154
  • defer optional pydantic import, speeding up initial import by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/155
  • defer rich import. 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_transform by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/147
  • Add Parameter.name_transform by @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=True and 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 async function 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 convert of Tuple[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_count values. 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_format which 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_commands to 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.toml in 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 converter and validator:
  • New default group assignment based on parameter positioning:
    • Positional-only arguments now default to being parsed into the App.group_arguments group. This group defaults to Group("Arguments").
      • All other arguments now default to being parsed into the App.group_parameters group. This group defaults to Group("Parameters").
  • Improved Pydantic @validate_call support.
  • 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=False field.
  • 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 None or no default is provided, falls back to str.
  • The int coercion logic now accepts decimal numbers from the CLI. It will first round, then cast to an int.
  • cyclopts.convert (previously cyclopts.coerce) now takes an optional callable converter, allowing custom-converters to leverage convert's list/tuple/etc parsing abilities, while leaving final element-conversion to a custom function.
  • Introduce the following Path annotated types: ExistingPath, ResolvedPath, ResolvedExistingPath, Directory, ExistingDirectory, ResolvedDirectory, ResolvedExistingDirectory, File, ExistingFile, ResolvedFile, ResolvedExistingFile
  • Introduce the following Number annotated 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=True or --my-flag=false.
  • Fixed cyclopts.validators.Path error messages.
  • Path validator 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.version to 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

  • App now takes an optional parameter default_parameter: Parameter that allows the configuration of what values a default Parameter uses. 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.combine which can construct a new, single, Parameter from multiple Parameters.
  • New classmethod Parameter.default which is similar to Parameter(), but it will override all parenting Parameters.
  • App and Parameter's repr strings have been greatly simplified to only include non-default supplied parameters.

Bug Fixes

  • conditionally import typing_extensions by @BrianPugh in https://github.com/BrianPugh/cyclopts/pull/34
  • use importlib.metadata to 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 readline so that arrows work in interactive_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=False or parse=False parameters 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 App doesn't have explicit help text, it should fallback to app.default_command.__doc__, then app.meta.default_command, app.meta.meta.default_command, and so on.
  • 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