Skip to content

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.

@briandealwis briandealwis requested a review from etanshaul May 17, 2021 16:51
@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