diff --git a/.vscode/extensions.json b/.vscode/extensions.json index f813aaf..c968d5a 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -123,14 +123,20 @@ "redhat.vscode-yaml", // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Markdown + // Markdown and reStructured Text // ----------------------------------------------------------------------- // - Markdown All in One "yzhang.markdown-all-in-one", // - Markdown PDF "yzane.markdown-pdf", // - markdownlint - "davidanson.vscode-markdownlint" + "davidanson.vscode-markdownlint", + // - Esbonio (conflicts with reStructuredText) + //"swyddfa.esbonio", + // - reStructuredText + "lextudio.restructuredtext", + // - reStructuredText Syntax highlighting + "trond-snekvik.simple-rst", // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CSS diff --git a/.vscode/launch.json b/.vscode/launch.json index 9197dd3..f2e658b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,13 +1,104 @@ { - "version": "0.2.0", - "configurations": [ + "version": "0.2.0", + "configurations": [ + { + // this will only work with a local python environment + "name": "L-py-file", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "justMyCode": true + }, + { + "name": "L-dj-server", + "type": "python", + "request": "launch", + "program": "${workspaceFolder}/src/manage.py", + "args": [ + "runserver", + ], + "django": true + }, + { + // launch local FastAPI on default port 8000 + // this will not work with a docker container + "name": "L-p8000-api-uvicorn", + "type": "python", + "request": "launch", + "module": "uvicorn", + "cwd": "${workspaceFolder}/src/api/", + "args": [ + "startup:app", + "--reload", + "--port", + "8000" + ], + "jinja": true, + "justMyCode": false + }, + { + //> Set PYDEVD_DISABLE_FILE_VALIDATION=1 + //> python -m debugpy --listen 8888 --wait-for-client startup.py + // then select this script and start debug (F5) + // finally, view FastAPI from the browser to hit breakpoints + // http://0.0.0.0:8000 + // http://0.0.0.0:8000/docs + // this is the default port 8000 + "name": "L-p8888-api-debugpy", + "type": "python", + "request": "attach", + "connect": { + "host": "localhost", + "port": 8888 + }, + "pathMappings": [ { - "name": "Python: Current File", - "type": "python", - "request": "launch", - "program": "${file}", - "console": "integratedTerminal", - "justMyCode": true + "localRoot": "${workspaceFolder}/src/api/", + "remoteRoot": "." } - ] + ], + "justMyCode": false + }, + { + "name": "C-p5678-app-debugpy", + "type": "python", + "request": "attach", + "connect": { + "host": "localhost", + "port": 5678 + }, + "pathMappings": [ + { + "localRoot": "${workspaceFolder}/src/app", + "remoteRoot": "." + } + ], + "justMyCode": false + }, + { + //> Set PYDEVD_DISABLE_FILE_VALIDATION=1 + // run the docker container that has this entrypoint that forwards to our local port 9988 + // entrypoint: [ "python", "-m", "debugpy", "--listen", "0.0.0.0:$FASTAPI_DOCKER_DEBUG_PORT", "--wait-for-client", "startup.py" ] + // then select this script and start debug (F5) + // finally, view FastAPI from the browser to hit breakpoints + // http://0.0.0.0:8011 + // http://0.0.0.0:8011/docs + // FASTAPI_LOCAL_PORT used to forward to container port to the local port 8011 + "name": "C-p9988-api-debugpy", + "type": "python", + "request": "attach", + "connect": { + "host": "localhost", + "port": 9988 + }, + "pathMappings": [ + { + "localRoot": "${workspaceFolder}/src/api/", + "remoteRoot": "." + } + ], + "justMyCode": false + }, + ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index ef5369f..7f8cbe3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,25 +1,37 @@ { + "python.pythonPath": "${workspaceFolder}/.env38/Scripts/python.exe", + // "workbench.colorCustomizations": { - "activityBar.activeBackground": "#5d98cd", - "activityBar.background": "#5d98cd", - "activityBar.foreground": "#15202b", - "activityBar.inactiveForeground": "#15202b99", - "activityBarBadge.background": "#f0cee0", - "activityBarBadge.foreground": "#15202b", + "activityBar.activeBackground": "#1e535f", + "activityBar.background": "#1e535f", + "activityBar.foreground": "#e7e7e7", + "activityBar.inactiveForeground": "#e7e7e799", + "activityBarBadge.background": "#300f2a", + "activityBarBadge.foreground": "#e7e7e7", "commandCenter.border": "#e7e7e799", - "sash.hoverBorder": "#5d98cd", - "statusBar.background": "#3a7fbd", + "sash.hoverBorder": "#1e535f", + "statusBar.background": "#123138", "statusBar.foreground": "#e7e7e7", - "statusBarItem.hoverBackground": "#5d98cd", - "statusBarItem.remoteBackground": "#3a7fbd", + "statusBarItem.hoverBackground": "#1e535f", + "statusBarItem.remoteBackground": "#123138", "statusBarItem.remoteForeground": "#e7e7e7", - "titleBar.activeBackground": "#3a7fbd", + "titleBar.activeBackground": "#123138", "titleBar.activeForeground": "#e7e7e7", - "titleBar.inactiveBackground": "#3a7fbd99", + "titleBar.inactiveBackground": "#12313899", "titleBar.inactiveForeground": "#e7e7e799" }, - "python.testing.unittestArgs": ["-v", "-s", "./tests", "-p", "test_*.py"], - "python.testing.pytestEnabled": false, + //JWL4-BlueGreen + "peacock.color": "#123138", + // + // reStructuredText, root ReadMe.rst + //"esbonio.sphinx.confDir": "", + // + // test + "python.testing.pytestArgs": [ + "src", + "tests", + ], "python.testing.unittestEnabled": true, - "peacock.color": "#3a7fbd" + "python.testing.pytestEnabled": false, + "esbonio.sphinx.confDir": "", } diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 3229623..1c3d1e6 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -77,7 +77,7 @@ Ready to contribute? Here's how to set up `pipreqs` for local development. 5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:: $ flake8 pipreqs tests - $ python setup.py test > pipreqs_setup_test_result.txt + $ python setup.py test $ tox To get flake8 and tox, just pip install them into your virtualenv. (or $pip install -r requirements-dev.txt) @@ -85,6 +85,7 @@ Ready to contribute? Here's how to set up `pipreqs` for local development. You may also need to provide `CA_BUNDLE` as an environment variable or parameter in the `tests/.env.test` file. $ export CA_BUNDLE="/certs/path/certificates.pem" # for nix OS + $ set CA_BUNDLE="C:/certs/path/certificates.pem" # for win OS 6. Commit your changes and push your branch to GitHub:: diff --git a/requirements-dev.txt b/requirements-dev.txt index 322f7d9..2c8fdbd 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -17,6 +17,9 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # fix_SSLError tests.settings (optional) use of .env file # alternative would be to set CA_BUNDLE environment variable +# $ export CA_BUNDLE="/certs/path/certificates.pem" # for nix OS +# $ set CA_BUNDLE="C:/certs/path/certificates.pem" # for win OS + python-dotenv # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -25,8 +28,9 @@ flake8 tox # only needed in the environment from which tox is run # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# (optional, personal choice) +# (optional) # vscode settings: "python.formatting.provider": "black", #black +docutils # reStructured Text support # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/test_pipreqs.py b/tests/test_pipreqs.py index 1b3ff5e..3b2c49c 100644 --- a/tests/test_pipreqs.py +++ b/tests/test_pipreqs.py @@ -6,6 +6,11 @@ test_pipreqs ---------------------------------- Tests for `pipreqs` module. + +Environment variables used to mock arguments +e.g., +$ set CA_BUNDLE="certificates.pem" # for win OS +$ export CA_BUNDLE="certificates.pem" # for nix OS """ import os