Skip to content

Conversation

@weiznich
Copy link
Contributor

During a dependency review we noticed that the bytes crate includes various development scripts. These development scripts shouldn't be there as they might, at some point become problematic. As of now they prevent any downstream user from enabling the [bans.build.interpreted] option of cargo deny.

I opted for using an explicit include list instead of an exclude list to prevent these files from being included in the published packages to make sure that everything that's included is an conscious choice.

Cargo.toml Outdated
readme = "README.md"
keywords = ["buffers", "zero-copy", "io"]
categories = ["network-programming", "data-structures"]
include = ["CHANGELOG.md", "LICENSE", "README.md", "SECURITY.md", "Cargo.toml", "src/**/*.rs"]
Copy link
Member

@martin-g martin-g Dec 16, 2025

Choose a reason for hiding this comment

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

I wonder whether tests/**/*.rs and benches/**/*.rs should be added too.
They are not needed for the build as a (transitive) dependency of a project but still they are part of the source distribution.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are arguments for excluding and including these directories:

For excluding: Almost 100% of the users that consume the code from crates.io don't run or use these tests or benchmarks at all.

For including: There are specific usage patterns which might benefit from having these folders there:

  • Linux distributions running tests as part of their package builds
  • Possibly crater, but crater also fetches github repositories so that might not be that important

I personally tend to exclude these folders whenever possible as the large majority of users won't need them. For the exceptions there are other solutions. That's also a something shared by other large projects like reqwest or rustls.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to include the tests but not benchmarks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I pushed an update to do that

Copy link
Contributor

Choose a reason for hiding this comment

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

Including the clippy config file also seems harmless, and might help for anyone who vendor their dependencies using versions from crates.io.

During a dependency review we noticed that the bytes crate includes various development scripts. These development scripts shouldn't be there as they might, at some point become problematic. As of now they prevent any downstream user from enabling the `[bans.build.interpreted]` option of cargo deny.

I opted for using an explicit include list instead of an exclude list to prevent these files from being included in the published packages to make sure that everything that's included is an conscious choice.
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Thanks.

@Darksonn Darksonn enabled auto-merge (squash) December 17, 2025 13:34
@Darksonn Darksonn merged commit fd426ca into tokio-rs:master Dec 17, 2025
18 checks passed
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.

3 participants