ruby / net-pop

This library provides functionality for retrieving email via POP3, the Post Office Protocol version 3. For details of POP3
BSD 2-Clause "Simplified" License
20 stars 13 forks source link

Digest gem dependency not available for Ruby < 3.0 #23

Open kkohrt opened 6 months ago

kkohrt commented 6 months ago

When updating to net-pop 0.1.2, this PR came into play: https://github.com/ruby/net-pop/pull/10/files

Now, not requiring digest is perfectly valid as of Ruby 3.0, when digest became a default ruby library gem

Unfortunately, because the 0.1.2 gemspec is missing the specification:

spec.required_ruby_version = '>= 3.0.0'

It is possible that in upgrading the gem to 0.1.2 on a codebase that is not yet running on ruby 3.0.0, you loose an essential dependency requirement: the digest gem. While you would think any CI testing would make this glaringly obvious, there are other pre-ruby-3.0 gems that still do require digest, but are only used in a test environment, thereby masking the exceptions that ultimately only show up at the time of deployment.

Request: When this default ruby gems relies on other default ruby gems implicitly rather than implicitly, can it specify the minimum ruby version in which that implicit availability is valid? e.g. Can version 0.1.2 be updated or replaced by a version that has required_ruby_version = '>= 3.0.0'?

Thank you for considering this corner case

kkohrt commented 6 months ago

Having documented possible remediation steps for this issue, I am now thinking that the request to add required_ruby_version = '>= 3.0.0' might seem a little bit extreme, technically. Although it would help out automated tools like Bundler, this gem is, in fact, compatible with Ruby 2.7—it just requires the digest gem. So the wider set of helpful options is actually more like:

  1. Go back to making it a runtime dependency, even though you know it will be present in Ruby 3.0 system (at least you will minimize the breakage in Ruby 2.7 systems)
  2. Update the release documentation to explain that digest must be required in order to use this gem on pre-Ruby-3.0 systems (and hope people read it)
  3. Make Ruby 3.0 a required version, as originally proposed