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
feat(python): add auto venv activation #12248
Conversation
Providing at-mentions to people who have contributed to the |
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.
I like it! Could you make it opt-in instead of out-out? Thanks!
Thanks for your kind reaction, @carlosala! I added two commits. One does as you requested and makes the new feature opt-in, and improves the description of the new feature in the README. |
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.
LGTM! 🚀
I made some changes to simplify the code and align it with our usual design. |
Hey @rcrews -- we really appreciate the contribution! ✌️ |
* upstream/master: (90 commits) feat(gradle): update completion to version 25da917c (ohmyzsh#12287) fix(dependencies): copy gradle LICENSE feat(dependencies): enable gradle plugin docs: fix typos (ohmyzsh#12284) docs(pyenv): fix typo (ohmyzsh#12283) feat(extract): prefer using `pbzip2` instead of `bunzip2` (ohmyzsh#12280) docs(readme): add contributor list (ohmyzsh#12236) feat(fzf): add default fzf_base for msys2 (ohmyzsh#12274) fix(async): register the git prompt async handler correctly (ohmyzsh#12267) fix(git): disable temporarely async prompt feat(async)!: implement async prompt API and apply to git prompt (ohmyzsh#12257) feat(tools): update `supports_hyperlinks` (ohmyzsh#12258) chore(gitfast): remove update script (ohmyzsh#12262) perf(nvm): don't call `nvm version` on every cd feat(nvm)!: make `lazy` and `autoload` options compatible fix(nvm): remove zsh completion fix(terraform): fix completion repeating flags with value (ohmyzsh#12256) fix(terraform): pass `-chdir` to completion commands (ohmyzsh#12254) feat(python): add auto venv activation (ohmyzsh#12248) feat(terraform): update completion to `v1.7` (ohmyzsh#12252) ...
* upstream/master: (212 commits) fix(docker-compose): completion regression (ohmyzsh#12288) feat(gradle): update completion to version 25da917c (ohmyzsh#12287) fix(dependencies): copy gradle LICENSE feat(dependencies): enable gradle plugin docs: fix typos (ohmyzsh#12284) docs(pyenv): fix typo (ohmyzsh#12283) feat(extract): prefer using `pbzip2` instead of `bunzip2` (ohmyzsh#12280) docs(readme): add contributor list (ohmyzsh#12236) feat(fzf): add default fzf_base for msys2 (ohmyzsh#12274) fix(async): register the git prompt async handler correctly (ohmyzsh#12267) fix(git): disable temporarely async prompt feat(async)!: implement async prompt API and apply to git prompt (ohmyzsh#12257) feat(tools): update `supports_hyperlinks` (ohmyzsh#12258) chore(gitfast): remove update script (ohmyzsh#12262) perf(nvm): don't call `nvm version` on every cd feat(nvm)!: make `lazy` and `autoload` options compatible fix(nvm): remove zsh completion fix(terraform): fix completion repeating flags with value (ohmyzsh#12256) fix(terraform): pass `-chdir` to completion commands (ohmyzsh#12254) feat(python): add auto venv activation (ohmyzsh#12248) ...
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Standards checklist:
Changes:
containing
venv/bin/activate
, it automatically activates the virtual environment.When cd'ing out of the directory, it automatically deactivates the virtual environment.
VENV_NAME
where a name different fromvenv
can be specified. (For example,.venv
is also suggested by the Python docs.)DISABLE_AUTO_VRUN
and the listenerwill always exit without making any changes.
Other comments:
Auto-activating the environment is a feature of the Ruby Version Manager (rvm). I really like that feature,
and researched till I could add it to my Python environments. I've been running this on my computer for
about six months without issues.