From cce0ceeeb325116c8e69142d08f36f5513867f0e Mon Sep 17 00:00:00 2001 From: bschnurr Date: Thu, 4 Sep 2025 10:20:56 -0700 Subject: [PATCH 1/6] update testing for python 3.14 --- CONTRIBUTING.md | 2 +- azure-pipelines/pipelines.yaml | 6 ++++++ setup.py | 18 +++++++++--------- tox.ini | 6 +++--- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e25104d5a..89197fa08 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 196126510..6f477fd88 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 steps: @@ -178,6 +180,8 @@ stages: python.version: 3.12 py313: python.version: 3.13 + py314: + python.version: 3.14 steps: @@ -224,6 +228,8 @@ stages: python.version: 3.12 py313: python.version: 3.13 + py314: + python.version: 3.14 steps: diff --git a/setup.py b/setup.py index 2c4b9b8eb..570c6992d 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/tox.ini b/tox.ini index 6a0d21eba..2a5ea04a2 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 547b72f3fd72f3eb7ca03ff5ff30869b25c0b2f9 Mon Sep 17 00:00:00 2001 From: bschnurr Date: Thu, 4 Sep 2025 10:41:38 -0700 Subject: [PATCH 2/6] Allow python 3.14 in attach code --- .../pydevd/pydevd_attach_to_process/common/py_version.hpp | 4 ++++ 1 file changed, 4 insertions(+) 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 712684cf3..15c05537c 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... From 3ce850520f10b9514868d642146482cefe7d32f8 Mon Sep 17 00:00:00 2001 From: bschnurr Date: Thu, 4 Sep 2025 10:51:49 -0700 Subject: [PATCH 3/6] move 3.14 to its own job outside of matrix --- azure-pipelines/pipelines.yaml | 81 +++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 6 deletions(-) diff --git a/azure-pipelines/pipelines.yaml b/azure-pipelines/pipelines.yaml index 6f477fd88..82d6dc205 100644 --- a/azure-pipelines/pipelines.yaml +++ b/azure-pipelines/pipelines.yaml @@ -14,6 +14,13 @@ pr: include: - '*' +# Parameter to optionally include hosted Python 3.14 in matrices once images support it. +parameters: + - name: includeHostedPy314 + type: boolean + default: false + # Set to true after hosted agents list Python 3.14 in software inventory. + variables: architecture: x64 PYDEVD_ATTACH_TO_PROCESS: src/debugpy/_vendored/pydevd/pydevd_attach_to_process @@ -135,8 +142,9 @@ stages: python.version: 3.12 py313: python.version: 3.13 - py314: - python.version: 3.14 + ${{ if eq(parameters.includeHostedPy314, true) }}: + py314: + python.version: 3.14 steps: @@ -162,6 +170,65 @@ stages: - template: templates/run_tests.yml + # Experimental Python 3.14 job (Linux only) until hosted agents include 3.14. + # Uses official python:3.14 (or rc) container image so we don't need system preinstall. + - job: Tests_Linux_Py314_Experimental + displayName: Tests - Linux (py314 experimental) + timeoutInMinutes: 45 + pool: + vmImage: ubuntu-latest + container: python:3.14-rc + continueOnError: true # Allow pipeline success even if experimental version fails + variables: + python.version: 3.14 + steps: + - script: | + echo "Python in container:" && python --version + python -m pip install -U pip + displayName: Initialize Python 3.14 + + # Optional: install gdb & enable ptrace for tests needing debugger attach (keep lightweight) + - script: | + apt-get update + apt-get --yes install gdb + sysctl kernel.yama.ptrace_scope=0 || true + displayName: (Optional) Enable gdb / ptrace + continueOnError: true + + - download: current + displayName: Download pydevd binaries + artifact: pydevd binaries + + - task: CopyFiles@2 + displayName: Copy pydevd binaries + inputs: + SourceFolder: $(Pipeline.Workspace)/pydevd binaries + TargetFolder: $(Build.SourcesDirectory)/$(PYDEVD_ATTACH_TO_PROCESS) + + - script: | + python -m pip install tox + echo "tox environment: py314" + python -m tox -e py314 -- --junitxml=$(Build.ArtifactStagingDirectory)/tests.xml --debugpy-log-dir=$(Build.ArtifactStagingDirectory)/logs tests + displayName: Run tests (py314 experimental) + env: + DEBUGPY_PROCESS_SPAWN_TIMEOUT: 60 + DEBUGPY_LAUNCH_TIMEOUT: 60 + + - task: PublishBuildArtifacts@1 + displayName: Publish test logs (py314 experimental) + inputs: + artifactName: Test logs py314 + pathToPublish: $(Build.ArtifactStagingDirectory)/logs + condition: failed() + + - task: PublishTestResults@2 + displayName: Publish test results (py314 experimental) + inputs: + testRunTitle: $(Agent.JobName) + testResultsFiles: tests.xml + searchFolder: $(Build.ArtifactStagingDirectory) + condition: always() + - job: Tests_Mac timeoutInMinutes: 30 displayName: Tests - macOS @@ -180,8 +247,9 @@ stages: python.version: 3.12 py313: python.version: 3.13 - py314: - python.version: 3.14 + ${{ if eq(parameters.includeHostedPy314, true) }}: + py314: + python.version: 3.14 steps: @@ -228,8 +296,9 @@ stages: python.version: 3.12 py313: python.version: 3.13 - py314: - python.version: 3.14 + ${{ if eq(parameters.includeHostedPy314, true) }}: + py314: + python.version: 3.14 steps: From 31676b887a71067f3373e85b6cceb8b462d9d9a8 Mon Sep 17 00:00:00 2001 From: bschnurr Date: Thu, 4 Sep 2025 14:23:08 -0700 Subject: [PATCH 4/6] try 3.14.0-rc.2 --- azure-pipelines/pipelines.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/pipelines.yaml b/azure-pipelines/pipelines.yaml index 82d6dc205..5c6bb8216 100644 --- a/azure-pipelines/pipelines.yaml +++ b/azure-pipelines/pipelines.yaml @@ -142,9 +142,8 @@ stages: python.version: 3.12 py313: python.version: 3.13 - ${{ if eq(parameters.includeHostedPy314, true) }}: - py314: - python.version: 3.14 + py314: + python.version: 3.14.0-rc.2 steps: From 8c297c9a57c61417210cb30abe19264782e00bdb Mon Sep 17 00:00:00 2001 From: bschnurr Date: Thu, 4 Sep 2025 16:33:31 -0700 Subject: [PATCH 5/6] allowUnstable --- azure-pipelines/templates/use_python.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/templates/use_python.yml b/azure-pipelines/templates/use_python.yml index 78afa7558..ecb69656c 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) From 1fe4d4e5efa133a2cc890bed61d95db93c6db884 Mon Sep 17 00:00:00 2001 From: bschnurr Date: Thu, 4 Sep 2025 17:03:53 -0700 Subject: [PATCH 6/6] use 3.14.0-rc.2 but use 3.14 in tests --- azure-pipelines/pipelines.yaml | 76 ++----------------------- azure-pipelines/templates/run_tests.yml | 16 ++++-- 2 files changed, 16 insertions(+), 76 deletions(-) diff --git a/azure-pipelines/pipelines.yaml b/azure-pipelines/pipelines.yaml index 5c6bb8216..f041cf236 100644 --- a/azure-pipelines/pipelines.yaml +++ b/azure-pipelines/pipelines.yaml @@ -14,13 +14,6 @@ pr: include: - '*' -# Parameter to optionally include hosted Python 3.14 in matrices once images support it. -parameters: - - name: includeHostedPy314 - type: boolean - default: false - # Set to true after hosted agents list Python 3.14 in software inventory. - variables: architecture: x64 PYDEVD_ATTACH_TO_PROCESS: src/debugpy/_vendored/pydevd/pydevd_attach_to_process @@ -169,65 +162,6 @@ stages: - template: templates/run_tests.yml - # Experimental Python 3.14 job (Linux only) until hosted agents include 3.14. - # Uses official python:3.14 (or rc) container image so we don't need system preinstall. - - job: Tests_Linux_Py314_Experimental - displayName: Tests - Linux (py314 experimental) - timeoutInMinutes: 45 - pool: - vmImage: ubuntu-latest - container: python:3.14-rc - continueOnError: true # Allow pipeline success even if experimental version fails - variables: - python.version: 3.14 - steps: - - script: | - echo "Python in container:" && python --version - python -m pip install -U pip - displayName: Initialize Python 3.14 - - # Optional: install gdb & enable ptrace for tests needing debugger attach (keep lightweight) - - script: | - apt-get update - apt-get --yes install gdb - sysctl kernel.yama.ptrace_scope=0 || true - displayName: (Optional) Enable gdb / ptrace - continueOnError: true - - - download: current - displayName: Download pydevd binaries - artifact: pydevd binaries - - - task: CopyFiles@2 - displayName: Copy pydevd binaries - inputs: - SourceFolder: $(Pipeline.Workspace)/pydevd binaries - TargetFolder: $(Build.SourcesDirectory)/$(PYDEVD_ATTACH_TO_PROCESS) - - - script: | - python -m pip install tox - echo "tox environment: py314" - python -m tox -e py314 -- --junitxml=$(Build.ArtifactStagingDirectory)/tests.xml --debugpy-log-dir=$(Build.ArtifactStagingDirectory)/logs tests - displayName: Run tests (py314 experimental) - env: - DEBUGPY_PROCESS_SPAWN_TIMEOUT: 60 - DEBUGPY_LAUNCH_TIMEOUT: 60 - - - task: PublishBuildArtifacts@1 - displayName: Publish test logs (py314 experimental) - inputs: - artifactName: Test logs py314 - pathToPublish: $(Build.ArtifactStagingDirectory)/logs - condition: failed() - - - task: PublishTestResults@2 - displayName: Publish test results (py314 experimental) - inputs: - testRunTitle: $(Agent.JobName) - testResultsFiles: tests.xml - searchFolder: $(Build.ArtifactStagingDirectory) - condition: always() - - job: Tests_Mac timeoutInMinutes: 30 displayName: Tests - macOS @@ -246,9 +180,8 @@ stages: python.version: 3.12 py313: python.version: 3.13 - ${{ if eq(parameters.includeHostedPy314, true) }}: - py314: - python.version: 3.14 + py314: + python.version: 3.14.0-rc.2 steps: @@ -295,9 +228,8 @@ stages: python.version: 3.12 py313: python.version: 3.13 - ${{ if eq(parameters.includeHostedPy314, true) }}: - py314: - python.version: 3.14 + 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 2efca2012..475b6ff91 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: