I wish to deploy a package to PyPi using setuptools. However, the core part of the package is actually written in Fortran, and I am using f2py to wrap it in python. Basically the project's structure looks like this:
my_project
- license.txt
- README.md
- setup.py
- my_project
- init.py
- myfunc.py
- hello.so
The module myfunc.py imports hello.so (import my_project.hello
) which can then be used by functions inside myfunc.py. This works perfectly on my machine.
Then I tried standard setuptools installation: sudo python3 setup.py install
on my Ubuntu, and it gets installed perfectly. But unfortunately, while importing, it throws ModuleNotFoundError: No module named 'hello'
.
Now, from what I understand, on Linux based systems, for python, the shared libraries *.so are stored in /usr/lib/python3/dist-packages/
. So I manually copied this hello.so
there, and I got a working package! But of course this works only locally. What I would like to do is to tell setuptools to include hello.so
inside the python-egg and automatically do the copying etc so that when a user uses pip3 install my_package
, they will have access to this shared library automatically. I can see that numpy has somehow achieved that but even after looking at their code, I haven't been able to decode how they did it. Can someone help me with this? Thanks in advance.