-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
Allow usage as a library, not just as a binary. #67
Comments
The cargo-release issue for this is crate-ci/cargo-release#62 (though I suspect we won't auto-select version but check if the version is appropriate). My main concern for cargo-release will be the performance of cargo-semver-check due to the time it takes to generate the rustdoc json. btw @drahnr any interest in collaborating on release tools? |
Hey @epage - I'd love to, but I am not sure I can carve out any kind of significant time for the remainder of at least this year. |
A few notes to help bring up to speed folks coming across this issue, since @epage and I discussed it in person. TL;DR: JSON generation is likely always going to be the long pole in the runtime, and there's plenty of low-hanging fruit to speed up the checking itself that we haven't bothered with yet because the JSON is the slow part. When rustdoc JSON is stabilized and docs.rs starts hosting the JSON we'll be able to cut that time in half: we'll download the baseline version's JSON instead of running a To make the checking itself faster, with fairly trivial effort I think we can get small multiples of 10x speedup on the checking time. With a bit more effort I think we can get more orders of magnitude. Consider that an
A few other folks have reached out to ask for the same thing, and not necessarily just for use in 3rd party cargo plugins. I'd be happy to do it as time allows, and would appreciate help. I hope you won't mind me renaming the issue to generalize it to the library aspect rather than the cargo plugins. |
Hey Predrag! As we discussed on Twitter, I'm happy to be a "beta tester" for this feature and integrate it in https://github.com/MarcoIeni/release-plz :) |
+1 from me on library-fication. I'm working on cargo-vcs a "workspace member summary/checker" to help with managing repository (git) versioning of workspace members. I've added some rudimentary checks like MSRV but it'd be real nice to integrate cargo-semver-checks into cargo vcs directly. |
Is this something to help when a workspace is spread across submodules? It might be useful to explicitly list that as I was a bit confused as to what its purpose was at first.
I'm curious why this needs to be supported directly in cargo-vcs when cargo-semver-checks can work directly on a workspaace. |
It's for workspaces consisting of members each with separate repositories. The main use-case I was aiming for was switching between "checkout targets" (e.g. branches) saved as profiles to test regressions in cases such as deep API changes where multiple member crates need to be modified for the new API. Switch all to master in one go, switch back to whatever setup you modified things in one go as well. Get a nice summary of the workspace repo status etc.
It doesn't. I just thought it'd be a nice bonus to show in |
Off-topic but I'd love to hear (not in this issue, perhaps over Twitter DM or email?) about other pieces of data you're interested in getting and reporting / other checks you might want to perform. I'm very interested in the kinds of use cases that might come up from making data more interconnectible, especially if that data is "non-standard" i.e. not just a database or an API designed for the purpose but instead things like "crate MSRV" for example. |
I'd love to discuss this. There's nothing but twitter on your profile though and I don't do twitter, is there any other way I can reach you? |
Can I give this a try? |
Of course, that'd be great! If you'd like, I'd be happy to chat about this work throughout the process so that we don't end up in a situation where there's a single big scary PR to merge at the very end. How can I best help you out and set this effort up for success? |
I plan to work on this tomorrow. |
Sounds great! Broadly, I'd recommend three things:
Thanks again for your help with this! I'm excited by the new things this will enable 🙌 |
All first-party cargo commands follow a pattern of a thin CLI on top of an "op". While refactoring to this style would be useful for cargo-semver-check,
So I'm assuming any "checks-as-a-lib" work would be independent of the cargo upstreaming goal. A challenge we have in cargo code which this could also run into is clear separation of library behavior and CLI policy, like outputting data. |
I defer to @epage on the design of the CLI / library interface since he's a cargo maintainer. It sounds like we can have more freedom to design our APIs than I had assumed. |
Yes, while there is a standard pattern for ops that is fairly limited, a lot of other functionality is exposed in the Personally, I feel using this as a library isn't worth it until the performance is better than I recently saw in #296. Few cases of integration can handle 5-20s delays. |
For my use case, 5 or 20 seconds are fine because the app needs to run primarily in CI.
Me too, let's see what I accomplish tomorrow :) |
I think most users would probably use @MarcoIeni if you're looking for an easy first issue to start getting familiarized with the CLI side of the codebase, try #298? I'm also hoping that the refactor to expose a library API will make #303 easier to prototype, which is exciting! |
After looking into this together with @epage, it turns out that the numbers were from a debug build. Semver-checking the same two libraries on my machine took 1.56s and 0.25s respectively, 10.7-14.4x faster than initially reported. There certainly are massive crates that would take 20s to check, but they'd need to be 5-10x the size of I'm back to being not that worried about performance 😄 |
Initial release in https://github.com/obi1kenobi/cargo-semver-checks/releases/tag/v0.18.2 though obviously we'll continue polishing the library APIs over time. Regarding performance, there are massive perf gains on the horizon and I'm working on Trustfall to make them happen: https://predr.ag/blog/speeding-up-rust-semver-checking-by-over-2000x/ |
Providing a library alongside the cli tool would be much appreciated for tools like https://GitHub.com/paritytech/cargo-unleash even before it becomes part of cargo
Related: #61
CC @Xanewok @gnunicorn
The text was updated successfully, but these errors were encountered: