Rich PoC & simulator/fake connector #1885
Replies: 2 comments 2 replies
|
This is so good. The before/after shots don't lie: Rich version is next-level. Fake connector stealing the show. Testing without infra? Yes please, all day. Two PRs: smart. Simulator first for the quick win, then we can nerd out over CLI libraries. PS: I think that was FOSDEM 2026. Either way, glad it brought you here. Keep it up. This rocks. |
|
Moved over from PR #1894 (now closed) so the details live here: Migrates the pyinfra CLI from Click to Cyclopts for argument parsing and adopts Rich for all human-facing output, while keeping the existing command syntax and behaviour. Highlights:
Output is routed through a small pluggable layer in The implementation remains available on the closed PR branch (#1894) if we decide to pick it up. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi 👋🏼
Since Pycon FR 2025, I've been using PyInfra a lot (thanks @wowi42 for the presentation!)
I wanted to contribute but didn't have time before. But now I have.
Rich
I always thought using
richcould really improve the user experience, and I saw #785, so I gave it a try, coupled withCyclopts(which gives typing, completion... and a few other benefits over Click).Also, I did not (yet) address the suggested verbose mode from this comment (eg. fact/operation level details...). I think this is a very interesting feature, but it requires a base
richintegration to be working, and it's a lot more work (not a single contribution IMHO).Showcase
Here's some demo, with the current state and the rich version (click to see full size).
Inventory
Python Webapp success
Python Webapp with errors
Help
Simulator / Fake connector
To make it easier for me to test and compare, I have written a small simulator. Basically a
fakeprogrammable connector:fake_answersdict for explicit answers (success or failure, using stdout or stderr...)It has been incredibly useful (and actually allows me to easily test other things), so I'm thinking maybe it would be useful to someone else.
PR(s) or not PR(s)?
The current work is on the my
refactor/rich-cycloptsbranch. The first commit is the simulator, and then the rich+cyclopts refactoring.Before going further, I need to know if you would be interested in those contributions. Only the
richrefactoring? Only the fake connector? Both (as separate PRs obviously)?What should be focused on before contributing ?
Note
Yes, I am using AI for development and I used AI to help on this contribution. I prefer to be transparent and don't want this to be an issue. (However this post is entirely manually written :) )
Any feedback is welcome!
All reactions