seatgeek/thefuzz

0.22.1 wheel lacks typing stubs

mjpieters opened this issue · 2 comments

The tarball for version 0.22.1 on PyPI includes the typing stub information now:

$ curl -LO https://files.pythonhosted.org/packages/81/4b/d3eb25831590d6d7d38c2f2e3561d3ba41d490dc89cd91d9e65e7c812508/thefuzz-0.22.1.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
$ tar tzvf thefuzz-0.22.1.tar.gz
drwxr-xr-x  0 johndebs staff       0 19 Jan 19:17 thefuzz-0.22.1/
-rw-r--r--  0 johndebs staff   20810 21 Sep 18:25 thefuzz-0.22.1/CHANGES.rst
-rw-r--r--  0 johndebs staff    1064 30 Oct 15:13 thefuzz-0.22.1/LICENSE.txt
-rw-r--r--  0 johndebs staff      52 21 Sep 18:25 thefuzz-0.22.1/MANIFEST.in
-rw-r--r--  0 johndebs staff    3859 19 Jan 19:17 thefuzz-0.22.1/PKG-INFO
-rw-r--r--  0 johndebs staff    3086 19 Jan 19:16 thefuzz-0.22.1/README.rst
-rw-r--r--  0 johndebs staff     186 30 Oct 15:13 thefuzz-0.22.1/requirements.txt
-rw-r--r--  0 johndebs staff      38 19 Jan 19:17 thefuzz-0.22.1/setup.cfg
-rw-r--r--  0 johndebs staff    1239 30 Oct 19:39 thefuzz-0.22.1/setup.py
-rw-r--r--  0 johndebs staff   18483 21 Sep 18:25 thefuzz-0.22.1/test_thefuzz.py
drwxr-xr-x  0 johndebs staff       0 19 Jan 19:17 thefuzz-0.22.1/thefuzz/
-rw-r--r--  0 johndebs staff      23 30 Oct 19:39 thefuzz-0.22.1/thefuzz/__init__.py
-rw-r--r--  0 johndebs staff    5058 21 Sep 18:25 thefuzz-0.22.1/thefuzz/fuzz.py
-rw-r--r--  0 johndebs staff     830 21 Sep 18:25 thefuzz-0.22.1/thefuzz/fuzz.pyi
-rw-r--r--  0 johndebs staff   11752 21 Sep 18:25 thefuzz-0.22.1/thefuzz/process.py
-rw-r--r--  0 johndebs staff     705 21 Sep 18:25 thefuzz-0.22.1/thefuzz/process.pyi
-rw-r--r--  0 johndebs staff       1 21 Sep 18:25 thefuzz-0.22.1/thefuzz/py.typed
-rw-r--r--  0 johndebs staff     509 21 Sep 18:25 thefuzz-0.22.1/thefuzz/utils.py
-rw-r--r--  0 johndebs staff      98 21 Sep 18:25 thefuzz-0.22.1/thefuzz/utils.pyi
drwxr-xr-x  0 johndebs staff       0 19 Jan 19:17 thefuzz-0.22.1/thefuzz.egg-info/
-rw-r--r--  0 johndebs staff    3859 19 Jan 19:17 thefuzz-0.22.1/thefuzz.egg-info/PKG-INFO
-rw-r--r--  0 johndebs staff     412 19 Jan 19:17 thefuzz-0.22.1/thefuzz.egg-info/SOURCES.txt
-rw-r--r--  0 johndebs staff       1 19 Jan 19:17 thefuzz-0.22.1/thefuzz.egg-info/dependency_links.txt
-rw-r--r--  0 johndebs staff      35 19 Jan 19:17 thefuzz-0.22.1/thefuzz.egg-info/requires.txt
-rw-r--r--  0 johndebs staff       8 19 Jan 19:17 thefuzz-0.22.1/thefuzz.egg-info/top_level.txt
-rw-r--r--  0 johndebs staff       1 16 Jan 14:17 thefuzz-0.22.1/thefuzz.egg-info/zip-safe

However, the wheel on PyPI does not include these:

$ curl -LO https://files.pythonhosted.org/packages/82/4f/1695e70ceb3604f19eda9908e289c687ea81c4fecef4d90a9d1d0f2f7ae9/thefuzz-0.22.1-py3-none-any.whl
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  8245  100  8245    0     0  90604      0 --:--:-- --:--:-- --:--:-- 97000
$ unzip -l thefuzz-0.22.1-py3-none-any.whl
Archive:  thefuzz-0.22.1-py3-none-any.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
       23  10-30-2023 19:39   thefuzz/__init__.py
     5058  09-21-2023 17:25   thefuzz/fuzz.py
    11752  09-21-2023 17:25   thefuzz/process.py
      509  09-21-2023 17:25   thefuzz/utils.py
     1064  01-19-2024 19:17   thefuzz-0.22.1.dist-info/LICENSE.txt
     3899  01-19-2024 19:17   thefuzz-0.22.1.dist-info/METADATA
       92  01-19-2024 19:17   thefuzz-0.22.1.dist-info/WHEEL
        8  01-19-2024 19:17   thefuzz-0.22.1.dist-info/top_level.txt
        1  01-16-2024 14:17   thefuzz-0.22.1.dist-info/zip-safe
      775  01-19-2024 19:17   thefuzz-0.22.1.dist-info/RECORD
---------                     -------
    23181                     10 files

Can this please be fixed?

For now, the work-around is to force PIP to install from the tarball; the following command assumes that the dependencies are already installed correctly, it only re-installs thefuzz from the tarball to build a cached wheel with typing stubs:

pip install --force-reinstall --no-binary thefuzz --no-deps 'thefuzz==0.22.1'

To verify the stubs are now installed you can use:

python -c 'from importlib.resources import files;print(*(f.name for f in files("thefuzz").iterdir() if f.suffix in (".pyi", ".typed")), sep="\n")'

This should print out:

fuzz.pyi
process.pyi
py.typed
utils.pyi

(moved here from #67 for visibility)

for some reason, the pip install --force-reinstall --no-binary thefuzz --no-deps 'thefuzz==0.22.1 doesn't work for me =\

I have locally verified the cause. Setuptools is pinned to "68.2.2", which doesn't include type information in the wheel by default. Pinning it to the latest version "70.0.0" fixes the issue. A fix as soon as possible would be appreciated, as this is causing annoyances in a CI pipeline I manage.