') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Merge main changes by rchiodo · Pull Request #1977 · microsoft/debugpy · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand Down
6 changes: 6 additions & 0 deletions azure-pipelines/pipelines.yaml
Original file line numberDiff line numberDiff line change
Expand Up@@ -135,6 +135,8 @@ stages:
python.version: 3.12
py313:
python.version: 3.13
py314:
python.version: 3.14.0-rc.2

steps:

Expand DownExpand Up@@ -178,6 +180,8 @@ stages:
python.version: 3.12
py313:
python.version: 3.13
py314:
python.version: 3.14.0-rc.2

steps:

Expand DownExpand Up@@ -224,6 +228,8 @@ stages:
python.version: 3.12
py313:
python.version: 3.13
py314:
python.version: 3.14.0-rc.2

steps:

Expand Down
16 changes: 12 additions & 4 deletions azure-pipelines/templates/run_tests.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -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:
Expand Down
1 change: 1 addition & 0 deletions azure-pipelines/templates/use_python.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,4 +3,5 @@ steps:
inputs:
versionSpec: $(python.version)
architecture: $(architecture)
allowUnstable: true
displayName: Use Python $(python.version) $(architecture)
20 changes: 10 additions & 10 deletions setup.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand DownExpand Up@@ -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",
Expand All@@ -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().
Expand All@@ -202,5 +202,5 @@ def tail_is(*suffixes):
"debugpy-adapter = debugpy.adapter.__main__:main",
],
},
**extras
**extras,
)
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,6 +24,7 @@ enum PythonVersion {
PythonVersion_311 = 0x030B,
PythonVersion_312 = 0x030C,
PythonVersion_313 = 0x030D,
PythonVersion_314 = 0x030E,
};


Expand DownExpand Up@@ -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...

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
9 changes: 8 additions & 1 deletion src/debugpy/_vendored/pydevd/pydevd_file_utils.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -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

Expand Down
4 changes: 3 additions & 1 deletion src/debugpy/_vendored/pydevd/pydevd_tracing.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -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: #
Expand Down
Empty file addedsrc/debugpy/py.typed
Empty file.
6 changes: 3 additions & 3 deletions tox.ini
Original file line numberDiff line numberDiff line change
@@ -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
Expand All@@ -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}
Loading