Skip to content
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

Semver hazard due to >= in ratatui dependency #32

Open
willcrichton opened this issue Jul 17, 2023 · 4 comments · May be fixed by #60
Open

Semver hazard due to >= in ratatui dependency #32

willcrichton opened this issue Jul 17, 2023 · 4 comments · May be fixed by #60

Comments

@willcrichton
Copy link
Contributor

Hi, I ran into a semver hazard with this library. I depend on ratatui 0.21. I did cargo update and my library broke because ansi-to-tui 3.1 depends on ratatui 0.22. In general, I believe that using >= is considered an anti-pattern as per the Cargo book:

The resolver algorithm may converge on a solution that includes two copies of a dependency when one would suffice. For example:

# Package A
[dependencies]
rand = "0.7"

# Package B
[dependencies]
rand = ">=0.6"  # note: open requirements such as this are discouraged

In this example, Cargo may build two copies of the rand crate, even though a single copy at version 0.7.3 would meet all requirements. This is because the resolver’s algorithm favors building the latest available version of rand for Package B, which is 0.8.5 at the time of this writing, and that is incompatible with Package A’s specification. The resolver’s algorithm does not currently attempt to “deduplicate” in this situation.

The use of open-ended version requirements like >=0.6 is discouraged in Cargo.

I suppose one fix would be to publish a different version of ansi-to-tui for each 0.x release of ratatui. I'm not sure if there's a better solution.

@willcrichton willcrichton changed the title Don't use >= in ratatui dependency Semver hazard due to >= in ratatui dependency Jul 17, 2023
@uttarayan21
Copy link
Collaborator

uttarayan21 commented Jul 18, 2023

Initially I was using ratatui = 0.* as a dependency but since they introduced a breaking change on 0.21 that no longer worked.
Maybe I should make a deprecated feature that'd replace the Line the with the older Spans and bump the major version.
Do you think that's a better solution ?

@willcrichton
Copy link
Contributor Author

I see. It's fine to require that ratatui should actually be 0.22 if they introduced a breaking change. I wouldn't use >= 0.21 as the requirement then, and just specify a dependency on 0.22.

@uttarayan21
Copy link
Collaborator

From next release onwards I'll match a major version of this crate to a minor version of ratatui until it reaches 1.0 stable

@uttarayan21 uttarayan21 pinned this issue May 25, 2024
@uttarayan21 uttarayan21 unpinned this issue Sep 4, 2024
joshka added a commit that referenced this issue Mar 3, 2025
In the forthcoming Ratatui 0.30 release, the `ratatui` crate will be
split into several crates: The `ratatui-core` crate will contain the
core functionality of the library, This change is being made to make
versions of the library easier to upgrade (as we expect the core
functionality to change less frequently than the other parts of the
library).

Fixes: #32
@joshka joshka linked a pull request Mar 3, 2025 that will close this issue
@joshka
Copy link
Member

joshka commented Mar 3, 2025

In #60, I changed this library to point at ratatui-core which should have longer term stability compared with the main crate. This is still in testing, so I want to get out a release of ansi-to-tui and other widgte libs so we can ensure that this idea works across a bunch of different use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants