Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for pydevd debugging of modules #75

Merged

Conversation

briandealwis
Copy link
Member

This PR builds on #74 and adds support for debugging Python modules (e.g., python -m flask) with pydevd. Just look at ef3a44a

pydevd ... --file xxx expects the --file argument to be a file. This patch causes the python launcher to create a small launch script that uses Python's runpy support to launch the module.

@etanshaul
Copy link

curious in general - does VSC already support debugging modules (via ptvsd/debugpy)?

@etanshaul
Copy link

LGTM. review became easy after you showed the command sequence above. just a comment to add those details somewhere as a comment in the code.

switch {
case len(args) == 0:
return "", nil, fmt.Errorf("no python command-line specified") // shouldn't happen
case !strings.HasPrefix(args[0], "-"):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if it's something like python -[some-other-flag] app.py? is this not valid? In that case it wouldn't be recognized as a file

Copy link

@etanshaul etanshaul May 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if I update my entrypoint to this ENTRYPOINT ["python", "-E", "app.py"] debug suddenly breaks (it works without the -E flag. And non-debug mode works with either.

Copy link

@etanshaul etanshaul May 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update: I may have been wrong here. running another test. will update this comment
update 2: nevermind, looks like my observation above was correct.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does break. That's going to be more involved — I'll do tackle it as a follow-up.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sg.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#76

@briandealwis briandealwis merged commit 76f0d56 into GoogleContainerTools:duct-tape May 19, 2021
@briandealwis briandealwis deleted the pydevd-modules branch May 19, 2021 02:12
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.

2 participants