From b00a8129977494bd127dd0bfed22082597762a08 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Tue, 5 Aug 2025 20:08:32 +0200 Subject: [PATCH 1/6] pydevd: Fix up prefix of attach shared library for Windows (#1939) Follow-up to #1917, which changed the prefix for Windows. The crux of that contribution was about enabling attaching on Sillicon Mac (in fact, it came from my colleagues at Zed Industries). This however broke .dll lookup per https://github.com/zed-industries/zed/pull/35640#issuecomment-3155624377 --- src/debugpy/_vendored/pydevd/pydevd_tracing.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/debugpy/_vendored/pydevd/pydevd_tracing.py b/src/debugpy/_vendored/pydevd/pydevd_tracing.py index 41135d7d..09b3dc44 100644 --- a/src/debugpy/_vendored/pydevd/pydevd_tracing.py +++ b/src/debugpy/_vendored/pydevd/pydevd_tracing.py @@ -250,7 +250,9 @@ def get_python_helper_lib_filename(): else: suffix = suffix_32 - if IS_WINDOWS or IS_MAC: # just the extension changes + if IS_WINDOWS: # just the extension changes + prefix = "attach_" + elif IS_MAC: prefix = "attach" suffix = "" elif IS_LINUX: # From 2eb3afede0dd5b3c6229a2b8849efbfa18b3e078 Mon Sep 17 00:00:00 2001 From: timrid <6593626+timrid@users.noreply.github.com> Date: Tue, 12 Aug 2025 22:25:06 +0200 Subject: [PATCH 2/6] Check if `os.__file__` is available before using it (#1944) * check if os.file is available before using it * use threading.__file__ als last fallback --- .../_vendored/pydevd/_pydevd_bundle/pydevd_filtering.py | 3 ++- src/debugpy/_vendored/pydevd/pydevd_file_utils.py | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_filtering.py b/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_filtering.py index c0cf3954..0f35b8ca 100644 --- a/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_filtering.py +++ b/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_filtering.py @@ -155,7 +155,8 @@ def _get_default_library_roots(cls): # Make sure we always get at least the standard library location (based on the `os` and # `threading` modules -- it's a bit weird that it may be different on the ci, but it happens). - roots.append(os.path.dirname(os.__file__)) + if hasattr(os, "__file__"): + roots.append(os.path.dirname(os.__file__)) roots.append(os.path.dirname(threading.__file__)) if IS_PYPY: # On PyPy 3.6 (7.3.1) it wrongly says that sysconfig.get_path('stdlib') is diff --git a/src/debugpy/_vendored/pydevd/pydevd_file_utils.py b/src/debugpy/_vendored/pydevd/pydevd_file_utils.py index 390f903c..7ca38344 100644 --- a/src/debugpy/_vendored/pydevd/pydevd_file_utils.py +++ b/src/debugpy/_vendored/pydevd/pydevd_file_utils.py @@ -88,7 +88,14 @@ def _get_library_dir(): break if library_dir is None or not os_path_exists(library_dir): - library_dir = os.path.dirname(os.__file__) + if hasattr(os, "__file__"): + # "os" is a frozen import an thus "os.__file__" is not always set. + # See https://github.com/python/cpython/pull/28656 + library_dir = os.path.dirname(os.__file__) + else: + # "threading" is not a frozen import an thus "threading.__file__" is always set. + import threading + library_dir = os.path.dirname(threading.__file__) return library_dir From 6cbdf8767e4c88dfaedf3db7b09ce2781496fc51 Mon Sep 17 00:00:00 2001 From: Bill Schnurr Date: Fri, 5 Sep 2025 09:14:53 -0700 Subject: [PATCH 3/6] update testing for python 3.14 (#1955) * update testing for python 3.14 * Allow python 3.14 in attach code * move 3.14 to its own job outside of matrix * try 3.14.0-rc.2 * allowUnstable * use 3.14.0-rc.2 but use 3.14 in tests --- CONTRIBUTING.md | 2 +- azure-pipelines/pipelines.yaml | 6 ++++++ azure-pipelines/templates/run_tests.yml | 16 ++++++++++++---- azure-pipelines/templates/use_python.yml | 1 + setup.py | 18 +++++++++--------- .../common/py_version.hpp | 4 ++++ tox.ini | 6 +++--- 7 files changed, 36 insertions(+), 17 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e25104d5..89197fa0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -114,7 +114,7 @@ In order to update the source, you would: You might need to regenerate the Cython modules after any changes. This can be done by: -- Install Python latest (3.12 as of this writing) +- Install Python latest (3.14 as of this writing) - pip install cython 'django>=1.9' 'setuptools>=0.9' 'wheel>0.21' twine - On a windows machine: - set FORCE_PYDEVD_VC_VARS=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat diff --git a/azure-pipelines/pipelines.yaml b/azure-pipelines/pipelines.yaml index 19612651..f041cf23 100644 --- a/azure-pipelines/pipelines.yaml +++ b/azure-pipelines/pipelines.yaml @@ -135,6 +135,8 @@ stages: python.version: 3.12 py313: python.version: 3.13 + py314: + python.version: 3.14.0-rc.2 steps: @@ -178,6 +180,8 @@ stages: python.version: 3.12 py313: python.version: 3.13 + py314: + python.version: 3.14.0-rc.2 steps: @@ -224,6 +228,8 @@ stages: python.version: 3.12 py313: python.version: 3.13 + py314: + python.version: 3.14.0-rc.2 steps: diff --git a/azure-pipelines/templates/run_tests.yml b/azure-pipelines/templates/run_tests.yml index 2efca201..475b6ff9 100644 --- a/azure-pipelines/templates/run_tests.yml +++ b/azure-pipelines/templates/run_tests.yml @@ -3,11 +3,19 @@ steps: displayName: Setup Python packages - pwsh: | - $toxEnv = '$(python.version)' - if (-not $toxEnv.startsWith('pypy')) { - $toxEnv = 'py' + $toxEnv.Replace('.', '') + $raw = '$(python.version)' + if ($raw.StartsWith('pypy')) { + # For PyPy keep original pattern stripping dots after first two numeric components if needed later. + $toxEnv = 'py' + ($raw -replace '^pypy(\d+)\.(\d+).*$','$1$2') } - echo 'tox environment: $toxEnv' + else { + # Extract major.minor even from prerelease like 3.14.0-rc.2 -> 3.14 + $mm = [regex]::Match($raw,'^(\d+)\.(\d+)') + if (-not $mm.Success) { throw "Unable to parse python.version '$raw'" } + $toxEnv = 'py' + $mm.Groups[1].Value + $mm.Groups[2].Value + } + Write-Host "python.version raw: $raw" + Write-Host "Derived tox environment: $toxEnv" python -m tox -e $toxEnv -- --junitxml=$(Build.ArtifactStagingDirectory)/tests.xml --debugpy-log-dir=$(Build.ArtifactStagingDirectory)/logs tests displayName: Run tests using tox env: diff --git a/azure-pipelines/templates/use_python.yml b/azure-pipelines/templates/use_python.yml index 78afa755..ecb69656 100644 --- a/azure-pipelines/templates/use_python.yml +++ b/azure-pipelines/templates/use_python.yml @@ -3,4 +3,5 @@ steps: inputs: versionSpec: $(python.version) architecture: $(architecture) + allowUnstable: true displayName: Use Python $(python.version) $(architecture) diff --git a/setup.py b/setup.py index 2c4b9b8e..570c6992 100644 --- a/setup.py +++ b/setup.py @@ -78,14 +78,12 @@ def finalize_options(self): "Compiling pydevd Cython extension modules (set SKIP_CYTHON_BUILD=1 to omit)." ) try: - subprocess.check_call( - [ - sys.executable, - os.path.join(PYDEVD_ROOT, "setup_pydevd_cython.py"), - "build_ext", - "--inplace", - ] - ) + subprocess.check_call([ + sys.executable, + os.path.join(PYDEVD_ROOT, "setup_pydevd_cython.py"), + "build_ext", + "--inplace", + ]) except subprocess.SubprocessError: # pydevd Cython extensions are optional performance enhancements, and debugpy is # usable without them. Thus, we want to ignore build errors here by default, so @@ -170,6 +168,8 @@ def tail_is(*suffixes): "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Topic :: Software Development :: Debuggers", "Operating System :: Microsoft :: Windows", "Operating System :: MacOS", @@ -202,5 +202,5 @@ def tail_is(*suffixes): "debugpy-adapter = debugpy.adapter.__main__:main", ], }, - **extras + **extras, ) diff --git a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_version.hpp b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_version.hpp index 712684cf..15c05537 100644 --- a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_version.hpp +++ b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/py_version.hpp @@ -24,6 +24,7 @@ enum PythonVersion { PythonVersion_311 = 0x030B, PythonVersion_312 = 0x030C, PythonVersion_313 = 0x030D, + PythonVersion_314 = 0x030E, }; @@ -78,6 +79,9 @@ static PythonVersion GetPythonVersion(void *module) { if(version[3] == '3'){ return PythonVersion_313; } + if(version[3] == '4'){ + return PythonVersion_314; + } } return PythonVersion_Unknown; // we don't care about 3.1 anymore... diff --git a/tox.ini b/tox.ini index 6a0d21eb..2a5ea04a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{38,39,310,311,312,313}{,-cov} +envlist = py{38,39,310,311,312,313,314}{,-cov} [testenv] deps = -rtests/requirements.txt @@ -10,5 +10,5 @@ commands_pre = python build_attach_binaries.py commands = py{38,39}-!cov: python -m pytest {posargs} py{38,39}-cov: python -m pytest --cov --cov-append --cov-config=.coveragerc {posargs} - py{310,311,312,313}-!cov: python -Xfrozen_modules=off -m pytest {posargs} - py{310,311,312,313}-cov: python -Xfrozen_modules=off -m pytest --cov --cov-append --cov-config=.coveragerc {posargs} + py{310,311,312,313,314}-!cov: python -Xfrozen_modules=off -m pytest {posargs} + py{310,311,312,313,314}-cov: python -Xfrozen_modules=off -m pytest --cov --cov-append --cov-config=.coveragerc {posargs} From 82e409e88311aced08885fc9ec19f8e077e5b00e Mon Sep 17 00:00:00 2001 From: lev-blit <47675736+lev-blit@users.noreply.github.com> Date: Wed, 1 Oct 2025 19:09:28 +0300 Subject: [PATCH 4/6] include py.typed in the distributed package (#1960) --- setup.py | 2 +- src/debugpy/py.typed | 0 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 src/debugpy/py.typed diff --git a/setup.py b/setup.py index 570c6992..e01f675a 100644 --- a/setup.py +++ b/setup.py @@ -186,7 +186,7 @@ def tail_is(*suffixes): "debugpy._vendored", ], package_data={ - "debugpy": ["ThirdPartyNotices.txt"], + "debugpy": ["ThirdPartyNotices.txt", "py.typed"], "debugpy._vendored": [ # pydevd extensions must be built before this list can be computed properly, # so it is populated in the overridden build_py.finalize_options(). diff --git a/src/debugpy/py.typed b/src/debugpy/py.typed new file mode 100644 index 00000000..e69de29b From 275caca690ed67c0e94959fe0963e6ef6b14d6b5 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Mon, 1 Dec 2025 23:28:08 +0530 Subject: [PATCH 5/6] Add gcc flags (#1947) --- .../pydevd_attach_to_process/linux_and_mac/compile_linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/compile_linux.sh b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/compile_linux.sh index 37204f50..97cab104 100755 --- a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/compile_linux.sh +++ b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/compile_linux.sh @@ -8,4 +8,4 @@ case $ARCH in esac SRC="$(dirname "$0")/.." -g++ -std=c++11 -shared -fPIC -O2 -D_FORTIFY_SOURCE=2 -nostartfiles --stack-protector-strong $SRC/linux_and_mac/attach.cpp -o $SRC/attach_linux_$SUFFIX.so +g++ -std=c++11 -shared -fPIC -O2 -D_FORTIFY_SOURCE=2 -nostartfiles -fstack-protector-strong $SRC/linux_and_mac/attach.cpp -o $SRC/attach_linux_$SUFFIX.so From 8f13145a2358ad0f28ef6316fcfa318822789793 Mon Sep 17 00:00:00 2001 From: Bill Schnurr Date: Mon, 1 Dec 2025 10:17:06 -0800 Subject: [PATCH 6/6] Add pyrx-admins as code owners (#1976) * Add pyrx-admins as code owners * Combine CODEOWNERS entries into a single line --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index fc45c872..7091b2aa 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -4,4 +4,4 @@ # in the repository, i.e. bar/baz will match /bar/baz and /foo/bar/baz. # The default owners for everything that is not overridden by specific patterns below. -* @microsoft/debugpy-CodeReviewers +* @microsoft/debugpy-CodeReviewers @microsoft/pyrx-admins