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
Examples use unreleased code incompatible with 0.25.0 #779
Comments
@Valentin271 suggested:
|
I think in addition to the examples here in the repo, we could automate showing the examples on the website:
Then we can set up https://ratatui.rs/ can redirect to https://ratatui.rs/latest which could be a symlink of the folder with the latest tag. We can also add a dropdown for users to see the old website. I think this second point is a nice to have feature but not high priority. |
It seems like a lot of work to set this up (and then to maintain / make it work with the automatic previews / etc.), when the workaround is:
I'd lean towards not making that tradeoff. |
Perhaps a better approach might be to explicitly tag any code that does not compile in the latest version with a comment? Or perhaps there's an attribute that does a version check (which will allow us to fail a build if we don't remove after release). I'm imagining something like: #[new-in("0.26.0", url="https:://github.com/...")]
someCode Edit: I think this might be overkill for the problem. Linking direct to the readme in #844 seems like a better idea. |
Currently, my understand is that users open GitHub, click on the examples folder, and open whatever sounds interesting to them. The README on GitHub is below our long list of example files. If they are then interested in running it, they create a new project, add ratatui, copy paste the example and it breaks. This is largely a GitHub UX problem imo. If for example GitHub allowed us to make a tag the default landing page, we wouldn’t run into this issue. Or if we changed our workflow to I have a simpler idea that we can try. Currently we have:
I propose we have
This way clicking on the examples folder will result in the README being prominently displayed. i.e. we don’t have any files except the readme at the folder level of the examples. The README can even be the same readme but click to the latest tagged release. |
Another alternative is to make all single file examples also work with cargo script. A comment at the top of each example file should also do the trick. |
I really don't like the dev branch approach, mainly because it's a convention that leads to "I fixed this bug on main" / "It's already fixed on dev, sorry" and also "here's my PR" / "can you please rebase it on dev" The comment at the top of each example is something I want to do. I'm not how cargo script helps this problem. Copy paste would still be an issue for users and I think it would make using the changes from main in the examples. It's also an extra complexity added in an area we should keep simple.
No disagreement. Would be nice to be able to say "hide the files by default" in any directory.
This leads to the history of the examples being fragmented somewhat, and extra work managing copying the updated changes over the old changes every time we release. I think this is a problem. A start to reducing the scroll needed before the README is to move the tape files to another directory. |
What about having a We could also make it the default displayed branch on github, but that leads to what joshka said about people fixing already fixed bugs. |
That could work, but it could also bring confusion. I'd still prefer main to be the default branch shown it's what people will submit PRs against etc, and it's what you want to show as being active. I'm tempted to say move the examples out of the repo, but a big benefit to having them in the repo is that we see the sorts of pain that our users would have to undertake any time we have a breaking change. If it's difficult to do on our own small apps, then that pain is magnified. So keeping the examples in the repo helps us empathize with our users and avoid doing dumb things. |
I'm fine with that, was just stating any possibility. There's still the (big) benefit of linking to the same branch that gets updated. I'd like to keep the examples in the repo too, for what you said but also because this is the standard Rust project layout. I like that on pretty much any Rust project I know where the examples are and I can find them (and even run them) in seconds. |
I'm suggesting just moving all examples we have one level down, so the examples folder has a
I don't like different branches as well just because when you make a PR on github it makes it to the default branch of the repo. The only solution that kind of works here is making to be clear, I'm certainly not suggesting we use a |
How about we see whether the examples readme fix helps for a little while and go from there. I'm guessing that this should fix most of the problem, but we can also prioritize which option to try next if it doesn't. |
An option which, while it won't eliminate the pain completely, would probably alleviate it. docs.rs and your website should link to the correct version, not to the For I'm not sure about Astro, but since it's probably ran in your own CI, something similar should be doable, probably just with This won't fix the issue completely, but the people who click the link on docs.rs or on your website at least will be directed to the correct place. This is something that can be done quickly. |
To be clear - most of the time I want to link to the most current example code, mainly because we move fairly rapidly with that code and update it at a higher cadence than the release schedule (every 6 weeks or so). Example code generally multiplies out as people copy bad practices or deprecated methods etc, so using older versions of the examples should not be the norm. We do need to get into a habit of releasing minor releases in between that 6 weeks, which would generally fix some of this, but in the last two releases we've made some breaking changes fairly soon after the release, so a new release would have to be a major one. |
The solution I proposed would link them to the one which was released together with the documentation. So, if they're reading the most recent documentation, they'll be linked to the most recently released version. The question is, I think, whether a quick fix which helps now, and can be reverted later, is something you're willing to apply.
While I'm an outsider, I'm not sure point releases would be healthy at this point in the project's life. You're moving fast and breaking things a lot. Simply own it and tell people. Put a giant warning at the front of your page "Ratatui is moving fast and breaking things". Thinking further, yes, I think that's it - it's a mismatch between people's expectation and the actual lifetime stage of Ratatui. You're still early, iterating on the API design, moving fast and breaking things. People treat the project like it was a stable library. |
I prefer users to see the latest available version of the code. Not the version released with the release.
Kinda - I've done quite a few tui to ratatui migrations in various projects to check out how much breakage there really is. For the most part it's I'd say it's more move fast and break things with caution. |
Note: this is a pinned post for visibility
Summary
We write code on the main branch, and update the examples to align with that code. This will become a future release (usually around 6-8 weeks between releases). When we implement new code or change behavior, sometime that code will be incompatible with the current release. The examples then don't always compile with the current release.
Workarounds
There are a few ways to work around this problem:
Details
In #773 we discovered that changing the examples in the main branch can be confusing when the code in the example doesn't match the latest released docs / libraries.
@Libroru wrote:
@kdheepak wrote:
@joshka wrote:
@Libroru wrote:
@Valentin271 wrote:
The text was updated successfully, but these errors were encountered: