ratatui / ratatui-macros

Macros for simplifying boilerplate for creating UI using Ratatui.
https://ratatui.rs
MIT License
28 stars 2 forks source link

Release version 0.4.4 should have been 0.5.0 #68

Open matta opened 3 months ago

matta commented 3 months ago

I'm in a situation where I am pinning ratatui to version 0.27 (and crossterm to 0.27), but ratatui-macros is pulling in ratatui 0.28 anyway (and crossterm 0.28.1 anyway). The root cause of this is because ratatui-macros versioned the dependency change with a minor version change.

I can't upgrade to ratatui 0.28 because a package I depend upon, crokey, hasn't done so.

For a similar reason, I had to pin my dependency on tui-prompts to "=0.3.17". That version of tui-prompts depends on ratatui "0.27" and "ratatui-macros "0.4.3".

Now that ratatui 0.28 and ratatui-macros 0.4.4 exists, cargo happily "upgrades" to ratatui-macros 0.4.4, which brings in the ratatui 0.28 version, visible in my "cargo tree" output, where you can see that tui-prompts depends on both ratatui 0.27 directly and ratatui-macros->ratatui 0.28.

├── tui-prompts v0.3.17 │ ├── itertools v0.13.0 () │ ├── ratatui v0.27.0 () │ ├── ratatui-macros v0.4.4 │ │ └── ratatui v0.28.0 │ │ ├── bitflags v2.6.0 │ │ ├── cassowary v0.3.0 │ │ ├── compact_str v0.8.0 │ │ │ ├── castaway v0.2.3 (*) │ │ │ ├── cfg-if v1.0.0 │ │ │ ├── itoa v1.0.11 │ │ │ ├── rustversion v1.0.17 (proc-macro) │ │ │ ├── ryu v1.0.18 │ │ │ └── static_assertions v1.1.0 │ │ ├── crossterm v0.28.1

However, my crates' primary dependency on ratatui and crossterm use the older versions:

── ratatui v0.27.0 │ ├── bitflags v2.6.0 │ ├── cassowary v0.3.0 │ ├── compact_str v0.7.1 │ │ ├── castaway v0.2.3 │ │ │ └── rustversion v1.0.17 (proc-macro) │ │ ├── cfg-if v1.0.0 │ │ ├── itoa v1.0.11 │ │ ├── ryu v1.0.18 │ │ └── static_assertions v1.1.0 │ ├── crossterm v0.27.0 (*)

So, the downsides are:

  1. bloat in my binary
  2. a potential breakage in tui-prompts, since it is possible to imagine an API change in ratatui 0.28.0 that interacts badly with ratatui-macros 0.4.4 and the use of ratatui 0.27.0 APIs in tui-prompts 0.3.17.

FYI I filed as similar issue in @joshka's tui-widgets crate: at https://github.com/joshka/tui-widgets/issues/31. I wonder if this is something a release tool can flag as a potential problem. Seems like bumping a dependency across major versions, when its API is used in the crate's own public API, in a minor release, is something a tool could possibly detect.

kdheepak commented 3 months ago

ugh, that's annoying. Realistically the only thing we can do here is release a new patch version bumping the dependency back down to ratatui v0.27 and then immediately issue a new minor version back to v0.28. I'm not sure we want to do this though, will have to think about it. Ideally crokey will just update to v0.28 soon.

btw, can you can pin v0.4.3 of ratatui-macros? why wouldn't that resolve your issue?

matta commented 3 months ago

Yes, I have filed an issue on crokey about upgrading to the newest crossterm release.

Another idea is to revoke the current 0.4.4 version and release an 0.5.0.

This is not a critical issue for me personally, so don't take action on my account alone. I wanted to report it in case you were interested in checking for this sort of issue in future releases.

I'm also curious to know if there really is a "good" way to handle major version bumps. At some point techniques like https://github.com/dtolnay/semver-trick might be worth exploring, especially if ratatui becomes more widely used and a large ecosystem of utility crates grow around it.

I did not think about pinning the ratatui-macros version since it is not a direct dependency of my crate -- good idea! I believe it would resolve the issue, but for now I will avoid it since the duplicate dependencies do not appear to be causing harm (and if I forget about it, the pinned version it might be confusing in the future).

joshka commented 3 months ago

I think we should yank 0.4.4 (as it's not technically compatible with 0.4.x), and release 0.5.0 in its place. (same with tui-widgets / tui-prompts). Rust semver is fun :|

I've thought about the semver trick, and need to dedicate some time to experimenting with it - I'm not clear about whether really applies when you're doing the sorts of changes we're doing in Ratatui often though, or if it's just something that you use for smaller amounts of churn.

@matta I'd love to get your thoughts on https://github.com/ratatui-org/ratatui/issues/1319 too if you have some time.

joshka commented 3 months ago

@matta 0.5.0 is available. Todo: yank https://crates.io/crates/ratatui-macros/0.4.4