Skip to content

Commit a7d5a7e

Browse files
authored
Use subrepo to link to PyDev.Debugger instead of copying it (#1714)
* Remove copy of pydevd and add subrepo script * git subrepo clone https://github.com/fabioz/PyDev.Debugger.git src/debugpy/_vendored/pydevd subrepo: subdir: "src/debugpy/_vendored/pydevd" merged: "7d6e6e68" upstream: origin: "https://github.com/fabioz/PyDev.Debugger.git" branch: "main" commit: "7d6e6e68" git-subrepo: version: "0.4.9" origin: "???" commit: "???" * Add binskim settings to match debugpy * git subrepo clone --force https://github.com/fabioz/PyDev.Debugger.git src/debugpy/_vendored/pydevd subrepo: subdir: "src/debugpy/_vendored/pydevd" merged: "cf2e47cb" upstream: origin: "https://github.com/fabioz/PyDev.Debugger.git" branch: "main" commit: "cf2e47cb" git-subrepo: version: "0.4.9" origin: "???" commit: "???" * Remove unnecessary string test by removing the lambda in pydevd_sys_monitoring * Fix linter * Put back the fix in qt_loaders * Put back binskim flag
1 parent 8ab4ee8 commit a7d5a7e

File tree

89 files changed

+8194
-5387
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+8194
-5387
lines changed

CONTRIBUTING.md

+13-8
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,14 @@ Using `pydevd_log.debug` you can add logging just about anywhere in the pydevd c
103103

104104
## Updating pydevd
105105

106-
Pydevd (at src/debugpy/_vendored/pydevd) is a copy of https://github.com/fabioz/PyDev.Debugger. We do not use a git submodule but instead just copy the source.
106+
Pydevd (at src/debugpy/_vendored/pydevd) is a subrepo of https://github.com/fabioz/PyDev.Debugger. We use the [subrepo](https://github.com/ingydotnet/git-subrepo) to have a copy of pydevd inside of debugpy
107107

108108
In order to update the source, you would:
109-
- Sync to the appropriate commit in a pydevd repo
110-
- Diff this against the src/debugpy/_vendored/pydevd folder, being careful to not remove the edits made in the debugpy version
111-
- Run our tests
112-
- Make any fixes to get the tests to pass (see logging on how to debug)
109+
- git checkout -b "branch name"
110+
- python subrepo.py pull
111+
- git push
112+
- Fix any debugpy tests that are failing as a result of the pull
113+
- Create a PR from your branch
113114

114115
You might need to regenerate the Cython modules after any changes. This can be done by:
115116

@@ -123,13 +124,17 @@ You might need to regenerate the Cython modules after any changes. This can be d
123124

124125
If you've made changes to pydevd (at src/debugpy/_vendored/pydevd), you'll want to push back changes to pydevd so as Fabio makes changes to pydevd we can continue to share updates.
125126

127+
To do this, you would:
128+
129+
- python subrepo.py branch -m "pydevd branch you want to create"
130+
- git push -f https://github.com/fabioz/PyDev.Debugger subrepo/src/debugpy/_vendored/pydevd:$(pydevd branch you want to create)
131+
- Create a PR from that branch
132+
- Get Fabio's buyoff on the changes
133+
126134
### Setting up pydevd to be testable
127135

128136
Follow these steps to get pydevd testable:
129137

130-
- git clone https://github.com/fabioz/PyDev.Debugger (or using your own fork)
131-
- copy all of your changes from src/debugpy/_vendored/pydevd to the root of your PyDev.Debugger clone
132-
- remove the pdb files (pydevd doesn't ship those) if you rebuilt the attach dlls
133138
- create an environment to test. The list of stuff in your environment is outlined [here](https://github.com/fabioz/PyDev.Debugger/blob/6cd4d431e6a794448f33a73857d479149041500a/.github/workflows/pydevd-tests-python.yml#L83).
134139
- set PYTHONPATH=. (make sure you don't forget this part, otherwise a lot of tests will fail)
135140

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# These are supported funding model platforms
2+
3+
github: [fabioz]
4+
patreon: fabioz
5+
#open_collective: # Replace with a single Open Collective username
6+
#ko_fi: # Replace with a single Ko-fi username
7+
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
#liberapay: # Replace with a single Liberapay username
10+
#issuehunt: # Replace with a single IssueHunt username
11+
#otechie: # Replace with a single Otechie username
12+
#lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13+
custom: [https://www.pydev.org/about.html] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Build the cython extensions (to check that we don't crash when they're there in debug mode).
2+
python setup_pydevd_cython.py build_ext --inplace
3+
4+
curl -L https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz -o Python-3.8.3.tgz
5+
tar -xzf Python-3.8.3.tgz
6+
cd Python-3.8.3
7+
mkdir debug
8+
cd debug
9+
../configure --with-pydebug
10+
make
11+
12+
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
13+
./python get-pip.py
14+
15+
./python -m pip install "pytest"
16+
./python -m pip install "psutil"
17+
./python -m pip install "untangle"
18+
19+
# Check that it worked.
20+
./python -c "import pytest"
21+
./python -c "import psutil"
22+
./python -c "import untangle"
23+
24+
cd ..
25+
cd ..
26+
ls -la
27+
28+
./Python-3.8.3/debug/python -c "import sys;assert hasattr(sys,'gettotalrefcount')"
29+
30+
cd tests_python
31+
32+
# Although we compiled cython, all we're checking is that we don't crash (since it was built for the release env).
33+
../Python-3.8.3/debug/python -m pytest test_debugger_json.py -k "test_case_json_change_breaks or test_remote_debugger_basic"
34+
export PYTHONPATH=..
35+
../Python-3.8.3/debug/python -c "import check_debug_python;check_debug_python.check() "
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Nice reference: https://github.com/tornadoweb/tornado/blob/master/.github/workflows/build.yml
2+
# Docs: https://cibuildwheel.readthedocs.io/en/stable/options/
3+
# Configurations are here and in pyproject.toml.
4+
name: PyDev.Debugger [MANYLINUX] Release
5+
6+
on:
7+
push:
8+
branches:
9+
- "release-pydev-debugger-test"
10+
tags:
11+
- "pydev_debugger_*"
12+
13+
jobs:
14+
build:
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-20.04]
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
# Used to host cibuildwheel
24+
- uses: actions/setup-python@v3
25+
26+
- name: Install cibuildwheel
27+
run: python -m pip install cibuildwheel==2.21.2
28+
29+
- name: Remove .so files (will be rebuilt)
30+
run: rm pydevd_attach_to_process/*.so
31+
32+
- name: Build wheels
33+
run: python -m cibuildwheel --output-dir wheelhouse
34+
env:
35+
CIBW_SKIP: pp* cp36-* cp37-*
36+
CIBW_BUILD_VERBOSITY: 1
37+
38+
- uses: actions/upload-artifact@v3
39+
with:
40+
path: ./wheelhouse/*.whl
41+
42+
- name: Upload to PyPI .whl
43+
run: |
44+
pip install twine
45+
twine upload wheelhouse/*.whl
46+
env:
47+
TWINE_USERNAME: __token__
48+
TWINE_PASSWORD: ${{ secrets.TWINE_KEY }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: PyDev.Debugger [Windows, MacOS] Release
2+
3+
on:
4+
push:
5+
branches:
6+
- "release-pydev-debugger-test"
7+
tags:
8+
- "pydev_debugger_*"
9+
env:
10+
DISPLAY: ":99"
11+
12+
jobs:
13+
build:
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [macos-latest, windows-latest]
19+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
20+
steps:
21+
- uses: actions/checkout@v3
22+
- name: Set up Python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Display Python version
28+
run: python --version
29+
30+
- name: Install common Python deps
31+
run: |
32+
pip install --upgrade pip
33+
pip install wheel "cython>3" setuptools psutil twine --no-warn-script-location
34+
35+
- name: Build cython
36+
env:
37+
PYTHONPATH: .
38+
PYDEVD_USE_CYTHON: yes
39+
run: python build_tools/build.py
40+
41+
- name: Check cython unchanged
42+
env:
43+
PYTHONPATH: .
44+
PYDEVD_USE_CYTHON: yes
45+
run: python build_tools/check_no_git_modifications.py
46+
47+
- name: Create sdist
48+
run: python setup.py sdist bdist_wheel
49+
50+
- uses: actions/upload-artifact@v3
51+
with:
52+
name: dist-${{ matrix.os }}-${{ matrix.python-version }}
53+
path: dist/*
54+
55+
- name: Upload to PyPI .whl
56+
run: twine upload dist/*.whl
57+
env:
58+
TWINE_USERNAME: __token__
59+
TWINE_PASSWORD: ${{ secrets.TWINE_KEY }}
60+
61+
- name: Upload to PyPI .tar.gz
62+
if: ${{ (matrix.os == 'windows-latest') && (matrix.python-version == '3.9') }}
63+
run: twine upload dist/*.tar.gz
64+
env:
65+
TWINE_USERNAME: __token__
66+
TWINE_PASSWORD: ${{ secrets.TWINE_KEY }}
67+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
name: PyDev.Debugger TESTS
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
env:
8+
DISPLAY: ":99"
9+
10+
jobs:
11+
build:
12+
runs-on: ${{ matrix.os }}
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
name: [
18+
"ubuntu-pypy3",
19+
# "macos-py37-cython", -- misbehaving on github actions
20+
"ubuntu-py38-cython-checkbin",
21+
"windows-py39-cython",
22+
"windows-py310-cython-checkbin",
23+
"windows-py311-cython",
24+
"ubuntu-py311-cython",
25+
"ubuntu-py312-cython-checkbin",
26+
"windows-py312-cython-checkbin",
27+
"ubuntu-py313-cython",
28+
"windows-py313-cython",
29+
]
30+
31+
include:
32+
- name: "ubuntu-pypy3"
33+
python: "pypy3.10"
34+
os: ubuntu-20.04
35+
PYDEVD_USE_CYTHON: NO
36+
# - name: "macos-py37-cython"
37+
# python: "3.7"
38+
# os: macos-latest
39+
# PYDEVD_USE_CYTHON: YES
40+
- name: "ubuntu-py38-cython-checkbin"
41+
python: "3.8"
42+
os: ubuntu-20.04
43+
PYDEVD_USE_CYTHON: YES
44+
- name: "windows-py39-cython"
45+
python: "3.9"
46+
os: windows-latest
47+
PYDEVD_USE_CYTHON: YES
48+
- name: "windows-py310-cython-checkbin"
49+
python: "3.10"
50+
os: windows-latest
51+
PYDEVD_USE_CYTHON: YES
52+
# See: https://github.com/actions/python-versions/releases
53+
- name: "windows-py311-cython"
54+
python: "3.11.0"
55+
os: windows-latest
56+
PYDEVD_USE_CYTHON: YES
57+
- name: "ubuntu-py311-cython"
58+
python: "3.11.0"
59+
os: ubuntu-20.04
60+
PYDEVD_USE_CYTHON: YES
61+
- name: "ubuntu-py312-cython-checkbin"
62+
python: "3.12.0"
63+
os: ubuntu-20.04
64+
PYDEVD_USE_CYTHON: YES
65+
- name: "windows-py312-cython-checkbin"
66+
python: "3.12"
67+
os: windows-latest
68+
PYDEVD_USE_CYTHON: YES
69+
- name: "ubuntu-py313-cython"
70+
python: "3.13"
71+
os: ubuntu-20.04
72+
PYDEVD_USE_CYTHON: YES
73+
- name: "windows-py313-cython"
74+
python: "3.13"
75+
os: windows-latest
76+
PYDEVD_USE_CYTHON: YES
77+
78+
steps:
79+
- uses: actions/checkout@v1
80+
- name: Set up Python ${{ matrix.python }}
81+
uses: actions/setup-python@v4
82+
with:
83+
python-version: ${{ matrix.python }}
84+
- name: Install gdb/xvfb/ptrace_scope
85+
run: |
86+
sudo apt-get update
87+
sudo apt-get install gdb
88+
sudo sysctl kernel.yama.ptrace_scope=0
89+
sudo apt-get install xvfb
90+
sudo apt-get install libqt5x11extras5
91+
Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 &
92+
if: contains(matrix.name, 'ubuntu')
93+
- name: Install common Python deps
94+
run: |
95+
pip install --upgrade pip
96+
pip install setuptools --no-warn-script-location
97+
pip install wheel --no-warn-script-location
98+
pip install "cython>3" --no-warn-script-location
99+
pip install psutil --no-warn-script-location
100+
pip install numpy --no-warn-script-location
101+
pip install pytest --no-warn-script-location
102+
pip install pytest-xdist --no-warn-script-location
103+
pip install psutil --no-warn-script-location
104+
pip install ipython --no-warn-script-location
105+
pip install untangle --no-warn-script-location
106+
pip install importlib-metadata --no-warn-script-location
107+
- name: Install Python 3.x deps
108+
if: contains(matrix.name, 'py3') && !contains(matrix.name, 'pypy') && !contains(matrix.name, 'py312') && !contains(matrix.name, 'py311') && !contains(matrix.name, 'py313')
109+
run: |
110+
pip install PySide2 --no-warn-script-location
111+
pip install "numpy<2" --force --no-warn-script-location
112+
pip install cherrypy --no-warn-script-location
113+
pip install gevent==23.9.1 greenlet
114+
115+
- name: Install django
116+
if: "!contains(matrix.name, 'py38')"
117+
run: pip install "django<=4.2" --no-warn-script-location
118+
119+
- name: Install Pandas
120+
if: contains(matrix.name, 'py310') && !contains(matrix.name, 'pypy')
121+
# The pandas Styler also requires jinja2.
122+
run: pip install pandas pyarrow jinja2 --no-warn-script-location
123+
- name: Install Pypy 3 deps
124+
if: contains(matrix.name, 'py3')
125+
run: |
126+
pip install trio
127+
128+
- name: Check that wheels can be built
129+
if: contains(matrix.name, 'checkbin') && contains(matrix.name, 'ubuntu')
130+
run: |
131+
python -m pip install setuptools --no-warn-script-location
132+
python -m pip install cibuildwheel==2.21.3
133+
# Remove these .so files (will be rebuilt)
134+
rm pydevd_attach_to_process/*.so
135+
python -m cibuildwheel --output-dir wheelhouse
136+
env:
137+
CIBW_BUILD: cp310-*manylinux*x86_64 cp311-*manylinux*x86_64 cp312-*manylinux*x86_64 cp313-*manylinux*x86_64
138+
CIBW_BUILD_VERBOSITY: 3
139+
140+
- name: Rebuild .so
141+
if: contains(matrix.name, 'checkbin') && contains(matrix.name, 'ubuntu')
142+
run: |
143+
pydevd_attach_to_process/linux_and_mac/compile_linux.sh
144+
145+
- name: Check cython unchanged
146+
if: contains(matrix.name, 'checkbin')
147+
env:
148+
PYTHONPATH: .
149+
run: |
150+
python build_tools/build.py
151+
python build_tools/check_no_git_modifications.py
152+
153+
- name: Create cython binaries
154+
if: contains(matrix.name, 'cython')
155+
run: |
156+
python setup_pydevd_cython.py build_ext --inplace
157+
- name: Check debug
158+
if: contains(matrix.name, 'checkdebug')
159+
run: |
160+
./.github/install_and_run_debug_py.sh
161+
- name: Run Python 3.x tests
162+
env:
163+
# QT_DEBUG_PLUGINS: 1
164+
PYTHONPATH: .
165+
PYDEVD_USE_CYTHON: ${{matrix.PYDEVD_USE_CYTHON }}
166+
run: |
167+
python -m pytest -n auto -rfE
168+

src/debugpy/_vendored/pydevd/.gitrepo

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
; DO NOT EDIT (unless you know what you are doing)
2+
;
3+
; This subdirectory is a git "subrepo", and this file is maintained by the
4+
; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme
5+
;
6+
[subrepo]
7+
remote = https://github.com/fabioz/PyDev.Debugger.git
8+
branch = main
9+
commit = cf2e47cbb81a7b4e159f10d56208f4d22ff5423d
10+
parent = 942a2276127598ef84d06b7f7b889281c1047712
11+
method = merge
12+
cmdver = 0.4.9

0 commit comments

Comments
 (0)