-
Notifications
You must be signed in to change notification settings - Fork 23
CLI #64
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
CLI #64
Conversation
|
For some reason the test I removed in 262a9aa doesn't work on CI, though it works fine for me locally... Specifically I expect the |
| class JuliaPkgGroup(click.Group): | ||
| """Custom group to avoid long stacktraces when Julia exits with an error.""" | ||
|
|
||
| @property | ||
| def always_show_python_error(self) -> bool: | ||
| return os.environ.get("JULIAPKG_ALWAYS_SHOW_PYTHON_ERROR_CLI", "0") == "1" | ||
|
|
||
| @staticmethod | ||
| def _is_graceful_exit(e: subprocess.CalledProcessError) -> bool: | ||
| """Try to guess if a CalledProcessError was Julia gracefully exiting.""" | ||
| return e.returncode == 1 | ||
|
|
||
| def invoke(self, ctx): | ||
| try: | ||
| return super().invoke(ctx) | ||
| except subprocess.CalledProcessError as e: | ||
| # Julia already printed an error message | ||
| if ( | ||
| JuliaPkgGroup._is_graceful_exit(e) | ||
| and not self.always_show_python_error | ||
| ): | ||
| click.get_current_context().exit(1) | ||
| else: | ||
| raise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thinking here is that the user does not care to see the subprocess.CalledProcessError stacktrace most of the time. So, for the CLI only, why not hide it?
It may be nice to put something like Hint: Detected a Julia error; the Python stacktrace is hidden. Set JULIAPKG_ALWAYS_SHOW_PYTHON_ERROR_CLI=1 to see the full stacktrace.
|
Would this be confused with JuliaLang/juliaup#1230 ? |
|
Thanks for the reference @xgdgsc, I wasn't aware of that work. Seems super cool! It might be useful to simplify some of the For the CLI , I think the |
|
I made a few small tweaks before merging:
Really nice PR, thank you. |
This PR adds a CLI to JuliaPkg, letting users manage their dependencies from the command line. It also adds the
runpass-through mode which can launch a REPL or run scripts using the same julia executable/project as what pyjuliapkg sees.Closes #63