-
Notifications
You must be signed in to change notification settings - Fork 352
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
Create an "imgui-rs-sample-app" repo #664
Comments
@dbr Here is what I came up with today for this as a potential candidate: https://github.com/airways/dear-imgui-rs-hello |
I generally prefer monorepos (allows updates in "lock-step"1, you only have to invest in CI once, etc). That said, for something like this it seems reasonable to split it out, since it'd only ever track the version on crates.io (and that'd be a feature rather than a drawback). Footnotes
|
Why not do exactly like the imgui repository does, and just have an examples folder? I also support this issue because currently getting a imgui rust setup is a pain the first time, especially for a new user you are suddenly bombarded with several libraries you have to learn. Having the examples also tested by CI tested would also be great, to prevent breakage (like the monorepo benefit said above). |
In my opinion the problem kind of is that when examples are in the same repo, it tends to lead to those examples having:
Both of these can lead to either examples that don't work outside the library tree, don't work with any publicly available tagged / released version, and other weird inconsistencies. That said, this doesn't mean it isn't possible to make the examples cleanly only rely on the latest published version -- but it does require more discipline and is a bit more prone to error. Either that or it requires a CI/CD pipeline that can enforce those requirements. |
I'm only a small library developer, so I don't have much experience shipping libraries people depend on - but aren't those good points? Examples should showcase the intended public API, and if those break then that means something is really wrong (like you mentioned, CI should catch this). Of course if something happened like you said and the examples accidentally depend on some implementation detail, I would consider that a bug in the example and it should be handled as well. If a PR or a core developer makes any semver-breaking changes, the examples should be expected to be updated accordingly, and would also showcase how applications dependent on those APIs should be changed as well. This should be the the standard, stripping away any notions of versioning, crates.io packages and so on. This is already what happens with tests, why would examples be any different? I agree with your point about users getting confused with in-tree examples maybe being out of sync with the currently released version, but honestly I think that's a really small concern and maintaining a separate out of tree repository just for examples just to avoid that issue is the wrong thing to do. If we went through with the new versioning scheme (#672) this issue would be solved I think, since we would have the stable branch. I'd argue this is more of an ecosystem problem, since crates.io doesn't save any git information(?) it's hard to deduce what branch or tag your current version came from. I suggested copying what imgui does, and I still stand by that - and honestly they could totally handle having examples outside of the tree, their API barely changes. imgui-rs on the other hand has already changed it's interface since I've used it a year ago, for example removing the need for ImStr and a couple of other QoL changes. Actually, I discovered that example code already exists - we have |
Examples should compile as separate binaries that access the lib as if it were an external crate, so I don't think you can access non-
That's expected, as examples need to evolve in unison with the crate. The issue at hand here is "how do I find the examples that belong to this specific version of the crate that I happen to be using from crates.io?".
You can find this on https://docs.rs/crate/imgui/latest/source/.cargo_vcs_info.json, pretty sure crates.io could display this or otherwise use it to its advantage?
I'd also argue that this is more of a community thing we need to teach everyone (that being: "git is where development happens, and is typically ahead of the current stable release on crates.io"), but perhaps the solution is for crates.io and docs.rs to either ship or link to examples compatible with that version (i.e. to the tag for a given release) in an obvious way (instead of having to write - and keep up to date! - a minimum example in glutin for example has a little warning with a link to the git tree (based on tag) containing the examples for that specific version. |
You guys seem to be kind of missing the point that when I filed #663, it was not possible to find working example code in this repo for the latest version of Having a separate repo ensures that it can only depend on creates.io published version. This will increase adoption rate, prevent mistakes, and prevent the need for more complex CI/CD. |
Not sure what we're missing here. My suggestion is that we should make it more clear where the examples live for what specific version so that you don't need "detailed insider knowledge of the commit history". However, that doesn't require a separate repo (which inevitably gets out of date!) nor complex CI/CD. |
I think there's a few issues here: First: We need better pointers for people to find examples I think this point is fairly uncontentous - and I suspect just a small section paragraph in the README explaining the general organization of the repo will go a long way Additionally, as mentioned above, a note reminding people that default Github view might not represent the published version is good to have. Second: I think there is a small inconsistency with the examples, between the several projects within the imgui-rs "mini-monorepo":
Finally: Is it worth having a separate examples repo? This is debatable - I think with more consistent
Hmm, it has long been at the back of my mind to have an |
As per #663 - I think it's a good idea to make a repo with some very barebones imgui-rs app
It would just to give people something easy to copy-paste to get started with an empty window (maybe at most a single button to check things actually work!)
The text was updated successfully, but these errors were encountered: