Remove tests from published crate?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3k
- Forks
- 386
- Avg merge
- 1h 43m
- Merged PRs (30d)
- 1
Description
Hi everyone 👋
At my company we are trying to regularly review the crates we depend on whenever we update them to assure a baseline of supply chain safety. During such a review I've noticed that cbindgen recently had many added lines in the tests directory (going from 0.28.0 to 0.29.0, https://diff.weiznich.de/cbindgen/0.28.0/0.29.0/tests).
We are aware that it is theoretically possible to run these tests/examples/benchmarks from the .cargo directory, but in our personal experience that option is used rarely if ever. On the other hand, removing e.g. tests from the published crate can make it significantly easier to review for supply chain safety and it also shrinks the size of the crate. For the latest example, we would just have to review ~100 lines of added code, but with the tests, this grows to over 1500 lines.
For cbindgen, by removing tests from the published crate, I also get a reduction in size from 221.6KiB compressed to about 122.7KiB compressed. Considering the recent download numbers, that would reduce traffic on crates.io by a bit over 250 Gb a month.
So I wanted to ask if it would be possible to remove the tests from the published crate or if that would be blocked by a certain use case that I'm not aware of. If removing these parts is a welcome change, I can also provide the necessary PR to go through with it.
Best regards!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compare the published crate contents with the tests directory and review the .cargo directory for the package configuration that controls what is included. Confirm the resulting crate is smaller while retaining the source needed by downstream users, and verify that the existing tests and examples remain available in the repository.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- release
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100