Releases: 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 tocyclopts.env_var_split
, which behaviors similarly to Click's multiple values from environment values.
Full Changelog: v2.6.2...v2.7.0
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 #166 help_format
is now keyword only. by @BrianPugh in #164- Improve type inference when using decorators with pyright by @breathe in #172
New Contributors
Full Changelog: v2.6.1...v2.6.2
v2.6.1 - Faster Importing
Significantly improve cyclopts
import speed by lazy loading dependencies.
What's Changed
- defer
asyncio
andimportlib
import by @OrHayat in #154 - defer optional
pydantic
import, speeding up initial import by @BrianPugh in #155 - defer
rich
import. Also defer difflib by @BrianPugh in #156
Full Changelog: v2.6.0...v2.6.1
v2.6.0
Features
- Add
App.name_transform
by @BrianPugh in #147 - Add
Parameter.name_transform
by @BrianPugh in #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: v2.5.1...v2.6.0
v2.5.1
Bug Fixes
- Fix displaying default if
required=True
and no default is present. by @BrianPugh in #146
Full Changelog: v2.5.0...v2.5.1
v2.5.0
What's Changed
- Added support for Postponed Evaluation of types annotations (PEP-563) by @OrHayat in #138
- Move special-flag parsing logic from parse_args into parse_known_args by @BrianPugh in #130
Full Changelog: v2.4.2...v2.5.0
v2.4.2
Bug Fixes
- Unfreeze help_flags and version_flags; create/delete commands on set/get by @BrianPugh in #127. Addresses #126
Full Changelog: v2.4.1...v2.4.2
v2.4.1
Bug Fixes
- fixed showing choices of list,tuples and set type annotations by @OrHayat in #123
- Handle bare tuple annotation; more robust union logic. by @BrianPugh in #125
New Contributors
Full Changelog: v2.4.0...v2.4.1
v2.4.0
Features
- Added
async
function support by @nesb1 in #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 genericCycloptsError
(ValidationError
inherits fromCycloptsError
).- e.g.
--no-flag=True
now raisesCycloptsError
instead ofValidationError
. - 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.
- e.g.
- Change exception for unknown option token from
ValidationError
toUnknownOptionError
.- 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 aValidationError
.
- 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
Bug Fixes
- Fixed incorrectly python_variable->cli_option translated names. Addresses #110.
- Fixes indexing errors when validators/converters raise exceptions without messages.
New Contributors
Full Changelog: v2.3.2...v2.4.0
v2.3.2
Bug Fixes
- More fixes for parsing list of tuples with insufficient arguments by @BrianPugh in #109
Full Changelog: v2.3.1...v2.3.2