-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ratatui instead of tui-rs for the terminal UI #505
Conversation
Ratatui is a maintained fork of tui-rs. See https://ratatui.rs/ for more information. Changes the backend to use crossterm instead of termion. This makes it possible to use the terminal UI on Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, this seems fine?
I left one comment about a portion that needs to be changed, however.
@@ -1,2 +1,2 @@ | |||
[toolchain] | |||
channel = "1.70.0" | |||
channel = "1.74.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, we're not bumping the project-wide MSRV just for a single binary crate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MSRV of the other crates in the workspace doesn't change here - they can still be built with 1.70.0, but the version of the rust toolchain used to build the entire workspace does unfortunately need to change, or somehow just this this crate needs to be built with a later version. Putting a rust-toolchain.toml config in the metrics-observer works when building at that folder level, but building the workspace still uses the root rust version.
This was introduced due to the following problem:
❯ cargo build
error: package `metrics-observer v0.4.0 (/Users/joshka/local/metrics/metrics-observer)` cannot be built because it requires rustc 1.74.0 or newer, while the currently active rustc version is 1.70.0
The same error occurs when building the workspace with cargo build --workspace
We could remove the metrics-observer from the workspace if that would help, but I think that might be sub optimal. Is there another way to get around this?
We could also use Ratatui 0.25.0, the last version which supported Rust 1.70. The delta is about 400 commits - which 30% of the total commits of the entire repo.
Incidentally Rust 1.74 is in almost the same place as Rust 1.70 was metrics last did a MSRV bump for metrics. It will be 7 versions behind current when 1.81 is released in 2 weeks time. Do you have any downstream crates that are constrained this far back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MSRV of the other crates in the workspace doesn't change here - they can still be built with 1.70.0, but the version of the rust toolchain used to build the entire workspace does unfortunately need to change, or somehow just this this crate needs to be built with a later version.
Fair point, and my mistake.
We could remove the metrics-observer from the workspace if that would help, but I think that might be sub optimal.
I agree it would be suboptimal, although still a reasonable approach.
We could also use Ratatui 0.25.0, the last version which supported Rust 1.70. The delta is about 400 commits - which 30% of the total commits of the entire repo.
This seems more suboptimal: switching to another replacement crate and not even getting on the latest version.
Do you have any downstream crates that are constrained this far back?
No, but maintaining a lower MSRV is just good practice (IMO) for foundational crates.
After reading through and thinking about it as I was writing all of this, I think leaving this change in place is fine, but we should update the test-matrixed
CI step (here) to add the MSRV to the matrix of versions to test against. This will provide a counterbalance to rust-toolchain.toml
no longer being pinned to the MSRV.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I added a test using rust 1.70, with a parameter to exclude testing the metrics-observer package.
I also added some docs showing why this is there (linking back to your comment here).
The rust-toolchain.toml config sets the version used to compile as 1.74, while the MSRV for the rest of the workspace is 1.70. This is to allow metrics-observer to build, as it requires 1.74. This commit adds a matrix setting to the CI workflow to allow testing the MSRV separately from the rest of the workspace, and some additional documentation to explain the discrepancy.
Looks like this needs a base branch update, but I think those Clippy errors are a factor of using 1.74 now... so we can ignore them and I'll clean them up once this is merged. |
Sounds good - I merged main into this branch and fixed the clippy lint in the metrics-observer, but left the other ones. |
Signed-off-by: Toby Lawrence <toby@nuclearfurnace.com>
Ratatui is a maintained fork of tui-rs. See https://ratatui.rs/ for more
information.
Changes the backend to use crossterm instead of termion. This makes it
possible to use the terminal UI on Windows.