GithubHelp home page GithubHelp logo

Comments (11)

kalefranz avatar kalefranz commented on August 26, 2024 6

After a lot of internal discussion, we've deprecated tab completion starting in conda 4.4. I guess argcomplete also isn't built for python 3.6. At some point in the future if we switch our python argparse for a better library, we can consider bringing back tab completion.

from conda-docs.

walkerh avatar walkerh commented on August 26, 2024 6

Apparently I'm not the only one who likes tab completion. I did this hack.

  1. Installed argcomplete:
conda install --channel conda-forge argcomplete
activate-global-python-argcomplete 
  1. Created an executable file named "tonda" (for tab-completing conda) in my PATH with these contents:
#!/anaconda3/anaconda/bin/python

# PYTHON_ARGCOMPLETE_OK

import re
import sys

import argcomplete

from conda.cli import main
from conda.cli.main import generate_parser

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    parser = generate_parser()
    argcomplete.autocomplete(parser)
    sys.exit(main())

You would need to use a shebang matching your anaconda or miniconda Python.

  1. Added this to my .bashrc:
# Location generated by activate-global-python-argcomplete
source /usr/local/etc/bash_completion.d/python-argcomplete.sh

You would need to update the location in step 3 based on the output of step 1.

This hack depends on two implementation details of conda. The generate_parser function gives me an argparse parser that I can pass to argcomplete.autocomplete. After giving tab completion a chance to run, I just delegate to conda.cli.main, which is another implementation detail.

Read here to understand how argcomplete combines argparse and bash to automatically generate completions:

https://github.com/kislyuk/argcomplete

Since this is a hack, consider it good for a developer but bad for production.

from conda-docs.

grahamannett avatar grahamannett commented on August 26, 2024 4

Hmm, this is a bit old (and I haven't used conda for awhile so not sure if this is common knowledge or better way for this, seems misleading to even have that in the docs still if its not supported on 3.6) but thought I'd comment.
Argcomplete works fine with python3.6 atm but the official conda one is only built up to 3.5. Im not sure why the official conda repo hasn't updated the argcomplete package but the conda-forge channel has a working one and works fine w/ 3.6. @kalefranz seems like it would be straightforward and helpful to update either docs or the conda package itself

https://github.com/conda-forge/argcomplete-feedstock

from conda-docs.

qiongsiwu avatar qiongsiwu commented on August 26, 2024

I am running into the exact same problem on macOS.

from conda-docs.

damnsavage avatar damnsavage commented on August 26, 2024

Same problem here, the anaconda distributions with python 3.6+ do not have argcomplete included. We use a company wide installation here so it's not trivial to just add it back in. All scripts use argcomplete so we have to stick with an older anaconda release... painful.

from conda-docs.

niklasholm avatar niklasholm commented on August 26, 2024

argcomplete is now available for python 3.6 in the official repositories (see ContinuumIO/anaconda-issues#7517), although tab completion for conda doesn't work for me. It seems to be loaded correctly, but typing conda ins<tab> doesn't do anything instead of completing to conda install as expected.

$ conda -V
conda 4.4.8
$ complete -p | grep -i conda
complete -o default -o nospace -F _python_argcomplete conda

Is tab completion now completely removed? If so, it should be clearly stated in the documention. It's quite annoying have a doc title saying "Enabling tab completion" and then finding out it doesn't work for some unexplained reason.

from conda-docs.

damnsavage avatar damnsavage commented on August 26, 2024

Yeah, I still have the same problem, I checked several versions of anaconda after version 4.0.0_py3 and none of them include argcomplete, (4.1.1_py3, 4.2.0_py3, 4.3.1_py3, 4.4.0_py3, 5.0.1_py3) very frustrating.

I thought it was a basic well used module. I don't see any replacement or discussion why it was removed. It's only 131KB...

from conda-docs.

couzhei avatar couzhei commented on August 26, 2024

Same problem here! I've just updated my conda from 4.4.10 to 4.5.4, but the problem seems to be consistent. I'm running ubuntu 14.04 if that helps. However, in my case there doesn't seem to be any kind of error, it simply does nothing!

from conda-docs.

bnaman50 avatar bnaman50 commented on August 26, 2024

Guys, I am new to all this. So, please bear with my question.

I am trying to enable tab completion as mentioned here. But I don't exactly understand the what I need to do in the step 2.
untitd

I tried to add this command to my .bashrc file, tried running this command in my bash shell, but nothing works. Could anyone help me out with this. It is really annoying to type the full name of the environments. Tab completion will help a lot.

Thanks,
Naman

from conda-docs.

sungwonida avatar sungwonida commented on August 26, 2024

I'm facing the same. (Tab completion not working)

from conda-docs.

github-actions avatar github-actions commented on August 26, 2024

Hi there, thank you for your contribution!

This issue has been automatically locked because it has not had recent activity after being closed.

Please open a new issue if needed.

Thanks!

from conda-docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.