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

cargo: Define dependencies on the workspace level #667

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

vadorovsky
Copy link
Member

@vadorovsky vadorovsky commented Jul 17, 2023

This way we will avoid version mismatches and make differences in features across our crates clearer.


This change is Reviewable

@netlify
Copy link

netlify bot commented Jul 17, 2023

Deploy Preview for aya-rs-docs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 96fa08b
🔍 Latest deploy log https://app.netlify.com/sites/aya-rs-docs/deploys/64b70c7e3867780008bd7438
😎 Deploy Preview https://deploy-preview-667--aya-rs-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@tamird tamird left a comment

Choose a reason for hiding this comment

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

Reviewed 11 of 11 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @vadorovsky)


Cargo.toml line 43 at r1 (raw file):

]

[workspace.dependencies]

if one of these becomes unused, will anything inform us?


Cargo.toml line 47 at r1 (raw file):

assert_matches = "1.5.0"
async-io = { version = "1.3" }
aya = { path = "aya", version = "0.11.0", features=["async_tokio"] }

is it necessary to list features here? seems to me like we just want versions here since each user crate should specify used features for itself


Cargo.toml line 77 at r1 (raw file):

testing_logger = "0.1.1"
thiserror = "1"
tokio = { version = "1.24.0" }

this should be default-features = false, i think? i'm not sure how features work in workspace dependencies, perhaps they are ignored?

Copy link
Member

@tamird tamird left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @vadorovsky)


Cargo.toml line 77 at r1 (raw file):

Previously, tamird (Tamir Duberstein) wrote…

this should be default-features = false, i think? i'm not sure how features work in workspace dependencies, perhaps they are ignored?

yeah, this is causing cargo to log warnings:

warning: /home/tamird/src/aya/aya-obj/Cargo.toml: `default-features` is ignored for thiserror, since `default-features` was not specified for `workspace.dependencies.thiserror`, this could become a hard error in the future
warning: /home/tamird/src/aya/test/integration-test/Cargo.toml: `default-features` is ignored for tokio, since `default-features` was not specified for `workspace.dependencies.tokio`, this could become a hard error in the future

@vadorovsky vadorovsky force-pushed the workspace-dependencies branch 2 times, most recently from 2ee2935 to 202c688 Compare July 17, 2023 21:30
Copy link
Member Author

@vadorovsky vadorovsky left a comment

Choose a reason for hiding this comment

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

Reviewable status: 9 of 11 files reviewed, 3 unresolved discussions (waiting on @tamird)


Cargo.toml line 43 at r1 (raw file):

Previously, tamird (Tamir Duberstein) wrote…

if one of these becomes unused, will anything inform us?

I checked and cargo-udeps doesn't inform about unused workspace dependencies. :/ I will keep thinking about the solution.


Cargo.toml line 47 at r1 (raw file):

Previously, tamird (Tamir Duberstein) wrote…

is it necessary to list features here? seems to me like we just want versions here since each user crate should specify used features for itself

It's not, we can always list features in user crates.

My idea was to define them here if we know that we are going to use those features in all crates and keep only single feature lists which differ in user crates. To not repeat the feature list over everywhere when not necessary.


Cargo.toml line 77 at r1 (raw file):

Previously, tamird (Tamir Duberstein) wrote…

yeah, this is causing cargo to log warnings:

warning: /home/tamird/src/aya/aya-obj/Cargo.toml: `default-features` is ignored for thiserror, since `default-features` was not specified for `workspace.dependencies.thiserror`, this could become a hard error in the future
warning: /home/tamird/src/aya/test/integration-test/Cargo.toml: `default-features` is ignored for tokio, since `default-features` was not specified for `workspace.dependencies.tokio`, this could become a hard error in the future

Done.

Copy link
Member

@tamird tamird left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: 9 of 11 files reviewed, 2 unresolved discussions (waiting on @vadorovsky)


Cargo.toml line 43 at r1 (raw file):

Previously, vadorovsky wrote…

I checked and cargo-udeps doesn't inform about unused workspace dependencies. :/ I will keep thinking about the solution.

Does cargo machete do any better? https://blog.benj.me/2022/04/27/cargo-machete/


Cargo.toml line 47 at r1 (raw file):

Previously, vadorovsky wrote…

It's not, we can always list features in user crates.

My idea was to define them here if we know that we are going to use those features in all crates and keep only single feature lists which differ in user crates. To not repeat the feature list over everywhere when not necessary.

I think it'd be better to mark everything here default-features = false and let downstream crates request the features they want. Otherwise you risk introducing unintended features (and dependencies) downstream.

Copy link
Member Author

@vadorovsky vadorovsky left a comment

Choose a reason for hiding this comment

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

Reviewable status: 9 of 11 files reviewed, 2 unresolved discussions (waiting on @tamird)


Cargo.toml line 43 at r1 (raw file):

Previously, tamird (Tamir Duberstein) wrote…

Does cargo machete do any better? https://blog.benj.me/2022/04/27/cargo-machete/

It doesn't :(


Cargo.toml line 47 at r1 (raw file):

Previously, tamird (Tamir Duberstein) wrote…

I think it'd be better to mark everything here default-features = false and let downstream crates request the features they want. Otherwise you risk introducing unintended features (and dependencies) downstream.

Good point

Copy link
Member

@tamird tamird left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r2, 6 of 6 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @vadorovsky)


Cargo.toml line 43 at r1 (raw file):

Previously, vadorovsky wrote…

It doesn't :(

Maybe the best we can do is add a comment here?

Copy link
Member Author

@vadorovsky vadorovsky left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @tamird)


Cargo.toml line 43 at r1 (raw file):

Previously, tamird (Tamir Duberstein) wrote…

Maybe the best we can do is add a comment here?

Done. I will also think about contributing either to cargo-udeps or cargo-machete.

Copy link
Member

@tamird tamird left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r5, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @vadorovsky)

@vadorovsky vadorovsky force-pushed the workspace-dependencies branch 2 times, most recently from e1f6e5c to c8dbb96 Compare July 18, 2023 21:05
Copy link
Member

@tamird tamird left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r6, 1 of 1 files at r7, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @vadorovsky)

This way we will avoid version mismatches and make differences in
features across our crates clearer.
Copy link
Member

@tamird tamird left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r8, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @vadorovsky)

@vadorovsky vadorovsky merged commit f554d42 into aya-rs:main Jul 18, 2023
@vadorovsky vadorovsky deleted the workspace-dependencies branch July 18, 2023 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants