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
Add support for passthrough args to the python repl #3423
Comments
Thanks @stuhood |
I believe this works with both the v1 and v2 implementations. See https://pants.readme.io/docs/python-repl-goal. |
Oh, nevermind. Confused with |
I am running into an issue here that is making this less straightforward than it seemed, and we need to choose which approach to take out of it. The questions are:
Supporting all replsGetting ipython to work is simple and #19858 does so. This was the original user's question (many many years ago). Getting pass-through to work with the python shell will require some additional work. We make a python repl by executing a pex without an entry-point or script and rely on pex's emulation of the behavior you normally get when running On the other hand, anyone planning to do significant work in the repl would probably be using ipython for a python project. For scala it probably won't run into the same issues with passing command line flags, but we have to validate that they will work, and the way we run that repl:
I am not sure that tacking on pass-through args at the end will meet all the user's expectations from the goal-level vs tool-level implA goal-level impl would mirror what run does and is very straightforward if we are supporting passthrough for all repls (Looks like this). This is the way the run goal works. Goal level is trickier if we do not support all repls. To be honest to the user we would probably need to add some kind of field in each A tool-level impl would look more like what we do with For us it would mean that the IPython subsystem would have its own This is cleaner if not all repls will support pass-through. My current inclinationsWithout further input I would lean to just support it for ipython and wait to see if there is demand for getting it to work for scala. The implementation would be tool-level. Requesting your feedback. |
Thanks for doing the deep dive on this! Ideally we would support all repls, but if this is tricky, then I think having a goal-level solution, as in #19858 and then erroring for repls that don't support passthrough args is fine! We can then work through those repls and add the support if possible. |
Great, I'll add bits to #19858 so that it errors for repls that do not have proven support just yet. |
Fixes #3423 As discussed in #3423 (comment) we are implementing args at the goal-level but with a caveat that it is only available for some shells. In this PR, we only enable it for ipython. The repl will error out otherwise. --------- Co-authored-by: Benjy Weinberger <benjyw@gmail.com>
In particular, the
ipython
repl supports CLI arguments like:which launches a visual repl.
Supporting passthrough args would mean that:
would work (assuming you added the relevant 'notebook' deps to
--ipython-requirements
)To do this, you would enable passthru args on the
PythonRepl
task by overriding thesupports_passthru_args
property to True (example), and then pass any additionalself.get_passthru_args()
as args while launching the repl.You could then add either a unit or integration test for the passthru.
The text was updated successfully, but these errors were encountered: