Feature request: Support Cargo.toml for dependency graph

Dependency graph has support for Java, JS, Ruby, Python, and .NET. But adding support for Rust doesn’t seem like it would be too hard. Cargo.toml files are divided into sections and have 1 section titled dependencies that is followed by a list of names of all Rust “crates” that are dependencies. The name of a Rust “crate” can also be found in the Cargo.toml file under the section titled pacakge. Here’s an example.

[package]
name = "my_crate"

[dependencies]
this_other_crate = 0.0.6
some_other_crate = 2.0.3
still_another_crate = 0.3.0
226 Likes

Hi @calebwin ,

Thanks for this feedback! We’re always working to improve GitHub and the GitHub Community Forum, and we consider every suggestion we receive. I’ve logged your feature request in our internal feature request list. Though I can’t guarantee anything or share a timeline for this, I can tell you that it’s been shared with the appropriate teams for consideration.

Cheers!

22 Likes

I would love to see this happening too. I’ve been working extensively on a rust project and support for cargo dependency graph would really complete the experience. No rush but any news?

2 Likes

I agree this would be awesome!

2 Likes

Kudos for not saying “i forwarded it” and marking it as resolved…

Yes, i’m being spiteful, sorry. Just a bit frustrated with the state of some other feature requests.

1 Like

If this is added, I think it should be noted that Cargo.lock could be preferred to Cargo.toml when present. Cargo.lock contains structured data on the entire dependency graph, including versions used, while Cargo.toml only contains version constraints.

If your environment can run commands, I also highly recommend Cargo’s metadata command.

cargo metadata --format-version=1

It parses Cargo.toml and Cargo.lock files, does dependency resolution if Cargo.lock is not present, and outputs json.

The output is stable, and it’s documented at https://doc.rust-lang.org/cargo/commands/cargo-metadata.html.

40 Likes

As a member of the Cargo Team, plese reach out to the team if we can be of assistance!

24 Likes

I just want to point out that there can be more than one dependencies section. This is common when specifying different dependencies for different features, architectures, etc.

See [this](http://I%20just want to point out that there can be more than one dependencies section. This is common when specifying different dependencies for different features, architectures, etc. See this for an example.) for an example. The rest of the page is good information for how dependencies can be specified.

In addition, there can be dev-dependencies and build-dependencies.

5 Likes

Just here to bump this for visibility and say that this is an excellent idea! <3

3 Likes

This would be great :crossed_fingers:

Bumping this too :grinning:

1 Like

Indeed. It’s not that Rust is that young any more. Bump!

1 Like

Bumping as well, this is such a useful feature and Rust has quite an ecosystem of modules, this would make it easier to navigate.

1 Like

Any status updates on this? I mean, you can extract Github dependencies in a single line of code: cargo metadata --format-version=1 | jq " .packages | .[] | .repository" | grep github

3 Likes

Bump +1 ! I think this would be a great feature. Github is supporting PHP composer for crying out loud, I’m sure it can manage to support Cargo. :grinning:

1 Like

Bump! Any status updates on this yet?

Hello - and thank you for this feedback! Our feedback protocol has changed since this the inception of this thread, I encourage you to please submit your feedback via the new GitHub Feedback Discussions forum so that our product team can better track your request :slight_smile: and to continue the conversation on that thread. It’s a new thing, but we’re trying to push all product feedback to the same new area so it’s easier to find and consolidate user feedback!