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 · 3 comments
Open

Semver hazard due to >= in ratatui dependency #32

willcrichton opened this issue Jul 17, 2023 · 3 comments

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
Owner

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
Owner

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
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

No branches or pull requests

2 participants