'How to install a Python package which is just one SO file

I have an SO file mymodule.cpython-37m-x86_64-linux-gnu.so that I would like to make pip-installable.

My desired end goal is to have my installed package look like this:

% tree /home/.../python3.7/site-packages
/home/.../python3.7/site-packages
├── mymodule-1.0.0.dist-info
└── mymodule.cpython-37m-x86_64-linux-gnu.so

This is what I have tried so far:

% tree .
.
├── mymodule.cpython-37m-x86_64-linux-gnu.so
├── pyproject.toml
└── setup.cfg
# setup.cfg

[options]
py_modules = mymodule

[options.package_data]
* = mymodule.cpython-37m-x86_64-linux-gnu.so

However, when trying to pip install . I cannot seem to get the .so file to be installed into site-packages.

Interestingly, when there is a file named mymodule.py instead, mymodule.py gets installed in the desired location.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source