Skip to content

Releases: BrianPugh/cyclopts

v3.4.0

27 Jan 14:24
Compare
Choose a tag to compare

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

21 Jan 02:35
863648b
Compare
Choose a tag to compare

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: v3.3.0...v3.3.1

v3.3.0

18 Jan 20:56
686f1b0
Compare
Choose a tag to compare

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

15 Jan 23:25
cfe7324
Compare
Choose a tag to compare

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

14 Jan 14:24
44b2a54
Compare
Choose a tag to compare

Features

  • Allow Parameter to be used as a decorator. by @BrianPugh in #295
    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: v3.1.5...v3.2.0

v3.1.5

10 Jan 17:08
6284a12
Compare
Choose a tag to compare

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

07 Jan 15:55
Compare
Choose a tag to compare

Features

Bug Fixes

  • Fix subapp default command/parameter/argument groups. by @BrianPugh in #283
  • fix handling for when Annotated is inside another type; namely list[Annotated[...]]. by @BrianPugh in #289

Full Changelog: v3.1.3...v3.1.4

v3.1.3

30 Dec 20:23
Compare
Choose a tag to compare

Bug Fixes

Full Changelog: v3.1.2...v3.1.3

v3.1.2

28 Nov 19:19
eb073c0
Compare
Choose a tag to compare

What's Changed

Full Changelog: v3.1.1...v3.1.2

v3.1.1

27 Nov 01:52
Compare
Choose a tag to compare

Bug Fixes

Full Changelog: v3.1.0...v3.1.1