Skip to content
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 for Windows image piping #2969

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

Lestropie
Copy link
Member

Closes #2960. Extensive description in 6709049.

Posting as draft until I've run the full battery of Python tests.

Copy link

clang-tidy review says "All clean, LGTM! 👍"

- More extensive use of pathlib.Path throughout API modules.
- When running in a Windows environment, explicitly invoke cygwin.exe to translate piped image filesystem paths between Posix and Windows formats. While this is not necessary if piping an image from one Python command to another, it is necessary for compatibility in piping between Python and C++ commands.
- Move helper function responsible for creating modified pathlib.Path class that quote-escapes when used in an f-string out of app.Parser and into app, since it may be useful outside of the context of command-line parsing.
- Add intermediate classes for CLI input filesystem paths for centralising the checking of user-specified input paths, similarly to what had already been done for output user-specified paths.
- dwinormalise group: Dynamically delete more images from the scratch directory as they are used.
- fsl.eddy_binary(): Make full use of pathlib.Path functionalities.
- mrtrix3.path.wait_for(): In addition to pathlib.Path adoption, includes duplication of fixes in 9ad39a8 and e866aa4 for simplicity of testing.
- mrtrix3.utils.load_keyval(): Yield a dictionary of strings / lists of strings for multi-line keys. Do not split lines; that interpretation is deferred to downstream code (only current usage is population_template calling transformcalc decomp).
- utils.name_temporary(): Fix creation of filesystem paths for temporary directories.
- Remove function app.make_quote_escaped_path_object() and replace with class FSQEPath (F-string quote-escaped path). This exploits runtime inheritance to discover the type of pathlib.Path and inherit from it, rather than using clumsy multiple inheritance.
- Fix cygpath invocation for input image pipes.
- Improve run.command() printed terminal strings with use of this new class.
Copy link

github-actions bot commented Sep 5, 2024

clang-tidy review says "All clean, LGTM! 👍"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant