-
Notifications
You must be signed in to change notification settings - Fork 181
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
External projects for 3.1 #2901
Comments
I think it'd be really helpful to spell the exact requirements of "external projects", since there are countless ways to implement an extension system. Previously, I made a small test example that shows how can one use Git submodules to write their own commands in a separate repo. This works for C++ commands only. A similar approach could work for Python executables too I guess, at least looking at something like tracfinder. |
https://github.com/dchristiaens/shard-recon has both C++ and Python commands. I wonder if the first port of call is whether external projects should be entirely self-contained, or should make use of an already built version of MRtrix3. On
I've a feeling that we'd discussed and were drawn to 1., but don't recall if it was definitive. Our code might be unusual in that an external C++ command might make use of both a precompiled core DLL and templated source code from the core. Altering for explicit instantiation of plausible templates and possibly a different resolution of shared library generation might modify this, but those might be much larger proposed changes. Plus there's situations where an external project may have some unforeseen template utilisation, which explicit instantiation into a shared DLL wouldn't cover. (Can edit in light of suggested modifications or complete alternatives) Does anyone know of any other neuroimaging analysis packages that support any form of "extensions" where we might see precedent / success or horror stories? |
Hmm, I can't fully grasp whether this would be an issue. Do we expect users to install external commands in the same location as a standard MRtrix3 installation (considering also that our new packaging strategy would be to provide an extractable tarball as the standard way of distributing the project)? Our commands are installed with a relative rpath set to |
If shared libraries are found via relative paths, then that would I think alleviate path conflicts; unless someone installs both core and extensions directly to eg. I'm being somewhat speculative here, I'm not across every possible use case. Mostly cognizant that if we propose something that prevents what people are already doing with I'm trying to crunch out #2678 so that I can then do (possibly redo) #2741 dealing with conflicts. The outcome there will colour how to deal with Python commands for external projects here. |
For external projects with Python scripts, |
MRtrix3 C++ binaries that are built version-matched for the external project need to be available for Python scripts to execute via |
Why not? My thinking is along the following. When MRtrix3 is built as a part of an external project, the installation directory would contain two folders: Is there a reason why the above wouldn't work? |
The issue isn't whether it would work - it would, as far as the external project is concerned. It's about ensuring that the user's environment doesn't suddenly start using a different version of MRtrix simply because they've added some external project to their PATH. External projects are bound to be relying on outdated versions of MRtrix. If these are listed first in the PATH, they'll take precedence over the user's main install, and cause no end of confusion. The external projects should only expose the commands that are specific to them, nothing else. |
Ok, but I think there is a problem (at least in the way I envisage a user of an extension using MRtrix3) with this approach then. If the user expects their commands to work a specific version of MRtrix3 then surely they also expect the C++ executables in their Python scripts to be built against that specific version. The strategy I just outlined above ensures that this is the case, but, unless I'm misunderstanding something, not if |
We've long had mechanisms in place to ensure that the python scripts always use the specific executables that match their install - even if that isn't in the PATH. If you look at the machinery in the python What we'd need to do here is simply extend that machinery to look in the extension's main |
Ok yes that makes sense. For some reason, I was under the impression that executables in |
A question that came to my mind is: how would this all work on Windows? RPATH isn't available, but you could theoretically use |
Here is how I thought an extension developer could write their
One question to ponder on is whether the developer should have full freedom to define their directory structure (perhaps limiting ourselves to giving guidelines on how an extension should be structured) or being more stringent and enforcing a fixed way of doing things. |
In #2920, we implemented the possibility of creating either as standalone files or within various files within a directory. Now, during the build and installation stage, Python commands are executed from |
The way I think I had envisioned it was that, for an external project called "project", with a single-file Python command called "cmdpython", there would be:
The CMake function that generates In retrospect, while this works just fine for a build directory, there is a potential issue if the installation directory coincides with a location where there already exists a core MRtrix3 installation. One way to get around this would be to rename If that either doesn't work or is not preferred, it might be worth a quick call to flesh out ideas, as it can get clunky trying to explain filesystem structure via written text. PS. As an aside: With #2920 & #2824, should C++'s " |
In looking into #2960, I realised that on
|
Is there any benefit of separating the code within
On this, I think if we want to maintain FHS guidelines (personally I'm not a fan of FHS, I think it has more cons than pros and really just used for historical reasons at this point), we should just consider isolating all the library installation code for a project into |
I would have thought that from a code perspective it would be preferable for module access to be done through " Though in retrospect I suppose that the former wouldn't work if specifically within What about if the MRtrix3 Python API were to go into So it would look like:
|
Given that the software is openly broadcast as being capable of supporting compilation of external projects making use of the API, ideally prior to tagging 3.1 we should have a template demonstrating how such external projects could work following
3.1
release.The text was updated successfully, but these errors were encountered: