Yuio

Yuio is everything you’ll ever need to write a good CLI, deps-free.

Forget searching for that one progressbar library, figuring out how to keep loading configs DRY, or having headaches because autocompletion was just an afterthought. Yuio got you.

Features

  • Easy to setup CLI apps with autocompletion, helpful error messages, and lots of customization points:

    @yuio.app.app(prog="rm")
    def main(
        #: Input files for the program.
        *inputs: pathlib.Path,
        #: Delete directories recursively.
        recursive: bool = yuio.app.field(default=False, flags=["-R", "--recursive"]),
    ):
        ...
    
    if __name__ == "__main__":
        main.run()
    
  • Colored output with inline tags and markdown:

    yuio.io.info('<c bold>Yuio</c>: a user-friendly io library!')
    
  • Status indication with progress bars that don’t break your console:

    with yuio.io.Task('Loading sources') as task:
        for source in task.iter(sources):
            ...
    

    They even hide themselves when you send process to background!

  • User interactions, input parsing and simple widgets:

    answer = yuio.io.ask("What's your favorite treat?", default="waffles")
    
  • Loading configs from all sorts of places:

    from typing import Annotated
    
    class AppConfig(yuio.config.Config):
        #: Number of threads to use, default is auto-detect.
        n_threads: Annotated[int, yuio.parse.Ge(1)] | None = None
    
    config = AppConfig()
    config.update(AppConfig.load_from_toml_file(path))
    config.update(AppConfig.load_from_env(prefix="APP"))
    ...
    
  • No dependencies, perfect for use in un-configured environments.

  • And many more!

Contents

More examples

See more examples at taminomara/yuio.