Skip to content

Add debugpy entry point - #1639

Merged
Adam Yoblick (AdamYoblick) merged 4 commits into
mainfrom
add_entry_point
Jul 31, 2024
Merged

Adam Yoblick (AdamYoblick) merged 4 commits into
mainfrom
add_entry_point

Conversation

@AdamYoblick

@AdamYoblick Adam Yoblick (AdamYoblick) commented Jul 25, 2024 •

Copy link
Copy Markdown
Contributor

Fixes #1613

Testing

Scenario 1 - Package is installed in active environment

Windows

  1. I ran the internal debugpy pipeline, pointing the resources at my add_entry_point branch instead of main.
  2. I downloaded the debugpy-1.8.2+12.g853cc05f-cp311-cp311-win_amd64.whl from https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=9942339&view=artifacts&pathAsName=false&type=publishedArtifacts
  3. I installed the wheel by running python -m pip install --no-index --find-links . debugpy
  4. I ran python -m debugpy -V to verify that it installed correctly.
  5. Then I ran debugpy -V to verify that the entry point exists. The output was the same as the previous step, which proves the entry point works.
  6. I also ran debugpy --listen 5678 "C:\Users\advolker\OneDrive - Microsoft\Desktop\pythonTest\infiniteLoop.py" and it ran correctly, which proves args are being passed along.

Linux (WSL)

  1. Install WSL on a devbox using the docs at https://learn.microsoft.com/en-us/windows/wsl/install
  2. Install python 3.10 using sudo apt install python3 python3-pip
  3. Download the wheel from https://devdiv.visualstudio.com/_apis/resources/Containers/18694131/dist?itemPath=dist%2Fdebugpy-1.8.2%2B15.gaaab9932-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  4. Install the wheel using python3 -m pip install --no-index --find-links . debugpy
  5. Add the bin directory to path like this: export PATH=$PATH:/home/advolker/.local/bin
  6. Run debugpy -V and see that it works
  7. I also ran debugpy --listen 5678 ./infiniteLoop.py and it worked.

Scenario 2 - Package is installed in random directory

Windows

  1. I ran the internal debugpy pipeline, pointing the resources at my add_entry_point branch instead of main.
  2. I downloaded the debugpy-1.8.2%2B15.gaaab9932-cp311-cp311-win_amd64.whl from https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=9950165&view=artifacts&pathAsName=false&type=publishedArtifacts
  3. I installed the wheel by running python -m pip install -t .\temp --no-index --find-links . debugpy
  4. I added C:\Users\advolker\OneDrive - Microsoft\Desktop\temp\bin to PATH, like this: SET PATH=%PATH%;C:\Users\advolker\OneDrive - Microsoft\Desktop\temp\bin
    1. This is the directory that contains the entry point (debugpy.exe on Windows)
  5. I added C:\Users\advolker\OneDrive - Microsoft\Desktop\temp to PYTHONPATH, like this: SET PYTHONPATH=%PYTHONPATH%;C:\Users\advolker\OneDrive - Microsoft\Desktop\temp
    1. This is the root directory that the package was installed to
  6. I ran debugpy -V to verify that the entry point works.
  7. I also ran debugpy --listen 5678 "C:\Users\advolker\OneDrive - Microsoft\Desktop\pythonTest\infiniteLoop.py" and it ran correctly.

Linux (WSL)

  1. Install WSL on a devbox using the docs at https://learn.microsoft.com/en-us/windows/wsl/install
  2. Install python 3.10 using sudo apt install python3 python3-pip
  3. Download the wheel from https://devdiv.visualstudio.com/_apis/resources/Containers/18694131/dist?itemPath=dist%2Fdebugpy-1.8.2%2B15.gaaab9932-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  4. Install the wheel using python3 -m pip install -t ./temp --no-index --find-links . debugpy
  5. Add the bin directory to path like this: export PATH=$PATH:/home/advolker/temp/bin
  6. Add the install directory to pythonpath, like this: export PYTHONPATH=$PYTHONPATH:/home/advolker/temp
  7. Run debugpy -V and see that it works
  8. I also ran debugpy --listen 5678 ./infiniteLoop.py and it worked.

@AdamYoblick

Adam Yoblick (AdamYoblick) commented Jul 25, 2024 •

Copy link
Copy Markdown
Contributor Author

Pavel Minaev (@int19h) - Hey Pavel, I tried to do some manual testing of this by running the internal debugpy build, but I'm seeing errors in the Validate wheel tags step that look like this:

##[error]Missing wheel matching cp38-cp38-macosx_11_0_x86_64
debugpy-1.8.2+12.g853cc05f-cp38-cp38-macosx_12_0_x86_64.whl

These errors seem to be random. Note that we've moved up to the macos12 image on the vms (since macos11 is no longer supported). But the MACOSX_DEPLOYMENT_TARGET: "11" env var is still set. Do you have any idea why these tagging steps would randomly fail? I get this warning when building the wheels (only on the steps that fail):

[WARNING] MACOSX_DEPLOYMENT_TARGET is set to a lower value (11.0) than the version on which the Python interpreter was compiled (12.0), and will be ignored.

But like it said, its sporadic, and seems environment dependent. I just don't know what causes it. 😄

edit: I guess since macos 11 is no longer supported by apple, I suppose I can just move the pool to macos-latest and change the MACOSX_DEPLOYMENT_TARGET to 12?

@int19h

Copy link
Copy Markdown
Contributor

Wheel tags on macOS are kind of a mess; see this for the gory details. So basically whether this shows up in tests or not depends on which version of the macOS SDK the Python binary was compiled on.

The reason why this check is there and is treated as an error is so that whenever this happens and you end up getting a wheel for a higher version than what was requested (i.e. what the pool target is), it doesn't just get silently packaged and pushed to PyPI without updating setup.py, docs etc regarding minimum supported macOS version.

AFAIK the only workaround to get working wheels for older versions of macOS is to use an older Python release (i.e. not the latest 3.8.x but say 3.8.0); I don't recall if that is something that can be easily done on the build machines, though. But, yes, given that VSCode itself doesn't support out-of-service macOS versions (https://code.visualstudio.com/docs/supporting/requirements), it's not worth the bother.

@AdamYoblick

Copy link
Copy Markdown
Contributor Author

Thanks for the details, appreciate it. 😀

@AdamYoblick
Adam Yoblick (AdamYoblick) marked this pull request as ready for review July 30, 2024 23:14
@AdamYoblick
Adam Yoblick (AdamYoblick) requested a review from a team as a code owner July 30, 2024 23:14
@AdamYoblick Adam Yoblick (AdamYoblick) changed the title [WIP] Add debugpy entry point Add debugpy entry point Jul 30, 2024
@AdamYoblick

Copy link
Copy Markdown
Contributor Author

Karthik Nadig (@karthiknadig) - Once this is merged in and a new debugpy version is released, here's how to achieve what you're trying to do:

  1. Install the debugpy wheel to any directory using the following: python -m pip install -t <install_dir> --no-index --find-links . debugpy
  2. Set whatever switches you want in the DEBUGPY_EXTRA_ARGV env var
  3. Add <install_dir>\bin to PATH
  4. Add <install_dir> to PYTHONPATH
  5. Run debugpy from any command prompt and it should work.

@AdamYoblick

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a runner to debugpy package

3 participants