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

Enable sub process debugging for Flask and Django as the default behaviour #3473

Closed
DonJayamanne opened this issue Nov 27, 2018 · 10 comments
Closed
Assignees
Labels
area-debugging feature-request Request for new features or functionality

Comments

@DonJayamanne
Copy link

No description provided.

@DonJayamanne DonJayamanne added area-debugging needs PR important Issue identified as high-priority feature-request Request for new features or functionality labels Nov 27, 2018
@DonJayamanne DonJayamanne changed the title Enable sub process debugging for Flask and Django Enable sub process debugging for Flask and Django as the default behaivior Nov 27, 2018
@brettcannon
Copy link
Member

microsoft/vscode#62972

@brettcannon brettcannon changed the title Enable sub process debugging for Flask and Django as the default behaivior Enable sub process debugging for Flask and Django as the default behaviour Jan 11, 2019
@d3r3kk d3r3kk removed this from the 2019, week 3 - Jan Sprint 2 milestone Jan 17, 2019
@luabud luabud removed the important Issue identified as high-priority label Mar 12, 2019
@DonJayamanne
Copy link
Author

DonJayamanne commented Apr 10, 2019

Prescribed solution:

Update src\client\debugger\extension\configuration\providers\djangoLaunch.ts. Line 33

  • Remove noreload for Django and flask
  • Enable subProcess as true as the default setting in code (also if not already provided in launch.json)
  • Document subProcess setting on VS Cod docs

@DonJayamanne
Copy link
Author

DonJayamanne commented Aug 16, 2019

Prescribed solution:

  • Use the PR https://github.com/microsoft/vscode-python/pull/5856/files
  • The default value for subprocess passed to the debugger should be an experiment:
    • Currently this is hardcoded. The value will need to be based on an experiment.
  • See here for values of experiment
  • This will be possible only if users get the new debug adapter (I.e. live reloading will be used with the new debug adatper).

Question:

  • If user has enabled subprocess, should they fall into the experiment?

@DonJayamanne DonJayamanne removed their assignment Aug 16, 2019
@ericsnowcurrently ericsnowcurrently removed this from the 2019 - August Sprint 16 milestone Sep 16, 2019
@jarshwah
Copy link

It's not clear to me if this should currently work by updating the launch file to use subprocess = true. Is an experiment running that allows that to work?

@brettcannon
Copy link
Member

@jarshwah #5856 has not landed yet, so it's not a fully supported thing yet. But if you look at the PR you can see what settings to flip and see if it works for your use-case.

@luabud
Copy link
Member

luabud commented Nov 6, 2019

Let's not change launch.json, configuration will be modified under the hood. Log that information in the output channel.
Use django, jinja, flask, pyramid as markers.

@luabud
Copy link
Member

luabud commented Nov 6, 2019

In the config resolver, check if user is in live reload and new debug adapter experiment, and if any of the launch.configs are detected (django, jinja etc), then add subprocess=true to the in memory config and remove --no-reload/noreload (whatever it is for django or flask) from the args. For flask, also remove --no-debugger. All changes are in https://github.com/microsoft/vscode-python/blob/master/src/client/debugger/extension/configuration/resolvers/launch.ts.

Also add telemetry for when this configuration is changed internally.

@karthiknadig
Copy link
Member

To validate this, ensure that you are in DebugAdapterFactory - experiment, PtvsdWheels37 - experiment, and Reload - experiment.

Run a flask app, using the following configuration:

{
      "name": "Python: Flask",
      "type": "python",
      "request": "launch",
      "module": "flask",
      "console": "integratedTerminal",
      "env": {
        "FLASK_APP": "app.py",
        "FLASK_ENV": "development",
        "FLASK_DEBUG": "0"
      },
      "args": [
        "run",
        "--no-reload"
      ],
      "jinja": true
    }

Make sure that the --no-reload is removed from the command line. Also, ensure that the logs contain before and after version of the debug configuration.

@ericsnowcurrently
Copy link
Member

(on master) I was able to verify that the launch config is getting updated.

However, it doesn't actually debug anything. I'm guessing this is due to that problem with ptvsd not resolving properly when running the extension through VS Code.

@karthiknadig
Copy link
Member

That is correct. This is validated then.

@ghost ghost removed the needs PR label Nov 21, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Nov 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-debugging feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

8 participants