From fa71ffc64709b8aed3aa794cf8f0528eca0dc832 Mon Sep 17 00:00:00 2001 From: Guen Prawiroatmodjo Date: Sun, 11 May 2025 17:35:42 -0700 Subject: [PATCH 1/4] add how-to-debug-local --- content/how-tos/how-to-debug-local.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 content/how-tos/how-to-debug-local.md diff --git a/content/how-tos/how-to-debug-local.md b/content/how-tos/how-to-debug-local.md new file mode 100644 index 0000000..0245049 --- /dev/null +++ b/content/how-tos/how-to-debug-local.md @@ -0,0 +1,22 @@ +--- +title: "How do I debug my code with VS Code?" +--- + +1. [Create a new VS Code Python profile](https://code.visualstudio.com/docs/configure/profiles#_create-a-profile) and activate it. This will install all recommended VS Code extensions for developing Python code. + +1. Create a local development environment using the ["How to create a local environment"](#placeholder-link-to-how-to) guide. (Optional) You can create an environment with VS Code using the [Create Environment](https://code.visualstudio.com/docs/python/environments#_creating-environments) command. + +1. [Activate your environment](#placeholder-link-to-activate-env) and install your project in editable mode. Optionally, also install dev requirements, if your project has them. To do this, you can run in a terminal: + + ``` + pip install -r + pip install -e . + ``` + +1. Set up your VS Code Python interpreter to use the Python environment using the [Python: Select Interpreter](https://code.visualstudio.com/docs/python/environments#_working-with-python-interpreters) command. + +1. Open the Python file you want to debug in VS Code. Familiarize yourself with the [Debugger user interface](https://code.visualstudio.com/docs/debugtest/debugging#_debugger-user-interface), which you can open by clicking on the Run and Debug icon in the left menu bar. + +1. You can now start debugging. Set [Breakpoints](https://code.visualstudio.com/docs/debugtest/debugging#_breakpoints) by clicking in the gutter (the space to the left of the line numbers) or pressing F9 on the line where you want the debugger to pause execution. + +1. For more detailed information about debugging in VS Code, refer to the [Debug code with Visual Studio Code](https://code.visualstudio.com/docs/debugtest/debugging) or the [Python debugging in VS Code](https://code.visualstudio.com/docs/python /debugging) documentation pages. From f0b1549f645feec5500366d53d349fcd82d0402d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 12 May 2025 00:37:07 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- content/how-tos/how-to-debug-local.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/how-tos/how-to-debug-local.md b/content/how-tos/how-to-debug-local.md index 0245049..6fd46ac 100644 --- a/content/how-tos/how-to-debug-local.md +++ b/content/how-tos/how-to-debug-local.md @@ -8,10 +8,10 @@ title: "How do I debug my code with VS Code?" 1. [Activate your environment](#placeholder-link-to-activate-env) and install your project in editable mode. Optionally, also install dev requirements, if your project has them. To do this, you can run in a terminal: - ``` - pip install -r - pip install -e . - ``` + ``` + pip install -r + pip install -e . + ``` 1. Set up your VS Code Python interpreter to use the Python environment using the [Python: Select Interpreter](https://code.visualstudio.com/docs/python/environments#_working-with-python-interpreters) command. From 97e446d506c361b40d0a00093a6b70466ea7bfdd Mon Sep 17 00:00:00 2001 From: Guen Prawiroatmodjo Date: Tue, 13 May 2025 12:44:20 -0700 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Daniel McCloy Co-authored-by: Madicken Munk --- content/how-tos/how-to-debug-local.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/content/how-tos/how-to-debug-local.md b/content/how-tos/how-to-debug-local.md index 6fd46ac..e476b8e 100644 --- a/content/how-tos/how-to-debug-local.md +++ b/content/how-tos/how-to-debug-local.md @@ -2,13 +2,16 @@ title: "How do I debug my code with VS Code?" --- -1. [Create a new VS Code Python profile](https://code.visualstudio.com/docs/configure/profiles#_create-a-profile) and activate it. This will install all recommended VS Code extensions for developing Python code. +Most projects strongly encourage running tests locally before opening a pull request (or before pushing new commits to an existing PR). + +When those tests fail, interactive debugging can help you figure out why. +1. To ensure you have all the needed VSCode extensions, [create a new VS Code profile](https://code.visualstudio.com/docs/configure/profiles#_create-a-profile) using the "Python" template profile, and activate it. (Advanced users might skip this step, if they know they already have a suitable profile that is active). 1. Create a local development environment using the ["How to create a local environment"](#placeholder-link-to-how-to) guide. (Optional) You can create an environment with VS Code using the [Create Environment](https://code.visualstudio.com/docs/python/environments#_creating-environments) command. -1. [Activate your environment](#placeholder-link-to-activate-env) and install your project in editable mode. Optionally, also install dev requirements, if your project has them. To do this, you can run in a terminal: +1. [Activate your environment](#placeholder-link-to-activate-env) and install your project in editable mode. Optionally, also install dev requirements, if your project has them. How you do this depends on the project; most will have a section in `pyproject.toml` listing optional developer dependencies; if so, install them by putting the optional dependencies group in brackets in the `pip` install command. For example, if the optional dependences are in a group called `dev`, you would run in a terminal `pip install -e .[dev]`. If instead the dev dependencies are in a separate requirements file, you would instead do: - ``` + ```shell pip install -r pip install -e . ``` @@ -17,6 +20,6 @@ title: "How do I debug my code with VS Code?" 1. Open the Python file you want to debug in VS Code. Familiarize yourself with the [Debugger user interface](https://code.visualstudio.com/docs/debugtest/debugging#_debugger-user-interface), which you can open by clicking on the Run and Debug icon in the left menu bar. -1. You can now start debugging. Set [Breakpoints](https://code.visualstudio.com/docs/debugtest/debugging#_breakpoints) by clicking in the gutter (the space to the left of the line numbers) or pressing F9 on the line where you want the debugger to pause execution. +1. You can now start debugging. Set [Breakpoints](https://code.visualstudio.com/docs/debugtest/debugging#_breakpoints) by clicking in the gutter (the space to the left of the line numbers) or pressing F9 on the line where you want the debugger to pause execution. You'll see the breakpoint set when a red dot appears in the gutter. -1. For more detailed information about debugging in VS Code, refer to the [Debug code with Visual Studio Code](https://code.visualstudio.com/docs/debugtest/debugging) or the [Python debugging in VS Code](https://code.visualstudio.com/docs/python /debugging) documentation pages. +1. For more detailed information about debugging in VS Code, refer to the [Debug code with Visual Studio Code](https://code.visualstudio.com/docs/debugtest/debugging) or the [Python debugging in VS Code](https://code.visualstudio.com/docs/python/debugging) documentation pages. From 39856c79f0b5068152b6b42ce1a7958eb5ed6a95 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 13 May 2025 19:44:27 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- content/how-tos/how-to-debug-local.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/content/how-tos/how-to-debug-local.md b/content/how-tos/how-to-debug-local.md index e476b8e..3863bc8 100644 --- a/content/how-tos/how-to-debug-local.md +++ b/content/how-tos/how-to-debug-local.md @@ -3,8 +3,11 @@ title: "How do I debug my code with VS Code?" --- Most projects strongly encourage running tests locally before opening a pull request (or before pushing new commits to an existing PR). + + When those tests fail, interactive debugging can help you figure out why. + 1. To ensure you have all the needed VSCode extensions, [create a new VS Code profile](https://code.visualstudio.com/docs/configure/profiles#_create-a-profile) using the "Python" template profile, and activate it. (Advanced users might skip this step, if they know they already have a suitable profile that is active). 1. Create a local development environment using the ["How to create a local environment"](#placeholder-link-to-how-to) guide. (Optional) You can create an environment with VS Code using the [Create Environment](https://code.visualstudio.com/docs/python/environments#_creating-environments) command. @@ -20,6 +23,6 @@ When those tests fail, interactive debugging can help you figure out why. 1. Open the Python file you want to debug in VS Code. Familiarize yourself with the [Debugger user interface](https://code.visualstudio.com/docs/debugtest/debugging#_debugger-user-interface), which you can open by clicking on the Run and Debug icon in the left menu bar. -1. You can now start debugging. Set [Breakpoints](https://code.visualstudio.com/docs/debugtest/debugging#_breakpoints) by clicking in the gutter (the space to the left of the line numbers) or pressing F9 on the line where you want the debugger to pause execution. You'll see the breakpoint set when a red dot appears in the gutter. +1. You can now start debugging. Set [Breakpoints](https://code.visualstudio.com/docs/debugtest/debugging#_breakpoints) by clicking in the gutter (the space to the left of the line numbers) or pressing F9 on the line where you want the debugger to pause execution. You'll see the breakpoint set when a red dot appears in the gutter. 1. For more detailed information about debugging in VS Code, refer to the [Debug code with Visual Studio Code](https://code.visualstudio.com/docs/debugtest/debugging) or the [Python debugging in VS Code](https://code.visualstudio.com/docs/python/debugging) documentation pages.