Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Add json-dap command line and debug options #1461

Merged
merged 2 commits into from
May 23, 2019

Conversation

karthiknadig
Copy link
Member

Fixes #1460

@karthiknadig karthiknadig requested review from fabioz and int19h May 23, 2019 02:17
Copy link
Contributor

@fabioz fabioz left a comment

Choose a reason for hiding this comment

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

Seeing this review got me thinking a bit about how we want to approach having pydevd out of process...

I think we'll want to keep the ptvsd namespace for users (for the current public API), so, a part of ptvsd will still be builtin into the same process pydevd and could use pydevd in the namespace and that could be a good place to customize what we need without needing to add arguments nor environment variables.

So, maybe a better approach could be:

Create a pydevd_defaults.py module which would be the place for flags we want to customize (right next to pydevd_constants.py) with:

from _pydevd_bundle.pydevd_constants import QUOTED_LINE_PROTOCOL

class PydevdCustomization(object):
    DEFAULT_PROTOCOL = QUOTED_LINE_PROTOCOL

and in the PyDB constructor, instead of checking the environment variable, just do:

PyDevdAPI().set_protocol(self, PydevdCustomization.DEFAULT_PROTOCOL)

and in force_pydevd.py

PydevdCustomization.DEFAULT_PROTOCOL = JSON_PROTOCOL

In that case we wouldn't need the handling of the arguments nor the environment variable... what do you think?

src/ptvsd/_vendored/pydevd/pydevd.py Outdated Show resolved Hide resolved
src/ptvsd/_vendored/pydevd/pydevd.py Outdated Show resolved Hide resolved
@karthiknadig
Copy link
Member Author

@fabioz I like the idea using pydevd_defaults.py, i don't like the environment variable approach here. I will switch to that. But I also feel --json-dap should be supported. There are several other debugger options enabled this way. Given this is fundamental part of how pydevd will work going forward I feel it is a must have.

@karthiknadig
Copy link
Member Author

The 2.7 failure on windows seems to be the result of tox 3.12.0 that was released today. Likely there will be a patch.

py27
GLOB sdist-make: D:\a\1\s\setup.py
Traceback (most recent call last):
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\site-packages\tox\__main__.py", line 4, in <module>
    tox.cmdline()
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\site-packages\tox\session\__init__.py", line 44, in cmdline
    main(args)
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\site-packages\tox\session\__init__.py", line 68, in main
    exit_code = session.runcommand()
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\site-packages\tox\session\__init__.py", line 192, in runcommand
    return self.subcommand_test()
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\site-packages\tox\session\__init__.py", line 208, in subcommand_test
    venv.package = self.hook.tox_package(session=self, venv=venv)
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\site-packages\pluggy\hooks.py", line 289, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\site-packages\pluggy\manager.py", line 68, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\site-packages\pluggy\manager.py", line 62, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\site-packages\pluggy\callers.py", line 208, in _multicall
    return outcome.get_result()
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\site-packages\pluggy\callers.py", line 81, in get_result
    _reraise(*ex)  # noqa
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\site-packages\pluggy\callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\site-packages\tox\package\__init__.py", line 16, in tox_package
    session.package, session.dist = get_package(session)
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\site-packages\tox\package\__init__.py", line 29, in get_package
    package = acquire_package(config, session)
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\site-packages\tox\package\__init__.py", line 40, in acquire_package
    path = build_package(config, session)
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\site-packages\tox\package\builder\__init__.py", line 7, in build_package
    return make_sdist(config, session)
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\site-packages\tox\package\builder\legacy.py", line 29, in make_sdist
    returnout=True,
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\site-packages\tox\action.py", line 93, in popen
    else 0
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\subprocess.py", line 390, in __init__
    errread, errwrite)
  File "C:\hostedtoolcache\windows\Python\2.7.14\x64\lib\subprocess.py", line 640, in _execute_child
    startupinfo)
TypeError: environment can only contain strings

@karthiknadig karthiknadig merged commit 9a263f9 into microsoft:master May 23, 2019
@karthiknadig karthiknadig deleted the issue1460 branch July 1, 2019 18:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove usage of CMD_SET_PROTOCOL
2 participants