-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial Python API changes for cmake adoption #2737
Conversation
- Move algorithm code from python/lib/mrtrix3/ to python/src/mrtrix3/. - Modify python/bin/mrtrix3.py to reflect reduction of number of ways in which the Python API could potentially be found following calling mrtrix3.execute() in an executable command. This additionally includes the transition from the imp module to use importlib due to deprecation; this is a subset of #2735. - For now, the capturing of the list of MRtrix3 executables in mrtrix3.EXE_LIST is disabled, as it is possible for MRtrix3 to be installed into a location that additionally includes other non-MRtrix3 executables. An alternative solution for this will need to be subsequently implemented.
The logic for handling Python files is mostly encompassed in
Something like this should work:
|
One thing I would like to comment on is that, in my opinion, setting the |
The issue we've had with Updating to a cmake universe: Perhaps if someone has gone through the cmake installation step, then it would be reasonable to have that added to Though I think you're later suggesting something else. If I'm following that correctly, it's not utilisation of |
Just to add a couple of comments on top of @Lestropie's:
We've discussed this quite a few times in the past, and always came to the conclusion that we shouldn't rely on it. We're far from alone in that particular conclusion by the way - see these blogs on the issues others have with
Personally, I think it should be avoided like the plague, for very similar reasons to why |
Superseded by #2920. |
@daljit46 Will need your assistance on this one.
Closes #2730.
Follows #2689, which has now been merged to
dev
.Main changes implemented in first commit are:
Move Python algorithms code from
lib/
intosrc/
. This makes more sense to me than any other alternative I've come up with (including doing nothing).Remove some of the logic in
bin/mrtrix3.py
for locating the API modules.For external projects, we previously had the option of having in the root directory of that project a softlink to the
build
script of the main MRtrix3 repository. Where this was used,bin/mrtrix3.py
would read the contents of that softlink and use it to locate thelib/
directory of the main repository. This is however no longer applicable asbuild
does not even exist.My suspicion is that when we get to the point of dealing with external projects post-
cmake
, the solution here is going to be construction of a softlink tobin/mrtrix3.py
. I think the contents of this PR should work in that scenario, but it will need to be evaluated properly when a solution for external projects that also deals with C++ is constructed.PYTHONPATH
will also remain a viable backup.Resolve the
imp
module deprecation; similar to add support for python importlib to locate MRtrix3 python libraries #2735, except that ondev
Python 2 support has been removed (Drop python2 support #2215) so that code branch is no longer required.Things to do:
Modify
cmake
to deal with the new location of the Python algorithms.I had a go at this about a week ago and struggled and ended up discarding my attempt. From memory there are baked-in named variables for bin and lib directories, but no corresponding variable for a src directory, so this needs to be constructed appropriately.
Find a solution to the issue of the
run
module in particular wanting to know the comprehensive set of MRtrix3 executables.This can no longer be done reliably at runtime as the directory in which the Python executable resides following installation may contain non-MRtrix3 executables. See Python modifications for cmake #2730 point 3.
Test viability of creating a softlink to
bin/mrtrix3.py
.Check again why the 5ttgen algorithms need to be placed in "_5ttgen/"; this traces back to f0bb21d, and I'm sure it was necessary at the time, but I don't recall exactly what was playing up that forced me to add that little hack.