john-kurkowski / tldextract

Accurately separates a URL’s subdomain, domain, and public suffix, using the Public Suffix List (PSL).
BSD 3-Clause "New" or "Revised" License
1.81k stars 211 forks source link

version handling incompatible with `setuptools_scm` version 7 #269

Closed pabs3 closed 1 year ago

pabs3 commented 1 year ago

The version handling in tldextract is no longer compatible with the default template for _version.py in setuptools_scm version 7, since it changed the default template from using version to __version__ in this commit:

https://github.com/pypa/setuptools_scm/commit/b45e19f9f275a31873fd5e07faabef16fd0bbec0#diff-bdefa0298003efada7c465428643cc6d9c129168afb3eb5c551b40fcc77feac1

There are two ways you could handle this:

Personally I suggest the second one, since it is more future-proof.

pabs3 commented 1 year ago

Another option would be to not hard-code the version within _version.py but instead load it from the PEP-0566 metadata by using importlib:

https://github.com/pypa/setuptools_scm#retrieving-package-version-at-runtime

This is probably the best option.

john-kurkowski commented 1 year ago

How do you reproduce the incompatibility? Is it an uncaught error? For users? Contributors?

pabs3 commented 1 year ago

Sorry for the noise, looks like I misread the code and it is actually compatible, because setuptools_scm adds a backwards-compatibility variable. If it were actually incompatible, there would have been an uncaught error for users.

$ cat tldextract/_version.py 
# coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version control
__version__ = version = '3.3.1'
__version_tuple__ = version_tuple = (3, 3, 1)