From b015c6b21edd99091ae4e699a96334949679315f Mon Sep 17 00:00:00 2001 From: emisargent <55098699+emisargent@users.noreply.github.com> Date: Sat, 18 Feb 2023 01:13:41 +0000 Subject: [PATCH] Activate venv in current terminal --- .devcontainer/devcontainer.json | 11 +++++++++-- CONTRIBUTING.rst | 13 +++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e2356f58..841f753e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,11 +9,18 @@ "vscode": { // Set *default* container specific settings.json values on container create. "settings": { - "python.defaultInterpreterPath": "/workspaces/flask/.venv/bin/python", + // Settings for the python extension. + "python.defaultInterpreterPath": "${workspaceFolder}/.venv", + "python.terminal.activateEnvInCurrentTerminal": true, "python.linting.enabled": true, "python.linting.pylintEnabled": true - } + }, + // Installs extensions on container create. + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance" + ] } }, diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 749434b5..178786cc 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -79,15 +79,16 @@ a `devcontainer`_ that installs required dependencies for you. - Fork Flask to your GitHub account by clicking the `Fork`_ button. - From your fork's repository page, click the green "Code" button and then "Create codespace on main". -- Wait for the codespace to load and the "postCreateCommand" to +- Wait for the codespace to load and the ``postCreateCommand`` to finish running. -- Open a new terminal or run ``. .venv/bin/activate`` to activate the +- Open a new terminal or run the following command to activate the python virtualenv. -- Checkout a new branch and `start coding`_. -Note that when you reconnect to an existing codespace, you may need to -reactivate your python virtualenv by opening a new terminal or running -the ``. .venv/bin/activate`` command. + .. code-block:: text + + $ . .venv/bin/activate + +- Checkout a new branch and `start coding`_. .. _GitHub Codespaces: https://docs.github.com/en/codespaces .. _devcontainer: https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/introduction-to-dev-containers