Replies: 5 comments 13 replies
-
Hmmm… it sounds a little inconveniënt to have to make PRs to two repositories… Maybe an alternative would be: Solving (1) by having the examples in a separate workspace. For (2), I think a reasonable solution would be to have a
and that the former kind would know already that the examples on GitHub might be for an unreleased version, while the latter kind are less likely to know, but would be brought to the correct place by the links. (3) is harder. But if the examples repo would have separate stuff in the dev branch and main branch anyway, maybe it would be sensible to have the |
Beta Was this translation helpful? Give feedback.
-
I don't have much experience on this project so take my feedback with a grain of salt. I like having examples in the same repository. It's one more check for changes that shows impact of changes. Having said that, I think the your point (2) about copy/paste of examples must be solved somehow. If it's by a separated repo, or having different branch management (like deleting |
Beta Was this translation helpful? Give feedback.
-
I don't think I can add anything substantial. My gut feeling is "everyone has examples in the same repo so let's do the same" but as long as CI can tell that examples broke and developers have a relatively easy way to check examples locally (like a simple |
Beta Was this translation helpful? Give feedback.
-
We have a long thread where we discussed similar problems in Ratatui at ratatui/ratatui#779. All the same perspectives that have been raised in here were raised there too. We were getting people hitting compilation problems a few times a week (when there were some intentionally breaking changes in main which were not yet released). Since making the following changes, we haven't seen the issue rear up again:
We also setup a branch named latest which we point at the latest release, which allows us to use that instead of main when pointing at examples relevant to release without having to be concerned about breaking changes in main. This is lower on the list of things which are useful. I wouldn't recommend changing branches - keep main as the branch that developers see and submit PRs to. I've submitted code in a few repos where the main branch isn't the HEAD branch on GitHub and it's always a bit annoying. I think it's better for devs to learn that main contains unreleased code, by seeing this a few times as a developer and then have that mental model, than it is to have to work out different branch strategies for each project you happen to have to look at and to have no generalized model for how things work. |
Beta Was this translation helpful? Give feedback.
-
I have a bit of a Different Suggestion. This might be a bit of a weird maintenance burden, and it would be kind of annoying and hard to test- but could the examples be listed directly in the docs on docs.rs? It seems like it would be kind of nice to centralize that, but it would also make using seperate dependencies hard. |
Beta Was this translation helpful? Give feedback.
-
I'm considering moving the
examples
directory out into a separate repository, for a few reasons:cargo deny
dependency checks run against aCargo.lock
that contains not the regular dependencies of the first-party axum crates, but also those of the examplesmain
has breaking changes, so they'll try to copy-paste code that's written against something that's not releasedThe existing
examples
directory wouldn't be removed entirely, but it would be empty except for a README that points people to the new repo.For the new
axum-examples
repo, the main branch would always use crates.io dependencies toaxum
crates, but we could also have a separate dev branch where we use git dependencies that are occassionally bumped (in particular before a release), to make sure we don't miss the effect of changes merged here on them.If we wanted to be really fancy, we could even have a PR CI job here that checks out that dev branch, adjusts all the git revs and reports when the change broke examples (of course, sometimes breakage would be expected so this would not usually prevent merging a PR).
Thoughts? (in particular @mladedav @yanns @SabrinaJewson @tottoto)
Beta Was this translation helpful? Give feedback.
All reactions