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

Remove runtime dependency on base64 #1541

Merged
merged 1 commit into from Dec 27, 2023
Merged

Remove runtime dependency on base64 #1541

merged 1 commit into from Dec 27, 2023

Conversation

Earlopain
Copy link
Contributor

@Earlopain Earlopain commented Dec 22, 2023

Description

#1525 removed a warning in ruby 3.3 because of the base64 dependency. Only a single method in one place is used so there's no need to pull it in. Since it's just a wrapper around the pack method it's trivial to replace.

Same approach by other gems:

lib/faraday/utils.rb Outdated Show resolved Hide resolved
Copy link
Member

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

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

I like this approach. Thank you @Earlopain for bringing it up, in a PR.

(Seen other gems wrap local methods to break the gem dependency.)

Raises the question: Are there other gems in the Awesome Faraday list that sort of second-level depends on base64 being there for them?

@Earlopain
Copy link
Contributor Author

Good point with the other parts of the ecosystem. I have checked every entry on the list and its looking pretty good. No direct usage, I haven't checked transitive dependencies however. The exception being faraday-jwt which I know needs some base64 functionality, see my note on that entry below


Anything relating to faraday inside the lostisland org no

Adapters

  • async-http-faraday no
  • faraday-typhoeus no
  • faraday-http no
  • httpx has implemented its own workaround for the base64 dependency (which I don't think is used in the adapter itself anyways) base64.rb

Middleware

  • faraday-encoding no
  • faraday-follow-redirects no
  • faraday-parse_dates no
  • faraday-cookie_jar no
  • faraday-detailed_logger no
  • faraday-encoding no
  • faraday-http-cache no
  • faraday-gzip no
  • faraday-jwt not directly but through a dependency json-jwt. Not currently an issue since a transitive dependency apart from faraday takes care of it. I have openened Declare dependency on base64 nov/json-jwt#114
  • faraday-mashify no
  • faraday-oauth1 no
  • faraday-follow-redirects no
  • faraday-encode_xml no
  • faraday-decode_xml no
  • faraday-xml no

Speaking of the awesome faraday list, the json_request, json_response, and url_encoded links are currently 404. They are bundled in faraday itself so should be part of the check above.

Copy link
Member

@iMacTia iMacTia left a comment

Choose a reason for hiding this comment

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

Thank you for the fix and the thorough analysis @Earlopain.
This should be enough to confidently remove the dependency, and I'd add that if a downstream gem (middleware or adapter) requires base64 then it should also list it as a dependency rather than relying on Faraday 👍

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.

None yet

3 participants