Fix: don't require --download-path to be readable at parse time#45
Open
zboyles wants to merge 1 commit into
Open
Fix: don't require --download-path to be readable at parse time#45zboyles wants to merge 1 commit into
zboyles wants to merge 1 commit into
Conversation
The `mrt models init`, `mrt models download`, and `mrt checkpoints download` commands typed `--download-path` as `click.Path()`, which defaults to `readable=True`. Click probes `os.access(path, R_OK)` on the default path (`~/Documents/Magenta/magenta-rt-v2`) at argument-parse time. When that directory exists but is not readable by the process, parsing fails with "Path '...' is not readable." before any command logic runs. This is hit out of the box on macOS, where `~/Documents` is TCC-protected: a terminal that has not yet been granted Documents access fails the probe. A download destination does not need to be readable to be valid (it is created/written on download), so the readability check is inappropriate. Extract the three duplicated `--download-path` options into a shared `_download_path_option` decorator (matching the existing `_source_option` pattern) and set `readable=False` on it. Repro (any OS): point --download-path at an existing dir with mode 000 and run the command; before this change click rejects it as "not readable".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: don't require --download-path to be readable at parse time
The
mrt models init,mrt models download, andmrt checkpoints downloadcommands typed--download-pathasclick.Path(), which defaults toreadable=True. Click probesos.access(path, R_OK)on the default path (~/Documents/Magenta/magenta-rt-v2) at argument-parse time. When that directory exists but is not readable by the process, parsing fails with "Path '...' is not readable." before any command logic runs.This is hit out of the box on macOS, where
~/Documentsis TCC-protected: a terminal that has not yet been granted Documents access fails the probe. A download destination does not need to be readable to be valid (it is created/written on download), so the readability check is inappropriate.Extract the three duplicated
--download-pathoptions into a shared_download_path_optiondecorator (matching the existing_source_optionpattern) and setreadable=Falseon it.Repro (any OS): point --download-path at an existing dir with mode 000 and run the command; before this change click rejects it as "not readable".
Related Issues
Local Pytests
Note
This change is confined to CLI argument parsing. It does not touch model loading, generation, or numerics, so the model-generation and bit-level parity tests are not applicable here. Verification below targets what the change actually affects.
I ran
and observed the following output:
Benchmark Regression Test
N/A — this change does not affect model loading, generation, or performance-sensitive code paths, so there is no benchmark surface to regress.