Document the virtualenv, activate and deactivate hooks

オープン 初心者向け
#552 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@officialasishkumar がすでに取り組んでいます。

2026年12月4日 から。

  • #553 @officialasishkumar による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
bash, fish, shell, zsh
領域
documentation

調査の方向性

README にある既存の virtualenv-delete フックのドキュメントから始め、続いて virtualenv、activate、deactivate のフック登録と実行コードを読み、issue に記載されたフック名、変数、シェルの動作を確認してください。これらの詳細、Bash、Zsh、Fish での activate/deactivate の例、既存の virtualenv-delete ドキュメントへのリンクを含む Hooks セクションを追加してください。ドキュメントに記載されたフックポイントと例が、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 activate and pyenv deactivate support hooks (before_virtualenv/after_virtualenv, before_activate/after_activate, before_deactivate/after_deactivate), but the README doesn't mention them. Only the virtualenv-delete hooks are documented. The "Reset existing virtualenv" section even says "virtualenv-delete and virtualenv Pyenv hooks are run", but virtualenv hooks 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, STATUS for virtualenv; venv, prefix, shell for activate/deactivate);
    • that the stdout of activate/deactivate hooks 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 deactivate hooks run on activation too, with empty venv/prefix if none was active.

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時間
マージ済み PR(30日)
11

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pyenv/pyenv-virtualenv のほかの issue

pyenv/pyenv-virtualenv の issue をすべて見る

似ている issue

Shell/Bash の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。