-
Notifications
You must be signed in to change notification settings - Fork 67
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
Make it available as a library? #30
Comments
Hello, nice to see you again 😄 👍
Yes! I think this makes sense for most command line programs as well, to keep the CLI part in the main program and the rest as a library.
Yes, let's do the 0.x dance to begin with. Keep it simple and let's do this! |
Oh, I just thought of a suggestion. Can we please keep both the CLI and library crate in this git repository? That would make it easier to work with and would make the code more discoverable for newcomers, in my opinion. If you would like to co-maintain I will gladly add you. |
Nice to see you again as well! And, I was intending to keep it all in one repo, I was going to just move most of I'll gladly help co-maintain, though I'm afraid you shouldn't expect me to do that much work on stuff. I just don't have time to be too dedicated. In the interests of having a higher bus number for this project though, go ahead. I'm working on a side-project to do quality analysis of crates, so I'll probably be doing stuff in in the same general area. |
Excellent, collaborator invite has been sent! |
Do we need to modify the Cargo.toml to allow using only the library part from crates.io or will a new cargo publish be enough? |
You know... I'm not sure. I'm pretty sure that just a new publish will be enough though. |
I'll prep and publish a new release. |
Do you have an example project using the master branch as a library? While trying to test a minimal example program using cargo-geiger as a library, it seems to me that the cargo executable needs to launch cargo plugins as a subprocess in order to load the correct dynamic libraries. Do you have similar results? If cargo needs to be the parent process then maybe adding some structured output format would be more useful, like optional json output perhaps? The error I'm getting seems to be the same as this: rust-lang/rust#47931 |
Honestly, I haven't tried yet. XD I've had similar issues with libraries while developing though; I need to actually install it and run with |
Ok :) Well, the refactoring is a step in the right direction even if it doesn't allow running it as a normal Rust library. I rediscovered a detail yesterday and that is that I apparently made What do you think about adding optional json output as a workaround? |
The library https://github.com/rust-analyzer/rust-analyzer |
Hi. I'm interested in this for |
Hi @dpc ! I've been following your Ok, back to business.
This sounds like something that would be relatively easy to pull off. Since |
I am always tight on time. If you can do it, I'll take it. If you can't, I'll try to get to it at some point. :) |
Then I'll try to put in some time for this during the coming week or so. That refactoring has been bugging me for quite a while, guess it's time to just do it 😆 |
The #41 was just merged and I think that should make cargo-geiger almost usable as a library now, almost. The public API is in very rough shape and I would like some help to polish that. Do you, @icefoxen and @dpc, think the master branch is in good enough shape to start experimenting with using it as a library now? |
Good enough to me. :) |
Cool :) I'm looking forward to see what you make of it. |
Any chance for one function, that can scan one path? I need to get gieger count per standalone crate, that I already have pin-pointed. |
I second @dpc 's request there; it's nice to be able to deal with a single package at a time without all its dependencies. Apart from that, looks very nice. |
Sure sounds very reasonable. The only reason I made it private was to start removing things from the public API since the current version unintentionally exposes quite a few implementation details. I will have more time for this tonight but feel free to make PRs for API changes ;)
Ok, that was a undercaffeinated comment on my part. First things first. It should be made public and maybe it should be refactored into something nicer. https://github.com/anderejd/cargo-geiger/blob/master/src/lib.rs#L301 |
Okay, ☕️ has been administered. This comment is a note for myself as much as part of the conversation so sorry for the spam.
|
Now after #45 I think the cargo-crev use-case could be covered by the public API.
Thoughts? |
While I was looking at it... why so many |
...I just refactored that into other functions... I can add it back if you'd like? 😆 Were you looking at the latest commit in master?
Lack of time 🤷♂️ But yes, they should be replaced by Result. EDIT: I just edited my previous comment. |
https://github.com/dpc/crev/tree/geiger Works OK for a lot of dependencies of
|
Thanks for the report! It looks like the time has come to remove the last unwraps and excepts. I can probably find the time to look at it this weekend. Don't be shy about making a PR for this in the meantime :) |
I'll be removing panics and doing some more public API polish here: #48 this weekend. |
Merged #48. |
I'll try it out at some point. :) Thanks! |
The library parts that have been decoupled from the cargo plugin are now released on crates.io: https://crates.io/crates/geiger I think this issue can be closed now? |
Closing, feel free to re-open or create new related issues! 🙂 |
I want to make a website that gives statistics on various crates, including unsafe usage. Naturally I immediately thought of this, but using cargo-geiger to output data and then attempting to re-parse it seems excessively hard. Would you accept a PR that refactors most of the actual work into a library crate?
I don't think I would ever really expect a stable API or such, but being able to keep all the processing in one program would be nice.
The text was updated successfully, but these errors were encountered: