Search code examples
pythonpipvenv

python venv install skips component file "pointer.png"


This is a strange issue. I maintain the pi3d python module and it contains this file github.com/tipam/pi3d/blob/master/src/pi3d/util/icons/pointer.png

When I clone the repo locally it has the .png file but when the package is installed using pip it seems to be missing. This didn't used to be a problem. Is it something to do with the fact that pip insists on installing to a venv now, i.e. if I made pip install with --no-warn-script-location would it include the missing file?


Solution

  • It's because it's not present in tool.setuptools.package-data in pyproject.toml file.

    [tool.setuptools.package-data]
    "*" = ["*.fs", "*.vs", "*.inc", "*.gif"]
    

    With the previous configuration, you add all this extensions in your package as you can see in the next screenshot (content of the package uploaded on pypi).

    File tree of pi3d package with gif files

    So adding the png extension should work:

    [tool.setuptools.package-data]
    "*" = ["*.fs", "*.vs", "*.inc", "*.gif", "*.png"]