diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0b26190a..95ceadc3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,9 +16,9 @@ a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow th provided by the bot. You will only need to do this once across all repos using our CLA. ### Prerequisites -Use [test_requirements.txt](test_requirements.txt) file to install the packages needed to run tests: +Use [tests/requirements.txt](tests/requirements.txt) file to install the packages needed to run tests: ```console -pip install -r test_requirements.txt +pip install -r tests/requirements.txt ``` ### Linting diff --git a/linux/build_plat.sh b/packaging/linux/build_plat.sh similarity index 100% rename from linux/build_plat.sh rename to packaging/linux/build_plat.sh diff --git a/linux/readme.md b/packaging/linux/readme.md similarity index 100% rename from linux/readme.md rename to packaging/linux/readme.md diff --git a/win/build_all.ps1 b/packaging/win/build_all.ps1 similarity index 100% rename from win/build_all.ps1 rename to packaging/win/build_all.ps1 diff --git a/win/build_plat.ps1 b/packaging/win/build_plat.ps1 similarity index 100% rename from win/build_plat.ps1 rename to packaging/win/build_plat.ps1 diff --git a/win/packages.config b/packaging/win/packages.config similarity index 100% rename from win/packages.config rename to packaging/win/packages.config diff --git a/win/sign.proj b/packaging/win/sign.proj similarity index 100% rename from win/sign.proj rename to packaging/win/sign.proj diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..154f1b3a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,19 @@ +[build-system] +requires = ["wheel", "setuptools"] +build-backend = "setuptools.build_meta" + + +[tool.black] +# TODO: remove exclusions as code is reformatted to conform to the Black style. +# The only exclusions that should remain in the end are _vendored and versioneer. +exclude = ''' +( __pycache__ +| ^/setup.py +| ^/versioneer.py +| ^/src/ptvsd/_vendored +| ^/src/ptvsd/_version.py +| ^/src/ptvsd/common +| ^/src/ptvsd/server +| ^/tests +) +''' diff --git a/src/ptvsd/__init__.py b/src/ptvsd/__init__.py index 125a9a94..42f4e9fa 100644 --- a/src/ptvsd/__init__.py +++ b/src/ptvsd/__init__.py @@ -3,16 +3,23 @@ # for license information. __all__ = [ - '__version__', '__author__', - 'enable_attach', 'wait_for_attach', 'break_into_debugger', 'is_attached', + "__version__", + "attach", + "break_into_debugger", + "debug_this_thread", + "enable_attach", + "is_attached", + "wait_for_attach", ] -# "force_pydevd" must be imported first to ensure (via side effects) -# that the ptvsd-vendored copy of pydevd gets used. -from ._vendored import force_pydevd -from ptvsd.version import __version__, __author__ -from ptvsd.attach_server import ( # noqa +from ._version import get_versions + +__version__ = get_versions()["version"] +del get_versions + + +from ptvsd.server import ( attach, break_into_debugger, debug_this_thread, @@ -20,4 +27,3 @@ from ptvsd.attach_server import ( # noqa is_attached, wait_for_attach, ) -del force_pydevd diff --git a/src/ptvsd/version.py b/src/ptvsd/adapter/__init__.py similarity index 50% rename from src/ptvsd/version.py rename to src/ptvsd/adapter/__init__.py index 8f15cddf..d1a64c66 100644 --- a/src/ptvsd/version.py +++ b/src/ptvsd/adapter/__init__.py @@ -2,8 +2,7 @@ # Licensed under the MIT License. See LICENSE in the project root # for license information. -__author__ = "Microsoft Corporation " +from __future__ import absolute_import, print_function, unicode_literals -from ._version import get_versions -__version__ = get_versions()['version'] -del get_versions + +__all__ = [] diff --git a/src/ptvsd/adapter/__main__.py b/src/ptvsd/adapter/__main__.py new file mode 100644 index 00000000..2476fdc7 --- /dev/null +++ b/src/ptvsd/adapter/__main__.py @@ -0,0 +1,13 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See LICENSE in the project root +# for license information. + +from __future__ import absolute_import, print_function, unicode_literals + + +def main(): + raise NotImplementedError + + +if __name__ == "__main__": + main() diff --git a/src/ptvsd/common/__init__.py b/src/ptvsd/common/__init__.py new file mode 100644 index 00000000..d1a64c66 --- /dev/null +++ b/src/ptvsd/common/__init__.py @@ -0,0 +1,8 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See LICENSE in the project root +# for license information. + +from __future__ import absolute_import, print_function, unicode_literals + + +__all__ = [] diff --git a/src/ptvsd/_util.py b/src/ptvsd/common/_util.py similarity index 100% rename from src/ptvsd/_util.py rename to src/ptvsd/common/_util.py diff --git a/src/ptvsd/compat.py b/src/ptvsd/common/compat.py similarity index 100% rename from src/ptvsd/compat.py rename to src/ptvsd/common/compat.py diff --git a/src/ptvsd/log.py b/src/ptvsd/common/log.py similarity index 100% rename from src/ptvsd/log.py rename to src/ptvsd/common/log.py diff --git a/src/ptvsd/messaging.py b/src/ptvsd/common/messaging.py similarity index 100% rename from src/ptvsd/messaging.py rename to src/ptvsd/common/messaging.py diff --git a/src/ptvsd/socket.py b/src/ptvsd/common/socket.py similarity index 100% rename from src/ptvsd/socket.py rename to src/ptvsd/common/socket.py diff --git a/src/ptvsd/server/__init__.py b/src/ptvsd/server/__init__.py new file mode 100644 index 00000000..3f61a899 --- /dev/null +++ b/src/ptvsd/server/__init__.py @@ -0,0 +1,7 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See LICENSE in the project root +# for license information. + +# "force_pydevd" must be imported first to ensure (via side effects) +# that the ptvsd-vendored copy of pydevd gets used. +import ptvsd._vendored.force_pydevd diff --git a/src/ptvsd/__main__.py b/src/ptvsd/server/__main__.py similarity index 100% rename from src/ptvsd/__main__.py rename to src/ptvsd/server/__main__.py diff --git a/src/ptvsd/_local.py b/src/ptvsd/server/_local.py similarity index 100% rename from src/ptvsd/_local.py rename to src/ptvsd/server/_local.py diff --git a/src/ptvsd/_remote.py b/src/ptvsd/server/_remote.py similarity index 100% rename from src/ptvsd/_remote.py rename to src/ptvsd/server/_remote.py diff --git a/src/ptvsd/attach_server.py b/src/ptvsd/server/attach_server.py similarity index 100% rename from src/ptvsd/attach_server.py rename to src/ptvsd/server/attach_server.py diff --git a/src/ptvsd/daemon.py b/src/ptvsd/server/daemon.py similarity index 100% rename from src/ptvsd/daemon.py rename to src/ptvsd/server/daemon.py diff --git a/src/ptvsd/debugger.py b/src/ptvsd/server/debugger.py similarity index 100% rename from src/ptvsd/debugger.py rename to src/ptvsd/server/debugger.py diff --git a/src/ptvsd/exit_handlers.py b/src/ptvsd/server/exit_handlers.py similarity index 100% rename from src/ptvsd/exit_handlers.py rename to src/ptvsd/server/exit_handlers.py diff --git a/src/ptvsd/futures.py b/src/ptvsd/server/futures.py similarity index 100% rename from src/ptvsd/futures.py rename to src/ptvsd/server/futures.py diff --git a/src/ptvsd/ipcjson.py b/src/ptvsd/server/ipcjson.py similarity index 100% rename from src/ptvsd/ipcjson.py rename to src/ptvsd/server/ipcjson.py diff --git a/src/ptvsd/multiproc.py b/src/ptvsd/server/multiproc.py similarity index 100% rename from src/ptvsd/multiproc.py rename to src/ptvsd/server/multiproc.py diff --git a/src/ptvsd/options.py b/src/ptvsd/server/options.py similarity index 100% rename from src/ptvsd/options.py rename to src/ptvsd/server/options.py diff --git a/src/ptvsd/pydevd_hooks.py b/src/ptvsd/server/pydevd_hooks.py similarity index 100% rename from src/ptvsd/pydevd_hooks.py rename to src/ptvsd/server/pydevd_hooks.py diff --git a/src/ptvsd/reraise.py b/src/ptvsd/server/reraise.py similarity index 100% rename from src/ptvsd/reraise.py rename to src/ptvsd/server/reraise.py diff --git a/src/ptvsd/reraise2.py b/src/ptvsd/server/reraise2.py similarity index 100% rename from src/ptvsd/reraise2.py rename to src/ptvsd/server/reraise2.py diff --git a/src/ptvsd/reraise3.py b/src/ptvsd/server/reraise3.py similarity index 100% rename from src/ptvsd/reraise3.py rename to src/ptvsd/server/reraise3.py diff --git a/src/ptvsd/runner.py b/src/ptvsd/server/runner.py similarity index 100% rename from src/ptvsd/runner.py rename to src/ptvsd/server/runner.py diff --git a/src/ptvsd/session.py b/src/ptvsd/server/session.py similarity index 100% rename from src/ptvsd/session.py rename to src/ptvsd/server/session.py diff --git a/src/ptvsd/wrapper.py b/src/ptvsd/server/wrapper.py similarity index 100% rename from src/ptvsd/wrapper.py rename to src/ptvsd/server/wrapper.py diff --git a/test_requirements.txt b/tests/requirements.txt similarity index 81% rename from test_requirements.txt rename to tests/requirements.txt index 1642cb6e..ca1a9b93 100644 --- a/test_requirements.txt +++ b/tests/requirements.txt @@ -1,12 +1,10 @@ colorama -coverage django requests flask psutil pygments pytest<5 -pytest-cov pytest-timeout pytest-xdist tox diff --git a/tox.ini b/tox.ini index e9a05030..a4f074ee 100644 --- a/tox.ini +++ b/tox.ini @@ -2,6 +2,6 @@ envlist = py{27,34,35,36,37} [testenv] -deps = -rtest_requirements.txt +deps = -rtests/requirements.txt commands = pytest {posargs:-vv} passenv = PTVSD_LOG_DIR