Repository navigation
v4.1.0
Features
-
Support
pydanticSecret-types (SecretStr,SecretBytes, etc) by @BrianPugh in #620 -
Parameter.countforintcounting-flags (e.g., verbosity-vvv). by @BrianPugh in #622from cyclopts import Parameter def main(verbose: Annotated[int, Parameter(alias="-v", count=True)] = 0): print(f"Verbosity level: {verbose}") # -vvv → 3
-
Add
App.help_epilogue, which prints a message at the bottom of the app's help-page. by @BrianPugh in #628app = App(help_epilogue="For more info, visit: https://cyclopts.readthedocs.io") @app.default def main(name: str): """Greet someone.""" print(f"Hello {name}") # ╭─ Parameters ───────────────────────────────╮ # │ * NAME [required] │ # ╰────────────────────────────────────────────╯ # # For more info, visit: https://cyclopts.readthedocs.io
-
Add help from dataclass/attrs metadata to the resolution hierarchy. by @BrianPugh in #642
from dataclasses import dataclass, field @dataclass class Config: port: int = field(default=8080, metadata={"help": "Server port"})
-
Add GNU-style combined short options support by @BrianPugh in #639
from typing import Annotated from cyclopts import Parameter def main( verbose: Annotated[bool, Parameter(alias="-v")], user: Annotated[str, Parameter(alias="-u")], ): pass # -v -uroot → verbose=True, user="root" # -vuroot → verbose=True, user="root" (GNU-style combined) # -vu root → verbose=True, user="root"
-
More powerful
ArgumentCollection.__getitem__to support looking up by parameter name by @isoschiz in #635arg = argument_collection["param_name"] # Lookup by parameter name
Bug Fixes
- Resolve the default version to the nearest explicitly set
App.versionvalue instead of root-app version value. by @BrianPugh in #632 - Have
MutuallyExclusivegroup validator accurately report the user-specified option name instead of the first positive name. by @BrianPugh in #634 - Have
MissingArgumentErroraccurately report the user-specified option name instead of the first positive name. by @BrianPugh in #638 - Fix the negative-flag showing up twice for
Optional[bool]in the help-page. by @BrianPugh in #633 - Fix incorrect deleting of help/version flag commands when overwriting their respective flag attributes. by @BrianPugh in #644
- Fix unexpected exception when both
--helpand--versionare passed to a subcommand.--helptakes precedence. by @BrianPugh in #650 - Allow positional elements of kw-only dataclass. by @BrianPugh in #651
- Fix
cyclopts.__version__not being updated (due to uv migration). by @BrianPugh in #657 - Add
parse=FalsetoApp.version_printhandlers. by @BrianPugh in #656 - Fix kw-only dataclass object instantiation by @BrianPugh in #658
- Misc (mostly internal) type hinting improvements by @BrianPugh in #659
- Fix config command filtering logic. by @BrianPugh in #660
Special thanks to @isoschiz for thorough testing and bug reporting!
Documentation
- Add documentation on using multiple config sources. by @BrianPugh in #640
New Contributors
Full Changelog: v4.0.0...v4.1.0