john-kurkowski/tldextract

Version 3.6.0 introduced a breaking change without bumping to 4.0.0

Closed this issue · 3 comments

Our production code broke after upgrading to version 3.6.0 because of the following line:

subdomain, domain, suffix = tldextract.extract(link.lower())

We were expecting a breaking change would reflect in a major version bump as per the semver spec.

Thank you

Thanks for letting us know about this issue and your use case. Thank you for the xkcd. 😊

There was some discussion of the possibility of breaking in #300. We wanted to add a field to this project, which sounds like a minor version bump. However, maybe when a public interface is a tuple, there's no way to lengthen the tuple (nor shorten it) without it being a breaking change?

In the meantime, for anybody encountering this issue, to work around: directly reference the fields you're interested in.

tldextract/README.md

Lines 37 to 39 in f4ea714

>>> ext = tldextract.extract('http://forums.bbc.co.uk')
>>> (ext.subdomain, ext.domain, ext.suffix)
('forums', 'bbc', 'co.uk')

TTycho commented

Ouch, this break cases like:
'.'.join(part for part in ext[-2:] if part)
I upgraded to direct field referencing but I would consider this a breaking change.

  • 3.6.0 has been yanked and re-released as 4.0.0, for people who upgraded their code to rely on 3.6.0's 4-tuple (subdomain, domain, suffix, is_private) return type. Lesson learned that increasing the length of a tuple should be a breaking change.
  • 5.0.0 has also been released, which migrates away from the tuple entirely, to avoid breaking changes when adding fields in the future. In 5.0.0, you must directly reference the fields you're interested in. No more iterating/indexing/slicing/unpacking the result object returned by this library. For example, ext[-2:] will no longer work at all. Use (ext.domain, ext.suffix) instead.