Repository navigation
Ship only the specs external adapters need - #1726
Merged
iMacTia merged 2 commits intoOct 25, 2026
Merged
Conversation
Adapter gems load spec/external_adapters/faraday_specs_setup.rb, which requires files from spec/support. Faraday's own specs aren't needed by anyone installing the gem, and add about 270 KB to every installation (e.g. production Docker images).
iMacTia
requested changes
Oct 21, 2026
iMacTia
left a comment
Member
There was a problem hiding this comment.
I mean, it looks a bit extreme only to shave off 270KB, but I guess it won't hurt.
Only one ask though, add a comment on top of the require_relative list in spec/external_adapters/faraday_specs_setup.rb to signal that only the support folder is bundled with the gem, and therefore if new items are added to the list outside of that, it will require updating the gemspec
Contributor
Author
|
Thanks, I added the comment. Yeah, it's not that much by itself, but can shave off a bit if multiple gems do it. |
iMacTia
approved these changes
Oct 25, 2026
iMacTia
left a comment
Member
There was a problem hiding this comment.
Thank you for adding the comment π!
I'm gonna merge this in and pack it with the next release π
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The gem includes all of
spec/(about 300 KB unpacked). External adapters only needspec/external_adapters/faraday_specs_setup.rband the files it requires fromspec/support, so this ships those two directories and leaves out Faraday's own specs, saving about 270 KB on every installation (e.g. production Docker images).Those two directories stay because adapters that depend on the released gem load them from it: faraday-httpclient pins faraday >= 1.0, and OS packagers (OpenBSD ports, NetBSD pkgsrc) run adapter tests against the packaged Faraday. Adapters that use Faraday from git, like faraday-net_http, are unaffected either way.
Checked by building the gem, unpacking it and running
require "faraday_specs_setup"from it.