Rename ptvsd -> debugpy.

This commit is contained in:
Pavel Minaev 2020-01-14 19:54:50 -08:00
parent 2731604433
commit 8b4c40e922
744 changed files with 581 additions and 532 deletions

View file

@ -1,12 +1,12 @@
[run]
branch = True
include =
src/ptvsd/*
src/debugpy/*
omit =
src/ptvsd/__init__.py
src/ptvsd/_version.py
src/ptvsd/_vendored/*
src/ptvsd/server/*
src/debugpy/__init__.py
src/debugpy/_version.py
src/debugpy/_vendored/*
src/debugpy/server/*
data_file = coverage/.coverage
[report]
@ -29,7 +29,7 @@ exclude_lines =
[html]
directory = coverage/html
title = ptvsd coverage report
title = debugpy coverage report
[xml]
output = coverage/coverage.xml

View file

@ -10,4 +10,4 @@ exclude =
build,
dist,
versioneer.py,
src/ptvsd/_vendored/pydevd
src/debugpy/_vendored/pydevd

2
.gitattributes vendored
View file

@ -1 +1 @@
ptvsd/_version.py export-subst
debugpy/_version.py export-subst

View file

@ -1,6 +0,0 @@
[MESSAGES CONTROL]
# Disable
disable=C,R,
attribute-defined-outside-init,
redefined-builtin,
unused-argument

View file

@ -1,5 +1,5 @@
sonar.sources=src/ptvsd
sonar.exclusions=src/ptvsd/_vendored/**/*,src/ptvsd/_version.py
sonar.sources=src/debugpy
sonar.exclusions=src/debugpy/_vendored/**/*,src/debugpy/_version.py
sonar.cfamily.build-wrapper-output.bypass=true
sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-

View file

@ -1,6 +1,9 @@
This project has adopted the [Microsoft Open Source Code of
Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct
FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com)
with any additional questions or comments.
# Microsoft Open Source Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
Resources:
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns

View file

@ -1,4 +1,4 @@
# Contributing to `ptvsd`
# Contributing to `debugpy`
[![Build Status](https://ptvsd.visualstudio.com/_apis/public/build/definitions/557bd35a-f98d-4c49-9bc9-c7d548f78e4d/1/badge)](https://ptvsd.visualstudio.com/ptvsd/ptvsd%20Team/_build/index?definitionId=1)
[![Build Status](https://travis-ci.org/Microsoft/ptvsd.svg?branch=master)](https://travis-ci.org/Microsoft/ptvsd)
@ -15,55 +15,77 @@ When you submit a pull request, a CLA-bot will automatically determine whether y
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.
### Prerequisites
Use [tests/requirements.txt](tests/requirements.txt) file to install the packages needed to run tests:
```console
pip install -r tests/requirements.txt
## Development tools
The following tools are required to work on debugpy:
- At least one version of [Python 3](https://www.python.org/downloads/)
- [Python 2.7](https://www.python.org/downloads/release/python-2717/) (to run tests)
- [Flake8](http://flake8.pycqa.org/en/stable/)
- [Black](https://black.readthedocs.io/en/stable/)
- [tox](https://tox.readthedocs.io/en/latest/)
We recommend using [Visual Studio Code](https://code.visualstudio.com/) with the (Python extension)[https://marketplace.visualstudio.com/items?itemName=ms-python.python] to work on debugpy, but it's not a requirement. A workspace file, [debugpy.code-workspace], is provided for the convenience of VSCode users, and sets it up to use the other tools listed above properly.
Tools that are Python packages should be installed via pip corresponding to the Python 3 installation. On Windows:
```
...> py -m pip install black flake8 tox
```
On Linux or macOS:
```
...$ python3 -m pip install black flake8 tox
```
### Linting
We use `flake8` for linting, and the settings can be found here [flake8](.flake8)
### Formatting
This is optional. Use the following settings for `autopep8` or equivalent settings with the formatter of your choice:
VSC Python settings for formating:
```json
"python.formatting.provider": "autopep8",
"python.formatting.autopep8Args": [
"--ignore", "E24,E121,E123,E125,E126,E221,E226,E266,E704,E265,E722,E501,E731,E306,E401,E302,E222"
],
## Linting
We use Flake8 for linting. It should be run from the root of the repository, where [.flake8](.flake8) with project-specific linting settings is located. On Windows:
```
...\debugpy> py -m flake8
```
On Linux or macOS:
```
.../debugpy$ python3 -m flake8
```
### Running tests
We are currently migrating the tests to use `pytest`. Please run both set of tests. Newer tests must go into the [tests](tests) directory. Use [test_requirements.txt](test_requirements.txt) to install packages needed to run the tests.
#### Windows
## Formatting
We use Black for formatting. All new code files, and all code files that were edited, should be reformatted before submitting a PR. On Windows:
```
C:\> git clone https://github.com/Microsoft/ptvsd
C:\> cd ptvsd
C:\ptvsd> py -3.7 -m pip install -r test_requirements.txt
C:\ptvsd> py -3.7 -m pytest -v
...\debugpy> py -m black
```
#### Linux\Mac
On Linux or macOS:
```
~: git clone https://github.com/Microsoft/ptvsd
~: cd ptvsd
~/ptvsd: python3 -m pip install -r ./test_requirements.txt
~/ptvsd: python3 -m pytest -v
.../debugpy$ python3 -m black
```
## Running tests
### Debug in VSC using development version
Set `PYTHONPATH` to point to cloned version of ptvsd, in `launch.json`, to debug any python project to test the debugger you are working on:
```json
We use tox to run tests in an isolated environment. This ensures that debugpy is first built as a package, and tox also takes care of installing all the test prerequisites into the environment. On Windows:
```
...\debugpy> py -m tox
```
On Linux or macOS:
```
.../debugpy$ python3 -m tox
```
This will perform a full run with the default settings. A full run will run tests on Python 2.7 and 3.5-3.8, and requires all of those to be installed. If some versions are missing, or it is desired to skip them for a particular run, tox can be directed to only run tests on specific versions with `-e`. In addition, the `--developer` option can be used to skip the packaging step, running tests directly against the source code in `src/debugpy`. This should only be used when iterating on the code, and a proper run should be performed before submitting a PR. On Windows:
```
...\debugpy> py -m tox -e py27,py37 --develop
```
On Linux or macOS:
```
.../debugpy$ python3 -m tox -e py27,py37 --develop
```
### Running tests without tox
While tox is the recommended way to run the test suite, pytest can also be invoked directly from the root of the repository. This requires packages in tests/test_requirements.txt to be installed first.
## Using modified debugpy in Visual Studio Code
To test integration between debugpy and Visual Studio Code, the latter can be directed to use a custom version of debugpy in lieu of the one bundled with the Python extension. This is done by specifying `"debugAdapterPath"` in `launch.json` - it must point at the root directory of the *package*, which is `src/debugpy` inside the repository:
```json5
{
"name": "Terminal (integrated)",
"type": "python",
"request": "launch",
"pythonPath": "${config:python.pythonPath}",
"program": "${file}",
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"env": {"PYTHONPATH":"C:\\GIT\\ptvsd"},
"internalConsoleOptions": "neverOpen",
},
"debugAdapterPath": ".../debugpy/src/debugpy",
...
}
```

View file

@ -1,3 +1,3 @@
The Python Visual Studio Debugger engine implements the Visual Studio Code debug protocol and is used as the debug engine in Visual Studio and Visual Studio Code.
debugpy is an implementation of the Debug Adapter Protocol for Python.
The source code and the issue tracker is [hosted on GitHub](https://github.com/Microsoft/ptvsd/).
The source code and the issue tracker is [hosted on GitHub](https://github.com/microsoft/debugpy/).

View file

@ -1,4 +1,4 @@
ptvsd
debugpy
Copyright (c) Microsoft Corporation
All rights reserved.

View file

@ -2,4 +2,4 @@ include LICENSE
include DESCRIPTION.md
global-exclude *.py[cdo]
include versioneer.py
include src/ptvsd/_version.py
include src/debugpy/_version.py

View file

@ -1,72 +1,72 @@
# Python Tools for Visual Studio debug server
# debugpy - a debugger for Python
[![Build Status](https://ptvsd.visualstudio.com/_apis/public/build/definitions/557bd35a-f98d-4c49-9bc9-c7d548f78e4d/1/badge)](https://ptvsd.visualstudio.com/ptvsd/ptvsd%20Team/_build/index?definitionId=1)
[![Build Status](https://travis-ci.org/Microsoft/ptvsd.svg?branch=master)](https://travis-ci.org/Microsoft/ptvsd)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=microsoft_ptvsd&metric=coverage)](https://sonarcloud.io/dashboard?id=microsoft_ptvsd)
[![GitHub](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://raw.githubusercontent.com/Microsoft/ptvsd/master/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/ptvsd.svg)](https://pypi.org/project/ptvsd/)
[![PyPI](https://img.shields.io/pypi/pyversions/ptvsd.svg)](https://pypi.org/project/ptvsd/)
[![Build Status](https://travis-ci.org/microsoft/debugpy.svg?branch=master)](https://travis-ci.org/microsoft/debugpy)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=microsoft_debugpy&metric=coverage)](https://sonarcloud.io/dashboard?id=microsoft_debugpy)
[![GitHub](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://raw.githubusercontent.com/microsoft/debugpy/master/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/debugpy.svg)](https://pypi.org/project/debugpy/)
[![PyPI](https://img.shields.io/pypi/pyversions/debugpy.svg)](https://pypi.org/project/debugpy/)
This debugger is based on the Debug Adapter Protocol for VS Code: [debugProtocol.json](https://github.com/Microsoft/vscode-debugadapter-node/blob/master/debugProtocol.json)
This debugger implements the Debug Adapter Protocol: [debugProtocol.json](https://github.com/Microsoft/vscode-debugadapter-node/blob/master/debugProtocol.json)
## `ptvsd` CLI Usage
## `debugpy` CLI Usage
### Debugging a script file
To run a script file with debugging enabled, but without waiting for the debugger to attach (i.e. code starts executing immediately):
To run a script file with debugging enabled, but without waiting for the IDE to attach (i.e. code starts executing immediately):
```console
-m ptvsd --host localhost --port 5678 myfile.py
-m debugpy --host localhost --port 5678 myfile.py
```
To wait until the debugger attaches before running your code, use the `--wait` switch.
To wait until the IDE attaches before running your code, use the `--wait` switch.
```console
-m ptvsd --host localhost --port 5678 --wait myfile.py
-m debugpy --host localhost --port 5678 --wait myfile.py
```
The `--host` option specifies the interface on which the debug server is listening for connections. To be able to attach from another machine, make sure that the server is listening on a public interface - using `0.0.0.0` will make it listen on all available interfaces:
```console
-m ptvsd --host 0.0.0.0 --port 5678 myfile.py
-m debugpy --host 0.0.0.0 --port 5678 myfile.py
```
This should only be done on secure networks, since anyone who can connect to the specified port can then execute arbitrary code within the debugged process.
To pass arguments to the script, just specify them after the filename. This works the same as with Python itself - everything up to the filename is processed by ptvsd, but everything after that becomes `sys.argv` of the running process.
To pass arguments to the script, just specify them after the filename. This works the same as with Python itself - everything up to the filename is processed by debugpy, but everything after that becomes `sys.argv` of the running process.
### Debugging a module
To run a module, use the `-m` switch instead of filename:
```console
-m ptvsd --host localhost --port 5678 -m mymodule
-m debugpy --host localhost --port 5678 -m mymodule
```
Same as with scripts, command line arguments can be passed to the module by specifying them after the module name. All other ptvsd switches work identically in this mode; in particular, `--wait` can be used to block execution until the debugger attaches.
Same as with scripts, command line arguments can be passed to the module by specifying them after the module name. All other debugpy switches work identically in this mode; in particular, `--wait` can be used to block execution until the IDE attaches.
### Attaching to a running process by ID
The following command injects the debugger into a process with a given PID that is running Python code. Once the command returns, a ptvsd server is running within the process, as if that process was launched via `-m ptvsd` itself.
The following command injects the debugger into a process with a given PID that is running Python code. Once the command returns, a debugpy server is running within the process, as if that process was launched via `-m debugpy` itself.
```console
-m ptvsd --host localhost --port 5678 --pid 12345
-m debugpy --host localhost --port 5678 --pid 12345
```
## `ptvsd` Import usage
## `debugpy` Import usage
### Enabling debugging
At the beginning of your script, import ptvsd, and call `ptvsd.enable_attach()` to start the debug server. The default hostname is `0.0.0.0`, and the default port is 5678; these can be overridden by passing a `(host, port)` tuple as the first argument of `enable_attach()`.
At the beginning of your script, import debugpy, and call `debugpy.enable_attach()` to start the debug server. The default hostname is `0.0.0.0`, and the default port is 5678; these can be overridden by passing a `(host, port)` tuple as the first argument of `enable_attach()`.
```python
import ptvsd
ptvsd.enable_attach()
import debugpy
debugpy.enable_attach()
...
```
### Waiting for the debugger to attach
Use the `ptvsd.wait_for_attach()` function to block program execution until the debugger is attached.
### Waiting for the IDE to attach
Use the `debugpy.wait_for_attach()` function to block program execution until the IDE is attached.
```python
import ptvsd
ptvsd.enable_attach()
ptvsd.wait_for_attach() # blocks execution until debugger is attached
import debugpy
debugpy.enable_attach()
debugpy.wait_for_attach() # blocks execution until IDE is attached
...
```
### `breakpoint()` function
In Python 3.7 and above, `ptvsd` supports the standard `breakpoint()` function. Use `ptvsd.break_into_debugger()` function for similar behavior and compatibility with older versions of Python (3.6 and below). If the debugger is attached when either of these functions is invoked, it will pause execution on the calling line, as if it had a breakpoint set. If there's no debugger attached, the functions do nothing, and the code continues to execute normally.
In Python 3.7 and above, `debugpy` supports the standard `breakpoint()` function. Use `debugpy.break_into_debugger()` function for similar behavior and compatibility with older versions of Python (3.6 and below). If the debugger is attached when either of these functions is invoked, it will pause execution on the calling line, as if it had a breakpoint set. If there's no IDE attached, the functions do nothing, and the code continues to execute normally.
```python
import ptvsd
ptvsd.enable_attach()
import debugpy
debugpy.enable_attach()
while True:
...
breakpoint() # or ptvsd.break_into_debugger() on <3.7
breakpoint() # or debugpy.break_into_debugger() on <3.7
...
```
@ -103,7 +103,7 @@ while True:
],
"pathMappings": [
{
"localRoot": "C:\\Project\\src", // Local root (where source and debugger running)
"localRoot": "C:\\Project\\src", // Local root (where the IDE is running)
"remoteRoot": "/home/smith/proj" // Remote root (where remote code is running)
},
// Add more path mappings
@ -115,15 +115,15 @@ while True:
To enable debugger internal logging via CLI, the `--log-dir` switch can be used:
```console
-m ptvsd --log-dir path/to/logs ...
-m debugpy --log-dir path/to/logs ...
```
When using `enable_attach`, the same can be done with `log_dir` argument:
```py
ptvsd.enable_attach(log_dir='path/to/logs')
debugpy.enable_attach(log_dir='path/to/logs')
```
In both cases, the environment variable `PTVSD_LOG_DIR` can also be set to the same effect.
In both cases, the environment variable `DEBUGPY_LOG_DIR` can also be set to the same effect.
When logging is enabled, ptvsd will create a log file with a name `ptvsd-<pid>.log` in the specified directory, where `<pid>` is the ID of the process being debugged. When subprocess debugging is enabled, a separate log is created for every subprocess.
When logging is enabled, debugpy will create several log files with names matching `debugpy*.log` in the specified directory, corresponding to different components of the debugger. When subprocess debugging is enabled, separate logs are created for every subprocess.

41
SECURITY.md Normal file
View file

@ -0,0 +1,41 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.3 BLOCK -->
## Security
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets Microsoft's [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)) of a security vulnerability, please report it to us as described below.
## Reporting Security Issues
**Please do not report security vulnerabilities through public GitHub issues.**
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue
This information will help us triage your report more quickly.
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.
## Preferred Languages
We prefer all communications to be in English.
## Policy
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
<!-- END MICROSOFT SECURITY.MD BLOCK -->

View file

@ -1,24 +1,15 @@
# Troubleshooting
If you're having trouble with the Debugger package for Visual Studio and VS Code, check below for information which
may help. If something isn't covered here, please file an issue with the information given
in [Filing an issue](#filing-an-issue).
If you're having trouble with debugpy, check below for information which may help. If something isn't covered here, please file an issue with the information given in [Filing an issue](#filing-an-issue).
## Known Issues
There are a few known issues in the current version of the debugger:
### 1. Multiprocessing on Linux/Mac
Multiprocess debugging on a Linux machine requires the `spawn` setting. We are working on improving this experience, see [#943](https://github.com/Microsoft/ptvsd/issues/943). Meanwhile do this to improve your debugging experience:
```py
import multiprocessing
multiprocessing.set_start_method('spawn', True)
```
Note: On Windows, the `multiprocessing` package uses "spawn" as the default and only option, so it is recommended for cross-platform code to ensure uniform behavior. If you choose to use `spawn` you may have to structure your `__main__` module like this https://docs.python.org/3/library/multiprocessing.html#the-spawn-and-forkserver-start-methods.
### 2. Breakpoints not set
### Breakpoints not set
If you receive an error saying **breakpoint not set**, then look at your path mappings in `launch.json`. See Meta-Issue [#2976](https://github.com/Microsoft/vscode-python/issues/2976) for more details.
### 3. Debugging Library Files
### Debugging Library Files
If you want to debug library files, you have to disable `justMyCode` in `launch.json`. Previously this setting was `debugStdLib`. For example:
```js
{
@ -37,5 +28,5 @@ If you want to debug library files, you have to disable `justMyCode` in `launch.
When filing an issue, make sure you do the following:
- Check existing issues for the same problem (also see the "Known Issues" section above for widespread problems).
- Follow instructions in [this](https://github.com/Microsoft/ptvsd/blob/master/.github/ISSUE_TEMPLATE/bug_report.md) template for filing a bug report.
- Include any debugger logs that you may have. See [here](https://github.com/Microsoft/ptvsd#debugger-logging) for instructions on how to enable logging.
- Follow instructions in [this](https://github.com/microsoft/debugpy/blob/master/.github/ISSUE_TEMPLATE/bug_report.md) template for filing a bug report.
- Include any debugger logs that you may have. See [here](https://github.com/microsoft/debugpy#debugger-logging) for instructions on how to enable logging.

View file

@ -15,7 +15,7 @@
"**/*.pyc": true,
"**/__pycache__": true,
".tox": true,
"src/ptvsd.egg-info": true,
"src/debugpy.egg-info": true,
},
"python.testing.pytestEnabled": true,
},

View file

@ -6,10 +6,10 @@ _Debuggee process_ - the process that is being debugged.
_IDE_ - VSCode or other DAP client.
_Debug server_ - pydevd with ptvsd wrapper; hosted inside the debuggee process,
_Debug server_ - pydevd with debugpy wrapper; hosted inside the debuggee process,
one for each.
_Debug adapter_ - ptvsd adapter that mediates between IDE and server.
_Debug adapter_ - debugpy adapter that mediates between IDE and server.
_IDE listener port_ - port opened by the adapter, on which it listens for incoming
connections from the IDE.
@ -117,7 +117,7 @@ Adapter -->>- IDE: confirm "disconnect" from Debuggee_1
## "attach" scenario
1. User starts debuggee process with debug server in it (ptvsd command line or `ptvsd.enable_attach()`).
1. User starts debuggee process with debug server in it (debugpy command line or `debugpy.enable_attach()`).
1. User starts debugging (F5) with "attach" debug config.
1. User code spawns child process.
1. User disconnects from debuggee.

View file

@ -1,16 +1,16 @@
Building manylinux1 wheels
1. Clone ptvsd to base dir (say `C:\git`), so ptvsd source must be at `C:\git\ptvsd`.
2. Create dir `dist` under `C:\git\dist`.
3. Run following command:
* x86_64: `docker run --rm -v C:\git:/io -w /io quay.io/pypa/manylinux1_x86_64:latest /io/ptvsd/linux/build_plat.sh /io/ptvsd /io/dist cp37-cp37m`
* i686: `docker run --rm -v C:\git:/io -w /io quay.io/pypa/manylinux1_i686:latest /io/ptvsd/linux/build_plat.sh /io/ptvsd /io/dist cp37-cp37m`
1. Clone debugpy to a base directory (say `C:\git`), giving debugpy repository at `C:\git\debugpy`.
2. Create dir `dist` under `C:\debugpy\dist`.
3. Run the following command:
* x86_64: `docker run --rm -v C:\git:/io -w /io quay.io/pypa/manylinux1_x86_64:latest /io/debugpy/linux/build_plat.sh /io/debugpy /io/dist cp37-cp37m`
* i686: `docker run --rm -v C:\git:/io -w /io quay.io/pypa/manylinux1_i686:latest /io/debugpy/linux/build_plat.sh /io/debugpy/io/dist cp37-cp37m`
4. After the run the built wheel should be in `C:\git\dist`.
Other python ABI options:
* cp27-cp27m
* cp27-cp27mu
* cp34-cp34m
* cp35-cp35m
* cp36-cp36m
* cp37-cp37m
* cp38-cp38m

View file

@ -35,7 +35,7 @@ Get-ChildItem $dist\*.whl, $dist\*.zip | Remove-Item -Force
& $_ setup.py bdist_wheel -d "$dist" --universal
}
Get-ChildItem $dist\ptvsd-*.whl, $dist\*.zip | ForEach-Object{
Get-ChildItem $dist\debugpy-*.whl, $dist\*.zip | ForEach-Object{
Write-Host "Built wheel found at $_"
}
}

View file

@ -25,7 +25,7 @@ if (-not $pack) {
& $_ -m pip install -U pip
& $_ -m pip install -U pyfindvs setuptools wheel cython
Push-Location "$root\..\..\src\ptvsd\_vendored\pydevd"
Push-Location "$root\..\..\src\debugpy\_vendored\pydevd"
& $_ setup_cython.py enable_msbuildcompiler build_ext -b "$bin" -t "$obj"
Pop-Location
}
@ -35,7 +35,7 @@ if (-not $pack) {
(Get-ChildItem $packages\python* -Directory -Filter $filter) | ForEach-Object{ Get-Item $_\tools\python.exe } | Where-Object{ Test-Path $_ } | Select-Object -last 1 | ForEach-Object{
Write-Host "Building wheel with $_ for platform."
& $_ setup.py build -b "$bin" -t "$obj" bdist_wheel -d "$dist" -p "$platform" --abi
Get-ChildItem $dist\ptvsd-*.whl | ForEach-Object{
Get-ChildItem $dist\debugpy-*.whl | ForEach-Object{
Write-Host "Built wheel found at $_"
}
}

View file

@ -1,6 +1,6 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RootPath>$(MSBuildThisFileDirectory)\..\..\src\ptvsd\</RootPath>
<RootPath>$(MSBuildThisFileDirectory)\..\..\src\debugpy\</RootPath>
</PropertyGroup>
<PropertyGroup Condition="$(BUILD_BINARIESDIRECTORY) != ''">

View file

@ -10,7 +10,7 @@ exclude = '''
( __pycache__
| ^/.tox
| ^/versioneer.py
| ^/src/ptvsd/_vendored
| ^/src/ptvsd/_version.py
| ^/src/debugpy/_vendored
| ^/src/debugpy/_version.py
)
'''

View file

@ -4,10 +4,10 @@ license_file = LICENSE
[versioneer]
VCS = git
style = pep440
versionfile_source = src/ptvsd/_version.py
versionfile_build = ptvsd/_version.py
versionfile_source = src/debugpy/_version.py
versionfile_build = debugpy/_version.py
tag_prefix = v
parentdir_prefix = ptvsd-
parentdir_prefix = debugpy-
[aliases]
test=pytest

View file

@ -29,14 +29,14 @@ import versioneer # noqa
del sys.path[0]
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "src"))
import ptvsd
import ptvsd._vendored
import debugpy
import debugpy._vendored
del sys.path[0]
PYDEVD_ROOT = ptvsd._vendored.project_root("pydevd")
PTVSD_ROOT = os.path.dirname(os.path.abspath(ptvsd.__file__))
PYDEVD_ROOT = debugpy._vendored.project_root("pydevd")
DEBUGBY_ROOT = os.path.dirname(os.path.abspath(debugpy.__file__))
def get_buildplatform():
@ -61,8 +61,8 @@ def iter_vendored_files():
# Add pydevd files as data files for this package. They are not
# treated as a package of their own, because we don't actually
# want to provide pydevd - just use our own copy internally.
for project in ptvsd._vendored.list_all():
for filename in ptvsd._vendored.iter_packaging_files(project):
for project in debugpy._vendored.list_all():
for filename in debugpy._vendored.iter_packaging_files(project):
yield filename
@ -95,20 +95,19 @@ if __name__ == "__main__":
extras["platforms"] = platforms
setup(
name="ptvsd",
name="debugpy",
version=versioneer.get_version(),
description="Remote debugging server for Python support in Visual Studio and Visual Studio Code", # noqa
description="An implementation of the Debug Adapter Protocol for Python", # noqa
long_description=long_description,
long_description_content_type="text/markdown",
license="MIT",
author="Microsoft Corporation",
author_email="ptvshelp@microsoft.com",
url="https://aka.ms/ptvs",
python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*",
python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
@ -119,16 +118,16 @@ if __name__ == "__main__":
],
package_dir={"": "src"},
packages=[
"ptvsd",
"ptvsd.adapter",
"ptvsd.common",
"ptvsd.launcher",
"ptvsd.server",
"ptvsd._vendored",
"debugpy",
"debugpy.adapter",
"debugpy.common",
"debugpy.launcher",
"debugpy.server",
"debugpy._vendored",
],
package_data={
"ptvsd": ["ThirdPartyNotices.txt"],
"ptvsd._vendored": list(iter_vendored_files()),
"debugpy": ["ThirdPartyNotices.txt"],
"debugpy._vendored": list(iter_vendored_files()),
},
cmdclass=cmds,
**extras

View file

@ -1,5 +1,5 @@
sonar.sources=src/ptvsd
sonar.exclusions=src/ptvsd/_vendored/**/*,src/ptvsd/_version.py
sonar.sources=src/debugpy
sonar.exclusions=src/debugpy/_vendored/**/*,src/debugpy/_version.py
sonar.cfamily.build-wrapper-output.bypass=true
sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-

View file

@ -2,7 +2,7 @@
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
Do Not Translate or Localize
Ptvsd incorporates third party material from the projects listed below.
debugpy incorporates third party material from the projects listed below.
1. PyDev.Debugger (https://github.com/fabioz/PyDev.Debugger)
@ -20,7 +20,7 @@ Ptvsd incorporates third party material from the projects listed below.
%% PyDev.Debugger NOTICES, INFORMATION, AND LICENSE BEGIN HERE
=========================================
The source code for the PyDev.Debugger files are provided with ptvsd, or you may send a check or money order for US $5.00, including the product name (ptvsd), the open source component name (PyDev.Debugger) and version number, to: Source Code Compliance Team, Microsoft Corporation, One Microsoft Way, Redmond, WA 98052, USA.
The source code for the PyDev.Debugger files are provided with debugpy, or you may send a check or money order for US $5.00, including the product name (debugpy), the open source component name (PyDev.Debugger) and version number, to: Source Code Compliance Team, Microsoft Corporation, One Microsoft Way, Redmond, WA 98052, USA.
Eclipse Public License, Version 1.0 (EPL-1.0)
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.

View file

@ -23,10 +23,10 @@ __all__ = [
import codecs
import os
from ptvsd import _version
from debugpy import _version
# Expose ptvsd.server API from subpackage, but do not actually import it unless
# Expose debugpy.server API from subpackage, but do not actually import it unless
# and until a member is invoked - we don't want the server package loaded in the
# adapter, the tests, or setup.py.
@ -42,7 +42,7 @@ def wait_for_attach():
wait_for_attach.cancel().
"""
from ptvsd.server import api
from debugpy.server import api
return api.wait_for_attach()
@ -57,11 +57,11 @@ def enable_attach(address, log_dir=None, multiprocess=True):
If specified, log_dir must be a path to some existing directory;
the debugger will then create its log files in that directory.
A separate log file is created for every process, to accommodate
scenarios involving multiple processes. The log file for a process
with process ID <pid> will be named "ptvsd_<pid>.log".
Separate log files are created for every process, to accommodate
scenarios involving multiple processes. All generated log files
have names starting with "debugpy.", and extension ".log".
If multiprocess is true, ptvsd will also intercept child processes
If multiprocess is true, debugpy will also intercept child processes
spawned by this process, inject a debug server into them, and
configure it to attach to the same IDE before the child process
starts running any user code.
@ -76,7 +76,7 @@ def enable_attach(address, log_dir=None, multiprocess=True):
IDE connects.
"""
from ptvsd.server import api
from debugpy.server import api
return api.enable_attach(address, log_dir)
@ -91,11 +91,11 @@ def attach(address, log_dir=None, multiprocess=True):
If specified, log_dir must be a path to some existing directory;
the debugger will then create its log files in that directory.
A separate log file is created for every process, to accommodate
scenarios involving multiple processes. The log file for a process
with process ID <pid> will be named "ptvsd_<pid>.log".
Separate log files are created for every process, to accommodate
scenarios involving multiple processes. All generated log files
have names starting with "debugpy.", and extension ".log".
If multiprocess is true, ptvsd will also intercept child processes
If multiprocess is true, debugpy will also intercept child processes
spawned by this process, inject a debug server into them, and
configure it to attach to the same IDE before the child process
starts running any user code.
@ -104,7 +104,7 @@ def attach(address, log_dir=None, multiprocess=True):
established.
"""
from ptvsd.server import api
from debugpy.server import api
return api.attach(address, log_dir)
@ -113,7 +113,7 @@ def is_attached():
"""True if an IDE is connected to the debug server in this process.
"""
from ptvsd.server import api
from debugpy.server import api
return api.is_attached()
@ -123,20 +123,20 @@ def break_into_debugger():
breaks into the debugger with current thread as active.
"""
from ptvsd.server import api
from debugpy.server import api
return api.break_into_debugger()
def debug_this_thread():
"""Tells debugger to start tracing the current thread.
"""Tells debugpy to start tracing the current thread.
Must be called on any background thread that is started by means
other than the usual Python APIs (i.e. the "threading" module),
for breakpoints to work on that thread.
"""
from ptvsd.server import api
from debugpy.server import api
return api.debug_this_thread()
@ -149,7 +149,7 @@ def tracing(should_trace=None):
If debugger is not attached, this function has no effect.
This function can also be used in a with-statement to automatically save
and then restore the previous tracing setting::
with ptvsd.tracing(False):
with debugpy.tracing(False):
# Tracing disabled
...
# Tracing restored
@ -158,7 +158,7 @@ def tracing(should_trace=None):
should_trace : bool, optional
Whether to enable or disable tracing.
"""
from ptvsd.server import api
from debugpy.server import api
return api.tracing(should_trace)
@ -169,5 +169,5 @@ __version__ = _version.get_versions()["version"]
__file__ = os.path.abspath(__file__)
# Preload encodings that we're going to use to avoid import deadlocks on Python 2,
# before importing anything from ptvsd.
# before importing anything from debugpy.
map(codecs.lookup, ["ascii", "utf8", "utf-8", "latin1", "latin-1", "idna", "hex"])

View file

@ -12,34 +12,34 @@ __file__ = os.path.abspath(__file__)
if __name__ == "__main__":
# ptvsd can also be invoked directly rather than via -m. In this case, the first
# debugpy can also be invoked directly rather than via -m. In this case, the first
# entry on sys.path is the one added automatically by Python for the directory
# containing this file. This means that import ptvsd will not work, since we need
# the parent directory of ptvsd/ to be in sys.path, rather than ptvsd/ itself.
# containing this file. This means that import debugpy will not work, since we need
# the parent directory of debugpy/ to be in sys.path, rather than debugpy/ itself.
#
# The other issue is that many other absolute imports will break, because they
# will be resolved relative to ptvsd/ - e.g. `import debugger` will then try
# to import ptvsd/debugger.py.
# will be resolved relative to debugpy/ - e.g. `import debugger` will then try
# to import debugpy/debugger.py.
#
# To fix both, we need to replace the automatically added entry such that it points
# at parent directory of ptvsd/ instead of ptvsd/ itself, import ptvsd with that
# at parent directory of debugpy/ instead of debugpy/ itself, import debugpy with that
# in sys.path, and then remove the first entry entry altogether, so that it doesn't
# affect any further imports we might do. For example, suppose the user did:
#
# python /foo/bar/ptvsd ...
# python /foo/bar/debugpy ...
#
# At the beginning of this script, sys.path will contain "/foo/bar/ptvsd" as the
# first entry. What we want is to replace it with "/foo/bar', then import ptvsd
# At the beginning of this script, sys.path will contain "/foo/bar/debugpy" as the
# first entry. What we want is to replace it with "/foo/bar', then import debugpy
# with that in effect, and then remove the replaced entry before any more
# code runs. The imported ptvsd module will remain in sys.modules, and thus all
# code runs. The imported debugpy module will remain in sys.modules, and thus all
# future imports of it or its submodules will resolve accordingly.
if "ptvsd" not in sys.modules:
if "debugpy" not in sys.modules:
# Do not use dirname() to walk up - this can be a relative path, e.g. ".".
sys.path[0] = sys.path[0] + "/../"
import ptvsd # noqa
import debugpy # noqa
del sys.path[0]
from ptvsd.server import cli
from debugpy.server import cli
cli.main()

View file

@ -13,7 +13,7 @@ from . import _util
VENDORED_ROOT = os.path.dirname(os.path.abspath(__file__))
# TODO: Move the "pydevd" git submodule to the ptvsd/_vendored directory
# TODO: Move the "pydevd" git submodule to the debugpy/_vendored directory
# and then drop the following fallback.
if 'pydevd' not in os.listdir(VENDORED_ROOT):
VENDORED_ROOT = os.path.dirname(VENDORED_ROOT)
@ -34,7 +34,7 @@ def project_root(project):
"""Return the path the root dir of the vendored project.
If "project" is an empty string then the path prefix for vendored
projects (e.g. "ptvsd/_vendored/") will be returned.
projects (e.g. "debugpy/_vendored/") will be returned.
"""
if not project:
project = ''
@ -56,7 +56,7 @@ def iter_project_files(project, relative=False, **kwargs):
def iter_packaging_files(project):
"""Yield the filenames for all files in the project.
The filenames are relative to "ptvsd/_vendored". This is most
The filenames are relative to "debugpy/_vendored". This is most
useful for the "package data" in a setup.py.
"""
# TODO: Use default filters? __pycache__ and .pyc?

View file

@ -44,18 +44,17 @@ preimport('pydevd', [
])
# When pydevd is imported it sets the breakpoint behavior, but it needs to be
# overridden because the pydevd version will connect to the remote debugger by
# default, but without using the ptvsd protocol (so, we need to use the ptvsd
# API to handle things as expected by the debug adapter).
# overridden because by default pydevd will connect to the remote debugger using
# its own custom protocol rather than DAP.
import pydevd # noqa
import ptvsd # noqa
import debugpy # noqa
def ptvsd_breakpointhook():
ptvsd.break_into_debugger()
def debugpy_breakpointhook():
debugpy.break_into_debugger()
pydevd.install_breakpointhook(ptvsd_breakpointhook)
pydevd.install_breakpointhook(debugpy_breakpointhook)
# Ensure that pydevd uses JSON protocol
from _pydevd_bundle import pydevd_constants

Some files were not shown because too many files have changed in this diff Show more