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
21 changes: 13 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,14 @@ Using `pydevd_log.debug` you can add logging just about anywhere in the pydevd c

## Updating pydevd

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.
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

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

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

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

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.

To do this, you would:

- python subrepo.py branch -m "pydevd branch you want to create"
- git push -f https://github.com/fabioz/PyDev.Debugger subrepo/src/debugpy/_vendored/pydevd:$(pydevd branch you want to create)
- Create a PR from that branch
- Get Fabio's buyoff on the changes

### Setting up pydevd to be testable

Follow these steps to get pydevd testable:

- git clone https://github.com/fabioz/PyDev.Debugger (or using your own fork)
- copy all of your changes from src/debugpy/_vendored/pydevd to the root of your PyDev.Debugger clone
- remove the pdb files (pydevd doesn't ship those) if you rebuilt the attach dlls
- 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).
- set PYTHONPATH=. (make sure you don't forget this part, otherwise a lot of tests will fail)

Expand Down
13 changes: 13 additions & 0 deletions src/debugpy/_vendored/pydevd/.github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: [fabioz]
patreon: fabioz
#open_collective: # Replace with a single Open Collective username
#ko_fi: # Replace with a single Ko-fi username
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
#liberapay: # Replace with a single Liberapay username
#issuehunt: # Replace with a single IssueHunt username
#otechie: # Replace with a single Otechie username
#lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: [https://www.pydev.org/about.html] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Build the cython extensions (to check that we don't crash when they're there in debug mode).
python setup_pydevd_cython.py build_ext --inplace

curl -L https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz -o Python-3.8.3.tgz
tar -xzf Python-3.8.3.tgz
cd Python-3.8.3
mkdir debug
cd debug
../configure --with-pydebug
make

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
./python get-pip.py

./python -m pip install "pytest"
./python -m pip install "psutil"
./python -m pip install "untangle"

# Check that it worked.
./python -c "import pytest"
./python -c "import psutil"
./python -c "import untangle"

cd ..
cd ..
ls -la

./Python-3.8.3/debug/python -c "import sys;assert hasattr(sys,'gettotalrefcount')"

cd tests_python

# Although we compiled cython, all we're checking is that we don't crash (since it was built for the release env).
../Python-3.8.3/debug/python -m pytest test_debugger_json.py -k "test_case_json_change_breaks or test_remote_debugger_basic"
export PYTHONPATH=..
../Python-3.8.3/debug/python -c "import check_debug_python;check_debug_python.check() "
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Nice reference: https://github.com/tornadoweb/tornado/blob/master/.github/workflows/build.yml
# Docs: https://cibuildwheel.readthedocs.io/en/stable/options/
# Configurations are here and in pyproject.toml.
name: PyDev.Debugger [MANYLINUX] Release

on:
push:
branches:
- "release-pydev-debugger-test"
tags:
- "pydev_debugger_*"

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
steps:
- uses: actions/checkout@v4

# Used to host cibuildwheel
- uses: actions/setup-python@v3

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.21.2

- name: Remove .so files (will be rebuilt)
run: rm pydevd_attach_to_process/*.so

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: pp* cp36-* cp37-*
CIBW_BUILD_VERBOSITY: 1

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

- name: Upload to PyPI .whl
run: |
pip install twine
twine upload wheelhouse/*.whl
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_KEY }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: PyDev.Debugger [Windows, MacOS] Release

on:
push:
branches:
- "release-pydev-debugger-test"
tags:
- "pydev_debugger_*"
env:
DISPLAY: ":99"

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Display Python version
run: python --version

- name: Install common Python deps
run: |
pip install --upgrade pip
pip install wheel "cython>3" setuptools psutil twine --no-warn-script-location

- name: Build cython
env:
PYTHONPATH: .
PYDEVD_USE_CYTHON: yes
run: python build_tools/build.py

- name: Check cython unchanged
env:
PYTHONPATH: .
PYDEVD_USE_CYTHON: yes
run: python build_tools/check_no_git_modifications.py

- name: Create sdist
run: python setup.py sdist bdist_wheel

- uses: actions/upload-artifact@v3
with:
name: dist-${{ matrix.os }}-${{ matrix.python-version }}
path: dist/*

- name: Upload to PyPI .whl
run: twine upload dist/*.whl
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_KEY }}

- name: Upload to PyPI .tar.gz
if: ${{ (matrix.os == 'windows-latest') && (matrix.python-version == '3.9') }}
run: twine upload dist/*.tar.gz
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_KEY }}

Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
name: PyDev.Debugger TESTS

on:
- push
- pull_request

env:
DISPLAY: ":99"

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
name: [
"ubuntu-pypy3",
# "macos-py37-cython", -- misbehaving on github actions
"ubuntu-py38-cython-checkbin",
"windows-py39-cython",
"windows-py310-cython-checkbin",
"windows-py311-cython",
"ubuntu-py311-cython",
"ubuntu-py312-cython-checkbin",
"windows-py312-cython-checkbin",
"ubuntu-py313-cython",
"windows-py313-cython",
]

include:
- name: "ubuntu-pypy3"
python: "pypy3.10"
os: ubuntu-20.04
PYDEVD_USE_CYTHON: NO
# - name: "macos-py37-cython"
# python: "3.7"
# os: macos-latest
# PYDEVD_USE_CYTHON: YES
- name: "ubuntu-py38-cython-checkbin"
python: "3.8"
os: ubuntu-20.04
PYDEVD_USE_CYTHON: YES
- name: "windows-py39-cython"
python: "3.9"
os: windows-latest
PYDEVD_USE_CYTHON: YES
- name: "windows-py310-cython-checkbin"
python: "3.10"
os: windows-latest
PYDEVD_USE_CYTHON: YES
# See: https://github.com/actions/python-versions/releases
- name: "windows-py311-cython"
python: "3.11.0"
os: windows-latest
PYDEVD_USE_CYTHON: YES
- name: "ubuntu-py311-cython"
python: "3.11.0"
os: ubuntu-20.04
PYDEVD_USE_CYTHON: YES
- name: "ubuntu-py312-cython-checkbin"
python: "3.12.0"
os: ubuntu-20.04
PYDEVD_USE_CYTHON: YES
- name: "windows-py312-cython-checkbin"
python: "3.12"
os: windows-latest
PYDEVD_USE_CYTHON: YES
- name: "ubuntu-py313-cython"
python: "3.13"
os: ubuntu-20.04
PYDEVD_USE_CYTHON: YES
- name: "windows-py313-cython"
python: "3.13"
os: windows-latest
PYDEVD_USE_CYTHON: YES

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install gdb/xvfb/ptrace_scope
run: |
sudo apt-get update
sudo apt-get install gdb
sudo sysctl kernel.yama.ptrace_scope=0
sudo apt-get install xvfb
sudo apt-get install libqt5x11extras5
Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 &
if: contains(matrix.name, 'ubuntu')
- name: Install common Python deps
run: |
pip install --upgrade pip
pip install setuptools --no-warn-script-location
pip install wheel --no-warn-script-location
pip install "cython>3" --no-warn-script-location
pip install psutil --no-warn-script-location
pip install numpy --no-warn-script-location
pip install pytest --no-warn-script-location
pip install pytest-xdist --no-warn-script-location
pip install psutil --no-warn-script-location
pip install ipython --no-warn-script-location
pip install untangle --no-warn-script-location
pip install importlib-metadata --no-warn-script-location
- name: Install Python 3.x deps
if: contains(matrix.name, 'py3') && !contains(matrix.name, 'pypy') && !contains(matrix.name, 'py312') && !contains(matrix.name, 'py311') && !contains(matrix.name, 'py313')
run: |
pip install PySide2 --no-warn-script-location
pip install "numpy<2" --force --no-warn-script-location
pip install cherrypy --no-warn-script-location
pip install gevent==23.9.1 greenlet

- name: Install django
if: "!contains(matrix.name, 'py38')"
run: pip install "django<=4.2" --no-warn-script-location

- name: Install Pandas
if: contains(matrix.name, 'py310') && !contains(matrix.name, 'pypy')
# The pandas Styler also requires jinja2.
run: pip install pandas pyarrow jinja2 --no-warn-script-location
- name: Install Pypy 3 deps
if: contains(matrix.name, 'py3')
run: |
pip install trio

- name: Check that wheels can be built
if: contains(matrix.name, 'checkbin') && contains(matrix.name, 'ubuntu')
run: |
python -m pip install setuptools --no-warn-script-location
python -m pip install cibuildwheel==2.21.3
# Remove these .so files (will be rebuilt)
rm pydevd_attach_to_process/*.so
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: cp310-*manylinux*x86_64 cp311-*manylinux*x86_64 cp312-*manylinux*x86_64 cp313-*manylinux*x86_64
CIBW_BUILD_VERBOSITY: 3

- name: Rebuild .so
if: contains(matrix.name, 'checkbin') && contains(matrix.name, 'ubuntu')
run: |
pydevd_attach_to_process/linux_and_mac/compile_linux.sh

- name: Check cython unchanged
if: contains(matrix.name, 'checkbin')
env:
PYTHONPATH: .
run: |
python build_tools/build.py
python build_tools/check_no_git_modifications.py

- name: Create cython binaries
if: contains(matrix.name, 'cython')
run: |
python setup_pydevd_cython.py build_ext --inplace
- name: Check debug
if: contains(matrix.name, 'checkdebug')
run: |
./.github/install_and_run_debug_py.sh
- name: Run Python 3.x tests
env:
# QT_DEBUG_PLUGINS: 1
PYTHONPATH: .
PYDEVD_USE_CYTHON: ${{matrix.PYDEVD_USE_CYTHON }}
run: |
python -m pytest -n auto -rfE

12 changes: 12 additions & 0 deletions src/debugpy/_vendored/pydevd/.gitrepo
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
; DO NOT EDIT (unless you know what you are doing)
;
; This subdirectory is a git "subrepo", and this file is maintained by the
; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme
;
[subrepo]
remote = https://github.com/fabioz/PyDev.Debugger.git
branch = main
commit = cf2e47cbb81a7b4e159f10d56208f4d22ff5423d
parent = 942a2276127598ef84d06b7f7b889281c1047712
method = merge
cmdver = 0.4.9
Loading
Loading