Does anyone have a recommendation on a stable, mai...
# random
w
Does anyone have a recommendation on a stable, maintained Python “interactive” CLI type of library? Something like Typer, but keeps state, or even something like PyInquirer ? I’m plugging into a piece of embedded hardware and usually I write a text-based console in the hardware, but I’m testing out a new approach with a binary interface - requiring a front end on the machine. I don’t even know what words to use to describe this, as I think they’re all approximately synonym… Terminal? Console? Shell?
I suppose I could also use Rust 🤷
Hmm, apparently there is something called “click-shell” which is the vibe I’m going for
f
textual can do that https://textual.textualize.io/
👀 1
@fresh-cat-90827 used that + pants output to build a dep graph explorer that we use at $job (potentially will be open sourced before too long)
🙏 1
w
Oh neat, I’ve never heard of that
21k stars. Man, where have I been
1
f
Idk, I don't think any of us have ever heard of it either
w
Wow, this thing is wild.
f
days of research, but I am so happy I found it, it's incredible. 🙂
it's from the same guy who wrote Rich library
21k stars. Man, where have I been
exactly my thoughts 😄 I think from now on I'll terminal first!
w
I was just reading the mission statement. About 10x overkill for what I need, but seems like a good thing to learn for all the dev tools I end up writing for myself
I write so many typer/click apps, but as soon as I send them to non-terminal devs, it’s a fight to get them to read the docs. Point and click is where they live… Can this be bundled into an executable (scie?) - I would assume so
f
it may seem like an overkill, but it's so expressive you'll notice your app is often 50 lines, doing everything you want it to
Can this be bundled into an executable (scie?) - I would assume so
yes, I package the app into a PEX file, works great
w
Sweeeeeeet
Thanks Josh and Alexey! Love learning about these super popular tools outside of my day to day
f
of course during development I don't use Pants to run the app since it copies the code into the sandbox so I can't make live changes, but once it's stable, packaging into pex and running is ideal
w
For sure, I just need something that I was otherwise writing a SwiftUI app for, and like, interacting with the serial ports and protobufs and stuff, for something that is call/response, just such overkill
Essentially, two items which I need this for - “hardware in loop” and just a way to easily e2e test my hardware. And more importantly, not “just” me but other people, and writing a full UI app is suuuuch a pain for something so trivial
Silly question possibly, but what’s the CPU usage like?
f
And more importantly, not “just” me but other people, and writing a full UI app is suuuuch a pain for something so trivial
I was afraid of this too, but they have ready to use components, so having a couple of panels and 30 lines of css may get you far.
Silly question possibly, but what’s the CPU usage like?
I haven't noticed anything abnormal, but haven't done proper monitoring either
w
Last time I used a tool like this, was like … 7 years ago, and every operation would peg the CPUs (which seems to be going on here too - every click basically ramps to 100%).
c
wow, thanks guys, this is amazing
w
Okay, after some more testing - not so bad. Really bad over SSH on my Linux computer, but on my Mac, fast scrolling only brings the CPUs to about 30% on Python/Terminal/WindowServer and then back down to 0’ish, which is totally fine Gotta investigate the Linux machine, because maxing out like 16 threads is an impressive feat
Aside: https://github.com/Textualize/trogon By the same people, I think this is exactly what I’m looking for for this upcoming app I’m writing… Like, EXACTLY
😃 1
c
Ah an alternative to Textualize there is npyscreen which is a very polished framework using the ncurses library. It hasn’t been maintained in years, and really moving forward new projects should use Textualize, but npyscreen still has a wealth of out of the box widgets that Textualize doesn’t have.
I keep planning to move my tui to texualize but keep finding that I would need to write from scratch a lot of ui components that today I get “for free” from npyscreen. Probably reason to just bite the bullet and contribute them to textualize…
b
If anyone wants to port pants' help to these, LMK because after the docs migration, markdown hekp is totally doable 🙂
w
Curses is where my mind originally went, thanks for pointing out npyscreen - I’d never used that either. Gonna try out textualize tomorrow and see how far I get, as what I’m looking for is super simple. @bitter-ability-32190 Not sure if you looked at that trogon, but that’s the kinda thing that would make Pants help pretty cool - like actively build out the commands you want with live help One flaw is that you have to “close and run” but 🤷
b
I did a really quick PoC with
rich
and unsurprisngly, looked neat
w
I got back from a long-ish vacation recently, so I’m backlogged for the foreseeable future with client stuff 😢
b
w
I saw this, but weirdly, having not seen it mentioned in the wild (that much) made me think it was deprecated 😕
f
If anyone wants to port pants' help to these
maybe make that
pants guide
instead of
pants help
? There's a lot of utlility in a help command being reliable and fast, even if it's imperfect (and likely to work on an airplane)
💯 1
b
I think if it's possible at all, we can bikeshed on how it gets invoked