dmritrekker / trekker

dMRI based fiber tracking using parallel transport tractography
https://dmritrekker.github.io
BSD 3-Clause "New" or "Revised" License
17 stars 12 forks source link

compile just using cython and add github-ci #15

Closed tfmoraes closed 1 year ago

tfmoraes commented 1 year ago

Hi,

I work with @vhosouza @rmatsuda on InVesalius. To ease the process of creating wheels for various versions of Python and platforms I created this PR. This PR create a new action to create wheels using the Github CI. It uses Cibuildwheel and creates wheels to Windows, Linux and MacOS (x86_64 and ARM64) from Python 3.8 to 3.11. For now it only creates the wheels. You can make it publish the wheels to Pypi automatically using Github CI this way. To upload the wheels to Pypi by yourself you need to download the artifacts (in the GitHub tab Action, click in the last workflow run completed and look for the artifact in the bottom of the page) and use twine.

With PR you don't need Cmake to create the Python wheels. Just enter on src/python and run python setup.py bdist_wheel. It compiles all codes using the Python and Cython machinery.

I did some modifications to compile on clang on MacOs:

baranaydogan commented 1 year ago

Hi! Thanks a lot for the contribution! This is a great idea! Let's try it! Unfortunately, I don't have the time to compile and share the binaries right now. But we can merge the code.

tfmoraes commented 1 year ago

Hi @baranaydogan. Thanks for merging it! You don't need to compile code and the wheels, github is compiling it for you. It's compiling after every commit. You can change to compile it only when you create a new tag, for instance. What control this is this file .github/workflows/wheels.yml inside the repository. You can download the wheel going to the tab Control, click on the first workflow run on the list of workflows, for instance https://github.com/dmritrekker/trekker/actions/runs/5001751980, at the bottom of the page you have the artifacts created (the wheels), just click it to download it.

baranaydogan commented 1 year ago

Thanks for the pull request again. Most people actually only use command line binaries and not the Python wheels. So there is need to update the binaries provided in the release. For that there is need to compile binaries for Linux, Windows and Mac. For that one thing that needs to be done is to modify the CMakeLists.txt for Mac actually. But I haven't had the time to look into that.

baranaydogan commented 1 year ago

Hi @tfmoraes. It is now there in https://pypi.org/project/Trekker/. pip install worked at least in the few Linux computer that I tested. Hopefully it works in Win and Mac too. We can fix if there are issues. I have to say that it is muuch better this way :smile: Thanks a lot again for contributing!

tfmoraes commented 1 year ago

Hi @baranaydogan it worked for me on MacOS with Apple Silicon. Thanks!

vhosouza commented 1 year ago

This is excellent! Thanks guys. @baranaydogan it worked for me as well in Windows 11

baranaydogan commented 1 year ago

Lovely! Thanks again to both of you for helping out!

azhylka commented 1 year ago

Hi all, for me it complained a lot about char being assigned string literals. As well as printing char using fprintf (which was inconsistent actually, neighbour lines would have different setup). I have now removed the errors on Mac with M1, I have updates in my fork. The trekker binary is still not yet in the install folder though. @tfmoraes, I am curious how it is for you on Mac whether you had to change something else and which compiler you are using.

UPD I just noticed that I missed one more if for APPLE that I had to fix, still not built yet, but looking into it