Releases: BrianPugh/cyclopts
v3.4.0
Feature
cyclopts.run
convenience function for terser, simpler short scripts by @Tinche in #305
Simple applications can now be written like: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 #310
New Contributors
Full Changelog: v3.3.1...v3.4.0
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
andpydantic
. -
The
cyclopts.field_info.FieldInfo
no longer is a subclass ofinspect.Parameter
; it is now an independent class that mimics many ofinspect.Parameter
attributes. 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: str
property that returns the first element of thenames
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 accessesFieldInfo
objects outside of Cyclopts' internals. -
In some situations, an
ArgumentOrderError
could be erroneously raised when anUnknownOptionError
would have been more appropriate. In those situations, anUnknownOptionError
is now raised.
Full Changelog: v3.3.0...v3.3.1
v3.3.0
Features
cyclopts.edit()
to launch text editor for user input. by @BrianPugh in #303
Bug Fixes
- improved pytest warning variable-name detection. by @BrianPugh in #301
Full Changelog: v3.2.1...v3.3.0
v3.2.1
Features
- Warn if cyclopts application is invoked with no python arguments within pytest. by @BrianPugh in #300
Full Changelog: v3.2.0...v3.2.1
v3.2.0
Features
- Allow Parameter to be used as a decorator. by @BrianPugh in #295
See docs example for more information.
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()
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: v3.1.5...v3.2.0
v3.1.5
What's Changed
- Better handling of nested meta apps by @BrianPugh in #291
- Fix converters/validators getting the wrong type for nested Annotated[Parameter(...)] by @BrianPugh in #293
Full Changelog: v3.1.4...v3.1.5
v3.1.4
Features
- Add
App.update
method. by @BrianPugh in #281
Bug Fixes
- Fix subapp default command/parameter/argument groups. by @BrianPugh in #283
- fix handling for when
Annotated
is inside another type; namelylist[Annotated[...]]
. by @BrianPugh in #289
Full Changelog: v3.1.3...v3.1.4
v3.1.3
Bug Fixes
- Do not interpret choices/default as rich markup by @BrianPugh in #278
- Various speed optimizations. by @BrianPugh in #279
Full Changelog: v3.1.2...v3.1.3
v3.1.2
What's Changed
- Fix
NewType
token count for python >=3.10. by @BrianPugh in #265
Full Changelog: v3.1.1...v3.1.2
v3.1.1
Bug Fixes
- Correctly handle
NewType
type annotations by @BrianPugh in #263
Full Changelog: v3.1.0...v3.1.1