cvg / GlueStick

Joint Deep Matcher for Points and Lines 🖼️💥🖼️ (ICCV 2023)
https://iago-suarez.com/gluestick
MIT License
532 stars 40 forks source link

setup.py: fix the .whl missing gluestick.models #20

Closed SomeoneSerge closed 8 months ago

SomeoneSerge commented 8 months ago

Setuptools does not by default include nested "packages", and the setup.py currently only specifies the top-level gluestick. This means that

❯ pip wheel git+https://github.com/cvg/GlueStick
...
  Resolved https://github.com/cvg/GlueStick to commit 0a6a1ae4569164d8fd1e4d24755d4dec6d9d7d60
...
❯ unzip -l gluestick-0.0-py3-none-any.whl 
Archive:  gluestick-0.0-py3-none-any.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
     1738  11-02-2023 19:25   gluestick/__init__.py
     6324  11-02-2023 19:25   gluestick/drawing.py
     6936  11-02-2023 19:25   gluestick/geometry.py
     3971  11-02-2023 19:25   gluestick/run.py
     1089  11-02-2023 19:25   gluestick-0.0.dist-info/LICENSE
       74  11-02-2023 19:25   gluestick-0.0.dist-info/METADATA
       92  11-02-2023 19:25   gluestick-0.0.dist-info/WHEEL
       10  11-02-2023 19:25   gluestick-0.0.dist-info/top_level.txt
      690  11-02-2023 19:25   gluestick-0.0.dist-info/RECORD
---------                     -------
    20924                     9 files

...won't include the nested gluestick.models

You could either use find_packages without arguments ([tool.setuptools.packages.find]), or specify both gluestick and gluestick.* in include.

Note that resources/ aren't included in the wheel either, although the https://github.com/cvg/GlueStick/blob/0a6a1ae4569164d8fd1e4d24755d4dec6d9d7d60/gluestick/models/superpoint.py#L108 hardcodes their relative location. You could include them as "package data", but I decided not to touch that. Also I don't think having weights in site-packages is a good thing. Also even if you have the permission to redistribute superpoints weights, I'm not sure I do, even if I download them from you.

The extra commits do a migration from setup.py to pyproject.toml (static metadata instead of executable code), add an entrypoint so that pip/pypa-build would generate an executable script, and adjust the cli so as to let me do https://github.com/SomeoneSerge/pkgs/blob/3f07a5c33ca96b9cd828db9ad32bed9893076402/python-packages/by-name/gl/gluestick/package.nix#L110-L115

If you prefer to omit the extra commits, you can merge https://github.com/cvg/GlueStick/pull/19 instead