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

Tab completion under pew? #150

Open
ColMcp opened this issue Sep 8, 2017 · 10 comments
Open

Tab completion under pew? #150

ColMcp opened this issue Sep 8, 2017 · 10 comments

Comments

@ColMcp
Copy link

ColMcp commented Sep 8, 2017

macOS 10.12.6 Python 3.6.2 pew 0.1.26

When I run the CPython REPL from a standard shell tab completion is operative. When I run it in a sub-shell invoked by pew tab completion is not operative.

Is this a bug, or a configuration failure on my part?

@kennethreitz
Copy link
Collaborator

Confirmed here.

@kennethreitz
Copy link
Collaborator

the following code activates tab completion:

import rlcompleter, readline
readline.parse_and_bind('tab: complete')

@kennethreitz
Copy link
Collaborator

@ColMcp
Copy link
Author

ColMcp commented Sep 8, 2017

The above parse_and_bind() call didn't work for me but
readline.parse_and_bind('bind ^I rl_complete') did work.

site.py from the Python library has the following code in enablerlcompleter()

# Reading the initialization (config) file may not be enough to set a
# completion key, so we set one first and then read the file.
readline_doc = getattr(readline, '__doc__', '')
if readline_doc is not None and 'libedit' in readline_doc:
    readline.parse_and_bind('bind ^I rl_complete')
else:
    readline.parse_and_bind('tab: complete')

Maybe we have different arrangements for accessing a readline library on our respective machines even though we are both using macOS.

@berdario
Copy link
Collaborator

berdario commented Oct 1, 2017

This reminds me of #90 :/

Unfortunately, this is another bit of behavior due to virtualenv (and that would be solved by a rewrite)

(there might be actually another option to prevent this, but it's late and I haven't looked deeply into this)

Apparently the rewrite is not happening 😞 . But maybe a minimal rewrite of virtualenv, with just the few features required by us, might be feasible (we wouldn't have this concern, since we could invoke it directly as a library, and avoid conflicts/pollution in the PATH)

@erinxocon
Copy link
Collaborator

@berdario Want to vendorize virtualenv?

@berdario
Copy link
Collaborator

berdario commented Oct 11, 2017

You mean vendorize and trying to patch this ourselves?

I'd rather try to fix it upstream, and add a version bound on the patch that fixed this would be better

Or is there another advantage to vendorizing it that I'm missing?

@erinxocon
Copy link
Collaborator

No, vendorizing just lets us have more control I suppose, but it prevents us from merging any fixes the maintainers put in place. You way makes sense.

@nealmcb
Copy link

nealmcb commented May 18, 2022

Is this fixed upstream now? I can't reproduce it.

Using Ubuntu 20.04, Python 3.8.10, Pew 1.2.0, I do

pew mktmpenv
python
imp<TAB>

and it autocompletes to import

@mrx23dot
Copy link

please add tab completion like
sudo systemctl s<tab>
very handy

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

No branches or pull requests

6 participants