-
-
Notifications
You must be signed in to change notification settings - Fork 325
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
Only use necessary futures components #900
Conversation
futures-channel = { version = "0.3.17", features = ["sink"], optional = true } | ||
futures-util = { version = "0.3.17", features = ["sink"], optional = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while i like the trimming of dependencies we don't use, the use of all their peripheral crates (when futures have a facade-crate model) makes our documentation look less crisp (can no longer just point to futures, docs need to point at one or more sub-crates) and it feels slightly wrong to push that hierarchy complexity onto us + users.
would it make sense to use futures
directly without default features to achieve a similar result?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes our documentation look less crisp
Another wrinkle that I was not aware of was that rustdoc does not include development dependencies when generating the links, so even having futures
as a development dependency is not sufficient to keep the documentation in its current form.
would it make sense to use
futures
directly without default features to achieve a similar result?
I think it would be fine, but I do not have a strong opinion either way. My PR was largely predicated on the above misconception about rustdoc behavior, and I completely agree with your feeling that it seems wrong to use the futures
subcrates in official documentation.
Realistically, saving 4 dependencies by using the futures
subcrates directly is not all that significant, so I will close this PR for the time being unless there are any that would really like to have this included. Nonetheless, thank you for your time in reviewing the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i do appreciate you taking the time to do this. was not aware that the ecosystem was so consistent in the futures ecosystem use (most tend to only use util + core, and occasionally channel) so i think there is real value in aligning.
I think it's actually possible to get around the documentation issue by just referring to futures
even though the file we are documenting does not have it in scope. we can use the same trick we use internally by referring to a crate in dev-dependencies (and have full futures listed in dev-dependencies)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's actually possible to get around the documentation issue by just referring to
futures
Interesting, I did not know that that was a possibility. I will give it a try and reopen the PR if that is alright with you.
This comment was marked as off-topic.
This comment was marked as off-topic.
6c5dc53
to
8a79c27
Compare
It is possible to only require Footnotes
|
Won't the docs-only feature break people who run |
That's kind of already broken. You really need to run the big string in RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --lib --workspace --features=derive,ws,oauth,jsonpatch,client,derive,runtime,admission,k8s-openapi/v1_23 --open which emulates the docs.rs flags we tell docs.rs to use: https://github.com/kube-rs/kube-rs/blob/c976f9ee7d3aab59b9fa2f017d01e986e0bb3afa/kube/Cargo.toml#L33-L36 EDIT: you'll still be able technically able to run |
Yeah, this is slightly worse with the extra feature. I didn't realise dev-deps didn't actually resolve in doc links because we relied on them to cross-link kube crates. It just happens to work for us because we also happen to build all the kube crates 🙃 However, I don't think this is actually working as is? |
That is unexpected... I just tried |
Not really. You won't get feature-is-required tags (which is slightly annoying), but |
a666c62
to
8db2851
Compare
In that case, would it be acceptable to refer to |
Yeah, given the constraints I think it's probably fine to link to the futures_* subcrates in documentation. |
1a1a9a2
to
ad7c560
Compare
Signed-off-by: onalante-msft <[email protected]>
Signed-off-by: onalante-msft <[email protected]>
Signed-off-by: onalante-msft <[email protected]>
Signed-off-by: onalante-msft <[email protected]>
Signed-off-by: onalante-msft <[email protected]>
Also fix link in controller/mod.rs to futures::stream::select. Signed-off-by: onalante-msft <[email protected]>
Signed-off-by: onalante-msft <[email protected]>
ad7c560
to
6e86928
Compare
I don't think OS should really matter here. It might be down to rust versions, but i just updated nightly and ran the command in the
whereas they should point to something under This is with your latest force push. Beyond that, if the links would resolve i am all 👍 on this. |
I have ran into this before! IIRC it should be fixable by adding an otherwise useless (heh…) |
Yep, tested with |
I understand the issue now, sorry about the confusion. I cannot get the reference to |
yeah, that one seems to not work no matter what i try. it's not like need to think about this a bit. |
I believe the root cause for this is rust-lang/rust#87048. When trying to resolve the link for Even more strangely, if I create a test crate with a similar module layout and re-export declaration pub mod foo { // in folder
mod bar { // in file
pub fn bar() {}
}
pub use self::bar::bar;
} I can refer to In any case, I will try to come up with a workaround. |
Another possibly interesting point. The current local build seems to sometimes resolve better than what docs.rs does. |
One possible solution for the time being is to have use |
Signed-off-by: onalante-msft <[email protected]>
2d35c47
to
7349dcd
Compare
Signed-off-by: onalante-msft <[email protected]>
This got left behind. Apologies. Closing in favour of smaller, but more specific feature tuning done in #1442 |
Motivation
Dependents of
kube-rs
pull in allfutures
components, only some of which are used bykube-rs
crates.futures
is relatively compact, but it would still be helpful for compile times and dependency graph auditing to only pull in necessary components.Solution
kube-rs
only has direct need offutures-util
(for extension traits, utility functions and structs, and macros) andfutures-channel
(for mpsc and oneshot). The dependencies have been adjusted to reflect this.Note
I also modified the development dependencies in the same manner as the build dependencies, but it makes for slightly less ergonomic examples in the documentation.1 If this is an issue, I can restore full
futures
as a development dependency.Footnotes
I left in some
tokio
feature restrictions as well, but these have no effect on the code. I can restore the full feature list if that is preferred. ↩