tracel-ai / burn

Burn is a new comprehensive dynamic Deep Learning Framework built using Rust with extreme flexibility, compute efficiency and portability as its primary goals.
https://burn.dev
Apache License 2.0
8.89k stars 439 forks source link

Add `source` button in Docs #1244

Open Arjun31415 opened 9 months ago

Arjun31415 commented 9 months ago

The source button present in docs for tch-rs as a sample - image

No such button for burn-rs docs image

It would greatly help looking into pin-pointing the definition and implementation of modules in this vast repo

nathanielsimard commented 9 months ago

It's available on docs.rs, we are probably missing a feature flag when building the docs, but I'm not able to find it.

jofas commented 8 months ago

It's not a feature flag that is missing here but the fact that the burn package's docs are build with --no-deps. While rustdoc still expands and documents re-exported items (in this case these from burn-core), it can't produce the source links to the code of the dependency. Docs.rs doesn't suffer from this as it generates the docs for every uploaded library crate and interlinks them (including the links to the source code).

I wasn't able to find where the API docs are build in the CI, are they build manually? I think the most sensible fix would be to build the whole workspace instead of just the burn package for the API docs. Or build the burn package without the --no-deps flag. The former can be done with --no-deps to avoid 3rd-party crates to be added to the docs, which should be fine if burn doesn't re-export any items from them. If it does, the source links for said items would be missing again. Maybe something like cargo doc -p burn -p burn-core -p burn-train --no-deps would be enough to add the source links to every item, I haven't checked whether burn-core or burn-train re-export any items themselves.

antimora commented 8 months ago

Tagging @Luni-4 @syl20bnr

Luni-4 commented 8 months ago

@jofas analysis is correct. If I remember correctly, we have removed the --no-deps option because of the great amount of time in bulding the docs. Here and here are the function calls, even used on CI.

Since documentation should be independent from any operating systems (@nathanielsimard @antimora @louisfd please confirm whether my previous statement is correct for what concerns burn), a possible solution might be the creation of a specific documentation task. This task can be run both locally and on CI. This kind of task:

What do you think @syl20bnr?

ivnsch commented 1 month ago

This might be outdated? I see currently source links in the docs: https://docs.rs/burn/latest/burn/nn/conv/struct.Conv2d.html

jofas commented 1 month ago

This issue is about the docs hosted on burn.dev, which are missing the source buttons.