Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump cyclopts from 1.3.0 to 2.0.0 #96

Merged
merged 1 commit into from
Jan 15, 2024
Merged

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jan 15, 2024

Bumps cyclopts from 1.3.0 to 2.0.0.

Release notes

Sourced from cyclopts's releases.

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
    

... (truncated)

Commits
  • c06a12c Fix up how sphinx links up annotated-types
  • 140c27b Link LimitedChoice from group_validators.rst
  • adc97c1 fix tests on windows
  • 040ebde annotated types docs
  • 7dd43a0 Path annotation tests
  • 1e1ea19 rename coercion->convert
  • d248813 Add new App.usage field.
  • 59b40fd more tests
  • 104bfbd Add some error-message testing
  • 0aeedcd move resolve_callables to cyclopts.utils
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [cyclopts](https://github.com/BrianPugh/cyclopts) from 1.3.0 to 2.0.0.
- [Release notes](https://github.com/BrianPugh/cyclopts/releases)
- [Commits](BrianPugh/cyclopts@v1.3.0...v2.0.0)

---
updated-dependencies:
- dependency-name: cyclopts
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label Jan 15, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jan 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e32d466) 22.22% compared to head (cb5d210) 22.22%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #96   +/-   ##
=======================================
  Coverage   22.22%   22.22%           
=======================================
  Files           3        3           
  Lines           9        9           
=======================================
  Hits            2        2           
  Misses          7        7           
Flag Coverage Δ
unittests 22.22% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BrianPugh BrianPugh merged commit 5de7782 into main Jan 15, 2024
15 checks passed
@BrianPugh BrianPugh deleted the dependabot/pip/cyclopts-2.0.0 branch January 15, 2024 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants