Conversation
There was a problem hiding this comment.
Pull request overview
This pull request reworks the virtual environment section in the Python course documentation, making it more accessible and structured for learners. The changes add a practical analogy (cooking/kitchen metaphor), reorganize content with a clear three-step process, and include visual aids to help students understand and work with virtual environments.
Changes:
- Added a kitchen/cooking analogy to explain the concept of virtual environments
- Restructured the virtual environment workflow into three clear steps: create, activate, and select
- Added new images showing terminal activation and kernel selection in VS Code
- Enhanced warnings about virtual environment folder structure and usage
- Improved explanations about when activation is needed vs. kernel selection
Reviewed changes
Copilot reviewed 1 out of 3 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| docs/python/packages.md | Reworked virtual environment section with new analogy, clearer step-by-step instructions, and additional warnings/information boxes |
| docs/assets/python-extensive/venv_terminal.png | Added screenshot showing activated virtual environment in terminal |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| <div style="display: flex; justify-content: center; align-items: center; flex-direction: column; margin-bottom: 1rem;"> | ||
| <div class="tenor-gif-embed" data-postid="23277809" data-share-method="host" data-aspect-ratio="1.33891" data-width="50%"> | ||
| <a href="https://tenor.com/view/allergies-allergic-reaction-the-big-bang-theory-howard-wolowitz-peanut-reaction-gif-23277809">Allergies Allergic Reaction GIF</a>from <a href="https://tenor.com/search/allergies-gifs">Allergies GIFs</a> |
There was a problem hiding this comment.
There is a spacing issue on line 216. There should be a space between "GIF" and "from" in the link text. It should read "Allergies Allergic Reaction GIF from" instead of "GIFfrom".
| <a href="https://tenor.com/view/allergies-allergic-reaction-the-big-bang-theory-howard-wolowitz-peanut-reaction-gif-23277809">Allergies Allergic Reaction GIF</a>from <a href="https://tenor.com/search/allergies-gifs">Allergies GIFs</a> | |
| <a href="https://tenor.com/view/allergies-allergic-reaction-the-big-bang-theory-howard-wolowitz-peanut-reaction-gif-23277809">Allergies Allergic Reaction GIF</a> from <a href="https://tenor.com/search/allergies-gifs">Allergies GIFs</a> |
| #### Deactivate a environment | ||
| Once the environment is activated, you can see the name of the environment (here `.venv`) in the terminal. | ||
|
|
||
| { align=center } |
There was a problem hiding this comment.
There are two trailing spaces after "align=center" in the image markdown. While this doesn't break functionality, it's inconsistent and should be removed for cleaner code.
| { align=center } | |
| { align=center } |
| └── my_script.ipynb | ||
| ``` | ||
|
|
||
| #### Activate a environment |
There was a problem hiding this comment.
There is a grammatical error in the section heading. It should be "Activate an environment" instead of "Activate a environment". The article "an" should be used before words starting with a vowel sound.
| #### Activate a environment | |
| #### Activate an environment |
|
|
||
| Previously, we have installed the package `seaborn`. The package itself was | ||
| available system-wide as we did not create a virtual environment beforehand. | ||
| available system-wide as we did not create a virtual environment beforehand. |
There was a problem hiding this comment.
There is a trailing whitespace at the end of line 203 after "beforehand." This should be removed for cleaner code.
| available system-wide as we did not create a virtual environment beforehand. | |
| available system-wide as we did not create a virtual environment beforehand. |
|
|
||
| { align=center } | ||
|
|
||
| From now on, every package you install will be installed in the virtual environment and only available if you select the virtual environment for you Jupyter or Python file (see next section). You can check if a package is installed by typing `pip list` in the terminal. Note, that once you close the terminal or VSCode, the environment will be deactivated. You only need to activate the environment if you want to install or remove a package from your virtual environment. You can use it in your file even if the environment is not activated. |
There was a problem hiding this comment.
The explanation states "You only need to activate the environment if you want to install or remove a package from your virtual environment. You can use it in your file even if the environment is not activated." This is technically accurate for VS Code when you've selected the virtual environment as your kernel, but it might be confusing for beginners. It would be clearer to emphasize that: (1) activation is needed for terminal operations like pip install, and (2) selecting the kernel in VS Code/Jupyter is separate from terminal activation. Consider rephrasing to make this distinction more explicit.
| From now on, every package you install will be installed in the virtual environment and only available if you select the virtual environment for you Jupyter or Python file (see next section). You can check if a package is installed by typing `pip list` in the terminal. Note, that once you close the terminal or VSCode, the environment will be deactivated. You only need to activate the environment if you want to install or remove a package from your virtual environment. You can use it in your file even if the environment is not activated. | |
| From now on, every package you install from this activated terminal (for example with `pip install` or `python -m pip install`) will be installed into the virtual environment. In VS Code or Jupyter you also need to select this virtual environment as the Python/Jupyter kernel for your notebook or script (see next section); this kernel selection is separate from activating the environment in the terminal. Use activation whenever you run terminal commands that should use the virtual environment (such as `pip install`, `pip list`, or running a script). Note that once you close the terminal or VS Code, the environment in that terminal will be deactivated, but files that use the virtual-environment kernel will still run with the packages from that environment. |
|
|
||
| 1. Create a virtual environment | ||
| 2. Activate the virtual environment | ||
| 3. Select the virtual environment as you Jupyter or Python kernel |
There was a problem hiding this comment.
There is a typo in "you" instead of "your". The text should read "Select the virtual environment as your Jupyter or Python kernel" instead of "as you Jupyter or Python kernel".
| 3. Select the virtual environment as you Jupyter or Python kernel | |
| 3. Select the virtual environment as your Jupyter or Python kernel |
|
|
||
| { align=center } | ||
|
|
||
| From now on, every package you install will be installed in the virtual environment and only available if you select the virtual environment for you Jupyter or Python file (see next section). You can check if a package is installed by typing `pip list` in the terminal. Note, that once you close the terminal or VSCode, the environment will be deactivated. You only need to activate the environment if you want to install or remove a package from your virtual environment. You can use it in your file even if the environment is not activated. |
There was a problem hiding this comment.
There is a typo in "you" instead of "your". The text should read "only available if you select the virtual environment for your Jupyter or Python file" instead of "for you Jupyter or Python file".
| From now on, every package you install will be installed in the virtual environment and only available if you select the virtual environment for you Jupyter or Python file (see next section). You can check if a package is installed by typing `pip list` in the terminal. Note, that once you close the terminal or VSCode, the environment will be deactivated. You only need to activate the environment if you want to install or remove a package from your virtual environment. You can use it in your file even if the environment is not activated. | |
| From now on, every package you install will be installed in the virtual environment and only available if you select the virtual environment for your Jupyter or Python file (see next section). You can check if a package is installed by typing `pip list` in the terminal. Note, that once you close the terminal or VSCode, the environment will be deactivated. You only need to activate the environment if you want to install or remove a package from your virtual environment. You can use it in your file even if the environment is not activated. |
| ???+ warning | ||
| The virtual environment folder should never be touched by the user. Initially a clean copy of your global Python installation will be created. | ||
| This includes absolute paths to the Python installation and the Python executable. | ||
| Therefore the virtual environment folder **can not be moved** or sent to another machine. |
There was a problem hiding this comment.
The warning box states that the virtual environment folder "can not be moved" but uses two words instead of one. While "can not" is technically acceptable, the more common and standard form is "cannot" (one word). For consistency and readability in technical documentation, "cannot" is preferred.
| Therefore the virtual environment folder **can not be moved** or sent to another machine. | |
| Therefore the virtual environment folder **cannot be moved** or sent to another machine. |
| <div style="display: flex; justify-content: center; align-items: center; flex-direction: column; margin-bottom: 1rem;"> | ||
| <div class="tenor-gif-embed" data-postid="23277809" data-share-method="host" data-aspect-ratio="1.33891" data-width="50%"> | ||
| <a href="https://tenor.com/view/allergies-allergic-reaction-the-big-bang-theory-howard-wolowitz-peanut-reaction-gif-23277809">Allergies Allergic Reaction GIF</a>from <a href="https://tenor.com/search/allergies-gifs">Allergies GIFs</a> | ||
| </div> | ||
| <script type="text/javascript" async src="https://tenor.com/embed.js"></script> |
There was a problem hiding this comment.
The newly added Tenor GIF embed loads third-party JavaScript from https://tenor.com/embed.js directly into your documentation page, executing untrusted code in the security context of your docs site. If the Tenor script is compromised or behaves maliciously, it can exfiltrate session cookies/tokens, modify page content, or run arbitrary actions on behalf of authenticated users viewing the docs. To reduce this supply-chain risk, avoid including third-party scripts directly and prefer safer alternatives (e.g., static media, server-side rendering, or vetted first-party bundles).
No description provided.