-
Notifications
You must be signed in to change notification settings - Fork 191
Python CLI changes #2678
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
Python CLI changes #2678
Conversation
Created custom callable classes for handling different datatypes for positional and optional arguments on the command line. Used ArgumentTypeError for exception management instead of ValueError since the former allows allows adding custom error messages.
Added newly defined callables (in app.py) for each positional and optional command line argument of mrtrix_cleanup and dwicat
Updated the logic for TypeBoolean class for consistency with C++ command-line behaviour Added new checks in TypeInputTractogram class for file validation
Added callables for each positional and optional command line argument in dwifslpreproc, dwigradcheck, dwishellmath, labelsgmfix, mask2glass, population_template and responsemean
Co-authored-by: Ankita Sanil <ankitasanil@gmail.com>
Used the new syntax as "type=app.Parser.TypeInputImage()" across all Python API commands
…ent) Replaced the traditional for loop with list comprehension in TypeIntegerSequence and TypeFloatSequence classes
Applies to both population-template and mrregister. Makes "none" a valid selection of robust estimator in both cases.
Updated class names across all commands to be in sync with C++ code
Implemented class inheritance to avoid duplicate checks for tractogram input files. Instead, reused the checks from ArgFileIn type via inheritance.
Changes for handling piped images in the Python API scripts. However, this implementation does not include deletion of the temp/piped images at the end of the command execution.
The current implementation is temporary since it doesn't cover all the use-cases. However, it supports a working scenario.
Primarily renaming of classes to more closely echo the modifier functions that are used in the C++ usage() function rather than the enumeration that is hidden from most developers.
Addressing multiple comments in PR #2678.
In particular, it is desired for function make_temporary() to be accessible from within the app module.
- Restore solution in #2845 not properly propagated through prior merge conflict. - Use FileExistsError when checking for pre-existing output files / directories, and catch it to yield a well-formatted error message. - Update CLI test data to reflect changes in 05b68d5. - Modify tests that check for command error due to inappropriate CLI usage.
|
Annoying CI failures that I don't think have anything to do with this PR. Linux Clang(occurs for multiple targets) MSYS2 |
After troubleshooting this for a while (it was quite puzzling), I thought that this was probably caused by some mismatch between For the Windows failure, I'll need to have a further look. |
|
Awesome, thanks for the effort. |
|
😬 💣 🙉 💥 |
The existing implementation of -continue assumed that, for a list of elements to be provided to subprocess.run(), each element was a string, and therefore string operations could be applied. However with the adoption of pathlib for handling user-specified paths in #2678, an element in this list may be a class derived from those provided in the pathlib module that does not provide string functions.
The existing implementation of -continue assumed that, for a list of elements to be provided to subprocess.run(), each element was a string, and therefore string operations could be applied. However with the adoption of pathlib for handling user-specified paths in #2678, an element in this list may be a class derived from those provided in the pathlib module that does not provide string functions.
- Re-generate command documentation. - Resolve additions to CLI with augmentations to Python CLI in #2678. - Resolve some poorly formed code logic identified by pylint. - Improve progressbar appearance when not printing to a terminal, consistent with #3137. - Fix export of optimal gradient table. - Increase tolerance on default test: because a greater spectrum of gradient table alterations are now possible, it is more probable that a table that is not precisely equivalent to the unmodified table will be selected due to chance, but this should not lead to test failure given the stochasticity of the command and the relatively small number of streamlines.
Supersedes ankitasanil#1.
Somewhat requisite for #2665.
Closes #1392.
Many outstanding requirements as per checkbox list in #1392.