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

Migrate ExtractResult from namedtuple to dataclass #306

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

john-kurkowski
Copy link
Owner

@john-kurkowski john-kurkowski commented Sep 21, 2023

Changes the type of this library's core type ExtractResult from namedtuple to dataclass.

The bugfix in #300 was not the breaking change I wanted. It resulted in #305. This PR is to:

  1. Keep the fqdn() to always include suffix if private suffix enabled and private suffix exists #300 bugfix.
  2. Add flexibility to the library. For example, to add more metadata fields going forward. So not every addition of a field is a breaking change.
  3. Really warrant a major version bump, once. I'm considering yanking version 3.6.0 and making this PR's change the 4.0.0 major version bump.

Open Issues

  • Does this greatly affect space?
  • Does this greatly affect speed?
  • Does this greatly affect serialization?
  • Does this cause some other, worse backwards incompatibility?

@john-kurkowski
Copy link
Owner Author

Re: space, at least in the test suite, not necessarily production usage, in main_test.py, memory usage does go up 8%, from 34MB to 37MB on average.

@john-kurkowski
Copy link
Owner Author

Re: speed, using timeit and a hardcoded domain string, I see execution time go down 2-5% on CPython 3.11.

@john-kurkowski
Copy link
Owner Author

I want this change for future compatibility. I'm not seeing many downsides, besides the breaking change of no longer allowing accessing indexing and slicing tuple members, as there is no longer a tuple. This will be marked a breaking change.

@john-kurkowski john-kurkowski merged commit e739ff8 into master Oct 11, 2023
2 checks passed
@john-kurkowski john-kurkowski deleted the migrate-namedtuple branch October 11, 2023 08:06
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Oct 23, 2023
https://build.opensuse.org/request/show/1119465
by user mia + anag+factory
- Update to 5.0.1:
Bugfixes:
  * Indicate MD5 not used in a security context (FIPS compliance)
    #gh/john-kurkowski/tldextract#309
Misc.:
  * Increase typecheck aggression
- Changes in 5.0.0:
Breaking Changes:
  * Migrate `ExtractResult` from `namedtuple` to `dataclass`
    #gh/john-kurkowski/tldextract#306
Bugfixes:
  * Drop support for EOL Python 3.7
- Changes in 4.0.0:
Breaking Bugfixes:
  * Always include suffix if private suffix enabled and private
    suffix exists
    #gh/john-kurkowski/tldextract#300
- Changes in 3.5.0:
Features:
  * Support IPv6 addresses
    #gh/john-kurkowski/tldextract#298
Bugfixes:
  * Accept only 4 decimal octet IPv4 addresses
    #gh/john-kurkowski/tldextract#292
  * Support IPv4 addresses with unicode dots
  * Reject IPv4 addresses with trailing whitespace
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.

1 participant