Make reqwest optional#724
Conversation
tustvold
left a comment
There was a problem hiding this comment.
Thank you this seems sensible to me and makes sense, I like the formulation of having a minimal feature flag and a more batteries included one. We should roll this into the crypto work as well.
| default = ["fs"] | ||
| cloud = ["serde", "serde_json", "quick-xml", "hyper", "reqwest", "reqwest/stream", "chrono/serde", "base64", "rand", "ring", "http-body-util", "form_urlencoded", "serde_urlencoded", "tokio"] | ||
| azure = ["cloud", "httparse"] | ||
| cloud = ["cloud-base", "reqwest"] |
There was a problem hiding this comment.
Should we discuss feature naming? Either now or in an issue before the next release? Because now cloud is an alias for reqwest, essentially. Would it read clearer if say azure was defined as
- azure = ["azure-base", "cloud"]
+ azure = ["azure-base", "reqwest"]because azure-base already depends on cloud-base. We have a diamond dependency graph here.
Should we have some docs about feature flag options?
There was a problem hiding this comment.
+1 we'd want to coordinate on naming since #707 is also renaming these features.
Also see #707 (review)
both -base and -custom makes sense to me
There was a problem hiding this comment.
Renaming -custom to -base is completely fine by me too. (Though it might read a bit odd in the object_store code: custom is not an additional feature.)
I agree the cloud adds nothing to reqwest. It is only there for backwards compatibility. If you want to make this a breaking change it can be removed, of course.
There was a problem hiding this comment.
i actually like -base more 😄 This is my mental model:
cloud-base = shared cloud code
*-base = provider-specific code without default reqwest
reqwest = built-in HTTP transport
cloud = compatibility alias for cloud-base + reqwest
aws/azure/gcp/http = provider base + reqwest
# Shared cloud/provider implementation dependencies.
# This intentionally does NOT include reqwest.
cloud-base = [
"serde",
"serde_json",
"quick-xml",
"hyper",
"chrono/serde",
"base64",
"rand",
"ring",
"http-body-util",
"form_urlencoded",
"serde_urlencoded",
"tokio",
]
# Built-in reqwest-based HTTP transport.
reqwest = [
"dep:reqwest",
"reqwest/stream",
]
# Compatibility/convenience alias.
# Historically, cloud meant "common cloud support", including reqwest.
# Keep that behavior for existing users.
cloud = [
"cloud-base",
"reqwest",
]
# Provider base features.
# These compile provider logic without forcing reqwest.
azure-base = [
"cloud-base",
"httparse",
]
gcp-base = [
"cloud-base",
"rustls-pki-types",
]
aws-base = [
"cloud-base",
"crc-fast",
"md-5",
]
http-base = [
"cloud-base",
]
# Batteries-included provider features.
# These preserve existing behavior: enabling aws/azure/gcp/http gives
# the default reqwest transport.
azure = [
"azure-base",
"reqwest",
]
gcp = [
"gcp-base",
"reqwest",
]
aws = [
"aws-base",
"reqwest",
]
http = [
"http-base",
"reqwest",
]
There was a problem hiding this comment.
created an issue to facilitate with discussion
#744
|
I merged this PR up from main to resolve a conflict. It seems like @kevinjqliu has gotten consensus on the naming here ( @awesterb are you willing to implement @kylebarron 's suggestion on #724 (comment) ? |
Will do! |
The role of cloud has been taken over by reqwest + cloud-base. Implements #724 (comment) BREAKING CHANGE: according to cargo semver-checks: aws/azure/gcp/http no longer enable the cloud feature.
Done. Strictly speaking, it is a breaking change, according to (But there are already other breaking changes.) |
Yes I agree -- this is going to be a breaking change, but that is ok as we are about to put out a non semver compatible release |
alamb
left a comment
There was a problem hiding this comment.
Thank you @awesterb -- I think this looks good to me
@kevinjqliu and @tustvold and @kylebarron I would appreciate your reivew as well
I also think we will need to document how these feature flags, which are currently here
arrow-rs-object-store/src/lib.rs
Line 76 in 18ed86c
Which renders here:
https://docs.rs/object_store/latest/object_store/#available-objectstore-implementations
|
Thanks everyone! Glad we found a way to move forward with this. I did a brief review, it looks great directionally. One related question: should we also add a small CI check that asserts the dependency contract directly, i.e. that the cargo tree \
--no-default-features \
--features aws-base,azure-base,gcp-base,http-base \
--edges normal \
-i reqwestand fail CI if Not a blocker, but if |
kevinjqliu
left a comment
There was a problem hiding this comment.
LGTM!
One nit: we may want to add a CI check to ensure reqwest is not accidentally added back to the *-base feature dependency graph in the future.
|
Thanks for all the movement on this! I've added the comments to Updating the Edits by maintainers are enabled in case anyone wants to contribute to this PR. Feel free! |
|
thank you @awesterb for all the changes. Im happy to follow up and add the docs changes + CI checks if necessary |
|
Is the CI failure pre-existing or new in this PR? |
|
the CI failure is not related to this PR, fixing the issue in #746 |
I merge that in and will merge up from main for this one too |
Agreed - I will file follow on tickets for these items |
|
I merged up to resolve some conflicts |
|
I have filed follow on tickets |
|
looks like the ci failed on arrow-rs-object-store/src/integration.rs Lines 1440 to 1527 in f554e60 we need to use |
|
Thanks @kevinjqliu; I'll make that change on this branch |
|
ty! i couldnt verify the wasm32 ci issue, but i suspect its the same issue |
Co-authored-by: Kevin Liu <kevinjqliu@users.noreply.github.com>
|
💯 thanks @awesterb for the PR and everyone else for the reviews |
No, thank you all for willing to incorporating this feature! This helps us cut down our dependency tree a lot! |
Which issue does this PR close?
reqwestoptional #723 .Rationale for this change
We're using
object_storewith a code base that already usesawcas HTTP-client, and would like to avoid havingreqwestas additional HTTP client alongsideawc. An alternativeHttpConnectorcan already be provided currently, but thereqwestdependency can not yet be avoided.Also, since
reqwestcan't be used forwasm32-wasip1anyways, not having to package it there is nice too.What changes are included in this PR?
Adds a new
reqwestfeature that gatesdep:reqwest, but is enabled bycloudby default. This meansreqwestwill still be pulled in by theazure,gcp,awsandhttpfeatures, as is the case now. For avoidingreqwest, the featurescloud-base,azure-base,gcp-base,aws-baseandhttp-baseare added.Some features that depend on
reqwesttypes I gated behindreqwesttoo, such asclient::Certificate. To keep the pull request minimal andnon-breaking(see #724 (comment)), I did not attempt to rewrite those to bereqwest-independent. I believe all of the gated features can be avoided when providing your ownHttpConnector. (Besides, most of these features were already gated behind!wasm32.)Tests that use
reqwest-gated types were gated behindreqwesttoo.Added to CI extra
clippyjobs to catch missing gates in the future, and a build job forwasm32-wasip1withoutreqwest.Where
reqwest::{Method,StatusCode,header}was used, this was replaced by thehttptypes.I considered copying the
X-no-cryptonaming scheme (aws-no-crypto,gcp-no-crypto...) from GH-707, but decided not to useaws-no-reqwest(etc.) since that would necessitateaws-no-crypto-no-reqwest(and worse) in the future. (Combining !707 could make sense, havingX-basemean no crypto and no reqwest.)Are there any user-facing changes?
The feature
reqwestthat gatesdep:reqwest, and the featurescloud-base,azure-base,gcp-base,aws-baseandhttp-basethat avoidreqwest.No breaking changes (according to https://crates.io/crates/cargo-semver-checks.)