Skip to content
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

Minimize features of indexmap and chrono #1000

Merged
merged 2 commits into from
Dec 4, 2021

Conversation

carols10cents
Copy link
Contributor

Which issue does this PR close?

Closes #999.

Rationale for this change

In the case of chrono, making sure these crates aren't turning on a feature name that's deprecated and will be removed eventually, and that they're turning on the minimal number of features actually used to minimize the features projects depending on these crates will be forced to turn on.

In the case of indexmap, by explicitly enabling the "std" feature since arrow isn't targetting no_std environments, this might save a bit of build time done by the indexmap crate at build time to try to automatically detect whether the target has std available or not.

What changes are included in this PR?

Adjustments to the feature sets of chrono and indexmap

Are there any user-facing changes?

If projects depending on arrow/parquet are making use of the coincidence that arrow/parquet turns on chrono features, this might mean they have to turn on the features themselves, but that would be a bug in that project's use of chrono.

I can't imagine the indexmap change would affect anyone except for maybe building slightly faster :)

Chrono's default features contain "oldtime", which is deprecated.
According to [the docs](https://docs.rs/chrono/0.4.19/chrono/#duration),

> new code should disable the oldtime feature and use the
> chrono::Duration type instead. The oldtime feature is enabled by
> default for backwards compatibility, but future versions of Chrono
> are likely to remove the feature entirely.

so follow that recommendation by setting default-features to false. And
actually, only Arrow needs the "clock" feature, so all the other
features can stay off too to minimize the feature set that projects
depending on arrow or parquet are forced to enable.
The indexmap crate uses the autocfg crate to do target detection to
determine whether `std` is available. Arrow isn't targeting `no_std`
environments, so the target detection isn't necessary. This might save
some build time.

indexmap-rs/indexmap#145
@github-actions github-actions bot added arrow Changes to the arrow crate parquet Changes to the parquet crate labels Dec 3, 2021
@@ -40,15 +40,15 @@ path = "src/lib.rs"
serde = { version = "1.0", features = ["rc"] }
serde_derive = "1.0"
serde_json = { version = "1.0", features = ["preserve_order"] }
indexmap = "1.6"
indexmap = { version = "1.6", features = ["std"] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know some arrow users target wasm which has some strange semantics related to std, however, we have a test for compiling with a wasm target, and those seem to have passed on this PR:

https://github.com/apache/arrow-rs/runs/4413147281?check_suite_focus=true

fyi @roee88

@alamb alamb merged commit 72c9d1e into apache:master Dec 4, 2021
@alamb
Copy link
Contributor

alamb commented Dec 4, 2021

Thanks @carols10cents

@carols10cents carols10cents deleted the minimize-features branch December 5, 2021 02:18
alamb pushed a commit that referenced this pull request Dec 9, 2021
* Disable default features of chrono; only enable features needed

Chrono's default features contain "oldtime", which is deprecated.
According to [the docs](https://docs.rs/chrono/0.4.19/chrono/#duration),

> new code should disable the oldtime feature and use the
> chrono::Duration type instead. The oldtime feature is enabled by
> default for backwards compatibility, but future versions of Chrono
> are likely to remove the feature entirely.

so follow that recommendation by setting default-features to false. And
actually, only Arrow needs the "clock" feature, so all the other
features can stay off too to minimize the feature set that projects
depending on arrow or parquet are forced to enable.

* Explicitly enable indexmap's "std" feature

The indexmap crate uses the autocfg crate to do target detection to
determine whether `std` is available. Arrow isn't targeting `no_std`
environments, so the target detection isn't necessary. This might save
some build time.

indexmap-rs/indexmap#145
@alamb
Copy link
Contributor

alamb commented Dec 20, 2021

This didn't backport (cherry-pick) cleanly; Not sure why but I don't plan to spend any time figuring it out and instead will wait for arrow 7.0.0 release. If anyone else needs this sooner feel free to get a PR up to active_release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate parquet Changes to the parquet crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve the specification of some features of dependencies
3 participants