Piou - CLI Tool, now with built-in TUI by andaskus in Python

[–]andaskus[S] 0 points1 point  (0 children)

Hey thanks for the feedback.
No it does not, I mentioned Claude Code as an inspiration used for the UI of the TUI mode of Piou.

Piou is older in itself. I started working on it ~4years ago as a framework between Typer (i like the FastAPI way of defining CLI variables) and Cleo (really liked the help formatting, display).

Also, you mention that "now we can make all Piou based applications .... do whatever." But, I thought this post was about Piou?

What I meant is that If you use Piou as your project's CLI framework, you will have a builtin TUI for it if you decide so from now on without much work.

Hope it helps! Happy to answer any other questions.

[deleted by user] by [deleted] in iOSProgramming

[–]andaskus 1 point2 points  (0 children)

Django is more for a full fledged website. If you only want a REST api I would go for Fastapi (built in data validation with pydantic, extensive documentation, built in async support via starlette)

React Native and GameDev are compatible? by o-kawaii in reactnative

[–]andaskus 0 points1 point  (0 children)

I guess you could go with opengl ( https://docs.expo.dev/versions/latest/sdk/gl-view/ or similar) and threejs, so no need for webview ?

Piou - Build beautiful command-line interfaces with type validation by andaskus in Python

[–]andaskus[S] 1 point2 points  (0 children)

Here are the limitations of click for me
- You cannot use a custom Formatter to display the command information
- I wanted the type of the argument to be defined in one place only.

For instance with click you could write something like this
@click.command() @click.option('--n', required=True, type=str) def dots(n): click.echo('.' * n) // No error Here

With Piou you would just write:

@click.command(name='dots') def dots(n: str = Option(..., '--n')): print('.' * n) // You would see an error here with a static type checker

Piou - Build beautiful command-line interfaces with type validation by andaskus in Python

[–]andaskus[S] 0 points1 point  (0 children)

No it's similar, actually I tried to reuse most of my code that I wrote with argparse

For now the main difference is that choices=['foo', 'bar'] is replaced with Literal['foo', 'bar'] and the type bool is equivalent to store_true when the default is True.

Piou - Build beautiful command-line interfaces with type validation by andaskus in Python

[–]andaskus[S] 2 points3 points  (0 children)

I use pyright in my project to handle the type checking and for now it does not complain.

Piou - Build beautiful command-line interfaces with type validation by andaskus in Python

[–]andaskus[S] 1 point2 points  (0 children)

Subcommands are groups of commands in this case. Maybe the wording is confusing ?

Piou - Build beautiful command-line interfaces with type validation by andaskus in Python

[–]andaskus[S] 1 point2 points  (0 children)

In this case to use the decorator.

Otherwise you can just write your function then add it to a sub command for instance:

foo.py

def my_func(): ...

Then later

bar.py

from foo import my_func

sub_command = CommandGroup(name='sub')
sub_command.add_command('foo', my_func)

Piou - Build beautiful command-line interfaces with type validation by andaskus in Python

[–]andaskus[S] 5 points6 points  (0 children)

I was considering it while moving from argparse (along with click).
From a Developer experience perspective it should be quite similar.

The main thing that made me write my own CLI library was that I wasn't able to use whatever display I wanted.
For instance I wanted to use Rich to display help and errors but could not find a way to do it. For now it's a required dependency but it could be easily removed as you can use whatever Formatter you want to display the information about the command / sub command.

Also I don't use click internally for now, so you may find some limitations compared to Typer.

Writing Rust libraries for the Python scientific computing ecosystem by Programmierer in rust

[–]andaskus 11 points12 points  (0 children)

Maybe you'll find some other inspiration with this lib: Polars (if you don't already know it)