profile
viewpoint

Ask questionsBreakpoints won't break in Pydantic package, specifically

Environment data

  • VS Code version: 1.49.3
  • Extension version (available under the Extensions sidebar): 2020.0.112786
  • OS and version: Ubuntu 20.04
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.8.2
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Relevant/affected Python packages and their versions: pydantic
  • Relevant/affected Python-related VS Code extensions and their versions: Pylance 2020.9.8
  • Value of the python.languageServer setting: Pylance, although Jedi/Microsoft also show the same behavior

Expected behaviour

Debugger will break on breakpoints in Pydantic code, as in other installed libs

Actual behaviour

Debugger will break in other installed lib code, but not in Pydantic code.

Steps to reproduce:

Detailed instructions at https://github.com/smcoll/vscode-python-14284, but here's the gist of it:

  1. set up a workspace with only Python and Pylance extensions enabled, and set "justMyCode": false
  2. set debug breakpoints in the env's site-packages/pydantic/main.py
  3. set breakpoints in other packages in site-packages for that virtualenv
  4. run the debugger and note that any breakpoint will break except those in Pydantic

Logs

User belongs to experiment group 'ShowPlayIcon - start'
User belongs to experiment group 'ShowExtensionSurveyPrompt - enabled'
User belongs to experiment group 'DebugAdapterFactory - experiment'
User belongs to experiment group 'PtvsdWheels37 - experiment'
User belongs to experiment group 'UseTerminalToGetActivatedEnvVars - control'
User belongs to experiment group 'LocalZMQKernel - experiment'
User belongs to experiment group 'CollectLSRequestTiming - experiment'
User belongs to experiment group 'CollectNodeLSRequestTiming - experiment'
User belongs to experiment group 'EnableIPyWidgets - experiment'
User belongs to experiment group 'RunByLine - experiment'
User belongs to experiment group 'CustomEditorSupport - control'
User belongs to experiment group 'pythonaa'
> conda --version
> pyenv root
> python3.7 ~/.vscode/extensions/ms-python.python-2020.9.112786/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.6 ~/.vscode/extensions/ms-python.python-2020.9.112786/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3 ~/.vscode/extensions/ms-python.python-2020.9.112786/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python2 ~/.vscode/extensions/ms-python.python-2020.9.112786/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode/extensions/ms-python.python-2020.9.112786/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> ~/vscode-bug/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.9.112786/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> conda info --json
> pyenv root
> pyenv root
> pyenv root
> pyenv root
> pyenv root
> pyenv root
> ~/vscode-bug/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.9.112786/pythonFiles/pyvsc-run-isolated.py -c "import jupyter"
> ~/vscode-bug/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.9.112786/pythonFiles/pyvsc-run-isolated.py -c "import notebook"
Python interpreter path: ./.venv/bin/python3
Starting Pylance language server.
> conda --version
microsoft/debugpy

Answer questions int19h

Looking at setup.py for that package, it is set up to cythonize all the .py files by default:

https://github.com/samuelcolvin/pydantic/blob/bf9cc4a5e7903ada2e819a63fe2da011f292a143/setup.py#L86-L92

This would make them native code, and thus not something that debugpy can trace. But, as a workaround, you should be able to build that package with SKIP_CYTHON=1, and then it should work. Can you give that a try?

useful!

Related questions

No questions were found.
source:https://uonfu.com/
Github User Rank List