Skip to content

Python: Location of algorithm files #1087

@Lestropie

Description

@Lestropie

With the FHS re-arrangement of the repository, we now have the following situation:

bin/5ttgen
lib/mrtrix3/app.py (and others)
lib/mrtrix3/_5ttgen/fsl.py
lib/mrtrix3/_5ttgen/freesurfer.py

That placement was maybe not super-critically thought out with the FHS changes. I'm now not sold on it: The files in lib/mrtrix3/_5ttgen/ aren't really a part of the "library", since they're by design intended to be used by a single script only. Additionally, if someone were to write a standalone script against the MRtrix3 Python libraries (which they can, and I myself do), they would not be able to make use of the algorithm module, since the corresponding module files need to go into MRtrix3's lib/mrtrix3/ directory, regardless of where the executable script resides.

They clearly can't reside directly in bin/, since they're not executable in and of themselves, and that could lead to naming conflicts. Likewise they don't really belong in core/, since a packaged installation needs to contain these files yet that whole directory doesn't exist in the case of packaged installs.

I'm wondering if they should instead reside in sub-directories of bin/? One sub-directory per module-based script as is currently done, with the name of the sub-directory being the executable script's name, somehow modified to prevent naming conflicts. So we'd have e.g. bin/_5ttgen/ and bin/_dwi2response/. The algorithm module would then find them based on the real path (i.e. follow symlinks) of the executed script, rather than the location of the library files.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions