Document the virtualenv, activate and deactivate hooks
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 82/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- bash, fish, shell, zsh
调研方向
从 README 中现有的 virtualenv-delete hook 文档开始,然后阅读 virtualenv、activate 和 deactivate 的 hook 注册与执行代码,以确认 issue 中描述的 hook 名称、变量和 shell 行为。添加一个 Hooks 部分,包含这些详细信息、Bash、Zsh 和 Fish 的 activate/deactivate 示例,以及指向现有 virtualenv-delete 文档的链接。当文档中的 hook 点和示例与 issue 所述行为相符时,即为完成。
由索引模型根据 Issue 内容生成。
描述
Describe the intended use case
- Writing a hook script for pyenv-virtualenv, e.g. a plugin like pyenv-jupyter-kernel that reacts to
pyenv virtualenv, or a user script in$(pyenv root)/pyenv.d/activate/that sets an environment variable whenever a virtualenv is activated (#428, #514). pyenv virtualenv,pyenv activateandpyenv deactivatesupport hooks (before_virtualenv/after_virtualenv,before_activate/after_activate,before_deactivate/after_deactivate), but the README doesn't mention them. Only thevirtualenv-deletehooks are documented. The "Reset existing virtualenv" section even says "virtualenv-deleteandvirtualenvPyenv hooks are run", butvirtualenvhooks aren't explained anywhere.- The Pyenv wiki's Authoring plugins page explains the general mechanism, but not which hook points pyenv-virtualenv has. In #514 the advice was to read
pyenv-sh-activate's source to see where hook code runs. - Things you currently can only learn from the source:
- the registration functions and the variables hook code can read (
VERSION_NAME,VIRTUALENV_NAME,VIRTUALENV_PATH,STATUSforvirtualenv;venv,prefix,shellforactivate/deactivate); - that the
stdoutofactivate/deactivatehooks is evaluated by the user's shell, so a hook changes the shell environment by printing code in the syntax of$shell; - that activation first deactivates the current virtualenv, so the
deactivatehooks run on activation too, with emptyvenv/prefixif none was active.
- the registration functions and the variables hook code can read (
Describe the solution you'd like
A "Hooks" section in the README that lists the hook scripts, their registration functions and variables, says when they run, and gives a short example of an activate/deactivate hook pair that works in Bash, Zsh and Fish. It should link to the existing virtualenv-delete hook docs.
Describe alternatives you've considered
Adding this to the Pyenv wiki's Authoring plugins page instead. But the hook points belong to this plugin and change with its code, so they're better documented next to it, like the virtualenv-delete hooks already are.
[ ] In particular, did you consider writing a plugin? Note that if your plugin has general applicability, you can publish it in the 3rd-party plugin catalog on the Pyenv Wiki as per the link above.
- Not applicable: this is about documenting the hook points that plugins use.
Additional context
I checked the behaviour described above with pyenv 2.8.15 and pyenv-virtualenv master (6fb661f) in Bash, Zsh and Fish 4.9.3, with manual and automatic activation.
- 主要语言
- Shell
- 星标
- 6.7k
- 派生
- 433
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 11
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pyenv/pyenv-virtualenv 的其他 Issue
-
Creating a virtualenv from system leaves a self-referencing symlink inside it可能已有人在做 @dhananjay6561 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
pyenv/pyenv-virtualenv#548 · 1 条评论 ·
维护者通常 1 天内回复
-
virtualenv-delete with a trailing slash can remove all of $PYENV_ROOT/versions可能已有人在做 @dhananjay6561 于 4 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
pyenv/pyenv-virtualenv#546 · 1 条评论 ·
维护者通常 1 天内回复
-
Fish: activating a conda env doesn't set CONDA_PREFIX or run its activate.d/deactivate.d scripts可能已有人在做 @officialasishkumar 今天认领。 未关闭
难度 3/5 1-2 天 新手友好度 76/100
pyenv/pyenv-virtualenv#550 ·
维护者通常 1 天内回复
-
`pyenv virtualenv (version) (name)` ignores specified version and uses homebrew's `python` version未关闭
难度 3/5 半天 新手友好度 55/100
pyenv/pyenv-virtualenv#531 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
pyenv/pyenv-virtualenv#524 · 5 条评论 ·
维护者通常 1 天内回复
查看 pyenv/pyenv-virtualenv 的全部 Issue
相似的 Issue
-
package-update
难度 1/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
bug client P3
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
automated issue report
难度 1/5 1 小时以内 新手友好度 70/100
rockerBOO/awesome-neovim#2642 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
rocky-linux/documentation#3569 · 4 条评论 ·
维护者通常 1 天内回复