From d9f4545f4f2606bca0e9d398e80082e31805362d Mon Sep 17 00:00:00 2001 From: Daniel Ciborowski Date: Thu, 16 Mar 2023 20:06:53 -0400 Subject: [PATCH] Add basic codespace configuration for development (#304) Co-authored-by: Karthik Nadig --- .devcontainer/Dockerfile | 15 +++ .devcontainer/devcontainer.json | 36 ++++++ .gitignore | 3 +- .pylintrc | 4 - .vscode/settings.json | 31 +++++- dev-requirements.in | 14 +++ dev-requirements.txt | 188 ++++++++++++++++++++++++++++++++ pyproject.toml | 57 ++++++++++ 8 files changed, 340 insertions(+), 8 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json delete mode 100644 .pylintrc create mode 100644 dev-requirements.in create mode 100644 dev-requirements.txt create mode 100644 pyproject.toml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..35d08372 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,15 @@ +FROM mcr.microsoft.com/devcontainers/python:3.7 + +RUN python -m pip install --upgrade pip + +COPY dev-requirements.txt ./ +RUN python -m pip install -r dev-requirements.txt \ + && rm dev-requirements.txt + +COPY requirements.txt ./ +RUN python -m pip install -r requirements.txt \ + && rm requirements.txt + +COPY src/test/python_tests/requirements.txt . +RUN python -m pip install -r requirements.txt \ + && rm requirements.txt diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..0d1b3338 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,36 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.222.0/containers/python-3-miniconda +{ + "name": "Python Environment", + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, + "customizations": { + "vscode": { + "extensions": [ + "amodio.tsl-problem-matcher", + "bungcip.better-toml", + "cschleiden.vscode-github-actions", + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "editorconfig.editorconfig", + "GitHub.copilot", + "github.vscode-pull-request-github", + "ms-azuretools.vscode-docker", + "ms-python.python", + "ms-python.vscode-pylance", + "ms-python.pylint", + "ms-python.isort", + "ms-python.flake8", + "ms-python.black-formatter@prerelease", + "ms-vsliveshare.vsliveshare", + "ms-vscode-remote.remote-containers" + ], + "settings": { + "python.defaultInterpreterPath": "/usr/local/bin/python" + } + } + }, + "postCreateCommand": "nox --session setup" +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index ffe0c9cb..8e76013e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ node_modules bundled/libs/ **/__pycache__ **/.pytest_cache -**/.vs \ No newline at end of file +**/.vs +src/test/python_tests/test_data/sample1/*.py diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index 862dd140..00000000 --- a/.pylintrc +++ /dev/null @@ -1,4 +0,0 @@ -[MESSAGES CONTROL] -disable= - duplicate-code, - import-outside-toplevel diff --git a/.vscode/settings.json b/.vscode/settings.json index 0808753d..2c7d9733 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,9 +10,34 @@ }, // Turn off tsc task auto detection since we have the necessary tasks as npm scripts "typescript.tsc.autoDetect": "off", - "python.testing.pytestArgs": ["src/test/python_tests"], + "editor.formatOnSave": true, + "editor.formatOnPaste": true, + "files.trimTrailingWhitespace": true, + "files.autoSave": "onFocusChange", + "git.autofetch": true, + "githubPullRequests.pullBranch": "always", + "[jsonc]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[python]": { + "editor.defaultFormatter": "ms-python.black-formatter" + }, + "python.testing.pytestArgs": [ + "src/test/python_tests" + ], "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true, "python.testing.cwd": "${workspaceFolder}", - "editor.formatOnSave": true -} + "pylint.args": [ + "--rcfile=pyproject.toml" + ], + "black-formatter.args": [ + "--config=pyproject.toml" + ], + "flake8.args": [ + "--toml-config=pyproject.toml" + ], + "isort.args": [ + "--settings-path=pyproject.toml" + ] +} \ No newline at end of file diff --git a/dev-requirements.in b/dev-requirements.in new file mode 100644 index 00000000..f76a77fd --- /dev/null +++ b/dev-requirements.in @@ -0,0 +1,14 @@ +# This file is used to generate requirements.txt. +# To update requirements.txt, run the following commands. +# Use Python 3.7 when creating the environment or using pip-tools +# --resolver=backtracking is required because current flake8 expects Python >= 3.8.1 +# 1) pip install pip-tools +# 2) pip-compile --generate-hashes --upgrade ./dev-requirements.in --resolver=backtracking + +black +flake8 +flake8-pyproject +isort +nox +pip-tools +wheel diff --git a/dev-requirements.txt b/dev-requirements.txt new file mode 100644 index 00000000..213a50cd --- /dev/null +++ b/dev-requirements.txt @@ -0,0 +1,188 @@ +# +# This file is autogenerated by pip-compile with Python 3.7 +# by the following command: +# +# pip-compile --generate-hashes --resolver=backtracking ./dev-requirements.in +# +argcomplete==2.1.1 \ + --hash=sha256:17041f55b8c45099428df6ce6d0d282b892471a78c71375d24f227e21c13f8c5 \ + --hash=sha256:72e08340852d32544459c0c19aad1b48aa2c3a96de8c6e5742456b4f538ca52f + # via nox +black==23.1.0 \ + --hash=sha256:0052dba51dec07ed029ed61b18183942043e00008ec65d5028814afaab9a22fd \ + --hash=sha256:0680d4380db3719ebcfb2613f34e86c8e6d15ffeabcf8ec59355c5e7b85bb555 \ + --hash=sha256:121ca7f10b4a01fd99951234abdbd97728e1240be89fde18480ffac16503d481 \ + --hash=sha256:162e37d49e93bd6eb6f1afc3e17a3d23a823042530c37c3c42eeeaf026f38468 \ + --hash=sha256:2a951cc83ab535d248c89f300eccbd625e80ab880fbcfb5ac8afb5f01a258ac9 \ + --hash=sha256:2bf649fda611c8550ca9d7592b69f0637218c2369b7744694c5e4902873b2f3a \ + --hash=sha256:382998821f58e5c8238d3166c492139573325287820963d2f7de4d518bd76958 \ + --hash=sha256:49f7b39e30f326a34b5c9a4213213a6b221d7ae9d58ec70df1c4a307cf2a1580 \ + --hash=sha256:57c18c5165c1dbe291d5306e53fb3988122890e57bd9b3dcb75f967f13411a26 \ + --hash=sha256:7a0f701d314cfa0896b9001df70a530eb2472babb76086344e688829efd97d32 \ + --hash=sha256:8178318cb74f98bc571eef19068f6ab5613b3e59d4f47771582f04e175570ed8 \ + --hash=sha256:8b70eb40a78dfac24842458476135f9b99ab952dd3f2dab738c1881a9b38b753 \ + --hash=sha256:9880d7d419bb7e709b37e28deb5e68a49227713b623c72b2b931028ea65f619b \ + --hash=sha256:9afd3f493666a0cd8f8df9a0200c6359ac53940cbde049dcb1a7eb6ee2dd7074 \ + --hash=sha256:a29650759a6a0944e7cca036674655c2f0f63806ddecc45ed40b7b8aa314b651 \ + --hash=sha256:a436e7881d33acaf2536c46a454bb964a50eff59b21b51c6ccf5a40601fbef24 \ + --hash=sha256:a59db0a2094d2259c554676403fa2fac3473ccf1354c1c63eccf7ae65aac8ab6 \ + --hash=sha256:a8471939da5e824b891b25751955be52ee7f8a30a916d570a5ba8e0f2eb2ecad \ + --hash=sha256:b0bd97bea8903f5a2ba7219257a44e3f1f9d00073d6cc1add68f0beec69692ac \ + --hash=sha256:b6a92a41ee34b883b359998f0c8e6eb8e99803aa8bf3123bf2b2e6fec505a221 \ + --hash=sha256:bb460c8561c8c1bec7824ecbc3ce085eb50005883a6203dcfb0122e95797ee06 \ + --hash=sha256:bfffba28dc52a58f04492181392ee380e95262af14ee01d4bc7bb1b1c6ca8d27 \ + --hash=sha256:c1c476bc7b7d021321e7d93dc2cbd78ce103b84d5a4cf97ed535fbc0d6660648 \ + --hash=sha256:c91dfc2c2a4e50df0026f88d2215e166616e0c80e86004d0003ece0488db2739 \ + --hash=sha256:e6663f91b6feca5d06f2ccd49a10f254f9298cc1f7f49c46e498a0771b507104 + # via -r ./dev-requirements.in +build==0.10.0 \ + --hash=sha256:af266720050a66c893a6096a2f410989eeac74ff9a68ba194b3f6473e8e26171 \ + --hash=sha256:d5b71264afdb5951d6704482aac78de887c80691c52b88a9ad195983ca2c9269 + # via pip-tools +click==8.1.3 \ + --hash=sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e \ + --hash=sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48 + # via + # black + # pip-tools +colorlog==6.7.0 \ + --hash=sha256:0d33ca236784a1ba3ff9c532d4964126d8a2c44f1f0cb1d2b0728196f512f662 \ + --hash=sha256:bd94bd21c1e13fac7bd3153f4bc3a7dc0eb0974b8bc2fdf1a989e474f6e582e5 + # via nox +distlib==0.3.6 \ + --hash=sha256:14bad2d9b04d3a36127ac97f30b12a19268f211063d8f8ee4f47108896e11b46 \ + --hash=sha256:f35c4b692542ca110de7ef0bea44d73981caeb34ca0b9b6b2e6d7790dda8f80e + # via virtualenv +filelock==3.10.0 \ + --hash=sha256:3199fd0d3faea8b911be52b663dfccceb84c95949dd13179aa21436d1a79c4ce \ + --hash=sha256:e90b34656470756edf8b19656785c5fea73afa1953f3e1b0d645cef11cab3182 + # via virtualenv +flake8==5.0.4 \ + --hash=sha256:6fbe320aad8d6b95cec8b8e47bc933004678dc63095be98528b7bdd2a9f510db \ + --hash=sha256:7a1cf6b73744f5806ab95e526f6f0d8c01c66d7bbe349562d22dfca20610b248 + # via + # -r ./dev-requirements.in + # flake8-pyproject +flake8-pyproject==1.2.2 \ + --hash=sha256:52d412219e7db6227faa654675b1435947b11d49b453f3eced760f19bdd6f06a + # via -r ./dev-requirements.in +importlib-metadata==4.2.0 \ + --hash=sha256:057e92c15bc8d9e8109738a48db0ccb31b4d9d5cfbee5a8670879a30be66304b \ + --hash=sha256:b7e52a1f8dec14a75ea73e0891f3060099ca1d8e6a462a4dff11c3e119ea1b31 + # via + # argcomplete + # build + # click + # flake8 + # nox + # virtualenv +isort==5.11.5 \ + --hash=sha256:6be1f76a507cb2ecf16c7cf14a37e41609ca082330be4e3436a18ef74add55db \ + --hash=sha256:ba1d72fb2595a01c7895a5128f9585a5cc4b6d395f1c8d514989b9a7eb2a8746 + # via -r ./dev-requirements.in +mccabe==0.7.0 \ + --hash=sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325 \ + --hash=sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e + # via flake8 +mypy-extensions==1.0.0 \ + --hash=sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d \ + --hash=sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782 + # via black +nox==2022.11.21 \ + --hash=sha256:0e41a990e290e274cb205a976c4c97ee3c5234441a8132c8c3fd9ea3c22149eb \ + --hash=sha256:e21c31de0711d1274ca585a2c5fde36b1aa962005ba8e9322bf5eeed16dcd684 + # via -r ./dev-requirements.in +packaging==23.0 \ + --hash=sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2 \ + --hash=sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97 + # via + # black + # build + # nox +pathspec==0.11.1 \ + --hash=sha256:2798de800fa92780e33acca925945e9a19a133b715067cf165b8866c15a31687 \ + --hash=sha256:d8af70af76652554bd134c22b3e8a1cc46ed7d91edcdd721ef1a0c51a84a5293 + # via black +pip-tools==6.12.3 \ + --hash=sha256:480d44fae6e09fad3f9bd3d0a7e8423088715d10477e8ef0663440db25e3114f \ + --hash=sha256:8510420f46572b2e26c357541390593d9365eb6edd2d1e7505267910ecaec080 + # via -r ./dev-requirements.in +platformdirs==2.6.2 \ + --hash=sha256:83c8f6d04389165de7c9b6f0c682439697887bca0aa2f1c87ef1826be3584490 \ + --hash=sha256:e1fea1fe471b9ff8332e229df3cb7de4f53eeea4998d3b6bfff542115e998bd2 + # via + # black + # virtualenv +pycodestyle==2.9.1 \ + --hash=sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785 \ + --hash=sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b + # via flake8 +pyflakes==2.5.0 \ + --hash=sha256:4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2 \ + --hash=sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3 + # via flake8 +pyproject-hooks==1.0.0 \ + --hash=sha256:283c11acd6b928d2f6a7c73fa0d01cb2bdc5f07c57a2eeb6e83d5e56b97976f8 \ + --hash=sha256:f271b298b97f5955d53fb12b72c1fb1948c22c1a6b70b315c54cedaca0264ef5 + # via build +tomli==2.0.1 \ + --hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \ + --hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f + # via + # black + # build + # flake8-pyproject + # pyproject-hooks +typed-ast==1.5.4 \ + --hash=sha256:0261195c2062caf107831e92a76764c81227dae162c4f75192c0d489faf751a2 \ + --hash=sha256:0fdbcf2fef0ca421a3f5912555804296f0b0960f0418c440f5d6d3abb549f3e1 \ + --hash=sha256:183afdf0ec5b1b211724dfef3d2cad2d767cbefac291f24d69b00546c1837fb6 \ + --hash=sha256:211260621ab1cd7324e0798d6be953d00b74e0428382991adfddb352252f1d62 \ + --hash=sha256:267e3f78697a6c00c689c03db4876dd1efdfea2f251a5ad6555e82a26847b4ac \ + --hash=sha256:2efae9db7a8c05ad5547d522e7dbe62c83d838d3906a3716d1478b6c1d61388d \ + --hash=sha256:370788a63915e82fd6f212865a596a0fefcbb7d408bbbb13dea723d971ed8bdc \ + --hash=sha256:39e21ceb7388e4bb37f4c679d72707ed46c2fbf2a5609b8b8ebc4b067d977df2 \ + --hash=sha256:3e123d878ba170397916557d31c8f589951e353cc95fb7f24f6bb69adc1a8a97 \ + --hash=sha256:4879da6c9b73443f97e731b617184a596ac1235fe91f98d279a7af36c796da35 \ + --hash=sha256:4e964b4ff86550a7a7d56345c7864b18f403f5bd7380edf44a3c1fb4ee7ac6c6 \ + --hash=sha256:639c5f0b21776605dd6c9dbe592d5228f021404dafd377e2b7ac046b0349b1a1 \ + --hash=sha256:669dd0c4167f6f2cd9f57041e03c3c2ebf9063d0757dc89f79ba1daa2bfca9d4 \ + --hash=sha256:6778e1b2f81dfc7bc58e4b259363b83d2e509a65198e85d5700dfae4c6c8ff1c \ + --hash=sha256:683407d92dc953c8a7347119596f0b0e6c55eb98ebebd9b23437501b28dcbb8e \ + --hash=sha256:79b1e0869db7c830ba6a981d58711c88b6677506e648496b1f64ac7d15633aec \ + --hash=sha256:7d5d014b7daa8b0bf2eaef684295acae12b036d79f54178b92a2b6a56f92278f \ + --hash=sha256:98f80dee3c03455e92796b58b98ff6ca0b2a6f652120c263efdba4d6c5e58f72 \ + --hash=sha256:a94d55d142c9265f4ea46fab70977a1944ecae359ae867397757d836ea5a3f47 \ + --hash=sha256:a9916d2bb8865f973824fb47436fa45e1ebf2efd920f2b9f99342cb7fab93f72 \ + --hash=sha256:c542eeda69212fa10a7ada75e668876fdec5f856cd3d06829e6aa64ad17c8dfe \ + --hash=sha256:cf4afcfac006ece570e32d6fa90ab74a17245b83dfd6655a6f68568098345ff6 \ + --hash=sha256:ebd9d7f80ccf7a82ac5f88c521115cc55d84e35bf8b446fcd7836eb6b98929a3 \ + --hash=sha256:ed855bbe3eb3715fca349c80174cfcfd699c2f9de574d40527b8429acae23a66 + # via black +typing-extensions==4.5.0 \ + --hash=sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb \ + --hash=sha256:fb33085c39dd998ac16d1431ebc293a8b3eedd00fd4a32de0ff79002c19511b4 + # via + # black + # importlib-metadata + # nox + # platformdirs +virtualenv==20.16.2 \ + --hash=sha256:0ef5be6d07181946891f5abc8047fda8bc2f0b4b9bf222c64e6e8963baee76db \ + --hash=sha256:635b272a8e2f77cb051946f46c60a54ace3cb5e25568228bd6b57fc70eca9ff3 + # via nox +wheel==0.40.0 \ + --hash=sha256:cd1196f3faee2b31968d626e1731c94f99cbdb67cf5a46e4f5656cbee7738873 \ + --hash=sha256:d236b20e7cb522daf2390fa84c55eea81c5c30190f90f29ae2ca1ad8355bf247 + # via + # -r ./dev-requirements.in + # pip-tools +zipp==3.15.0 \ + --hash=sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b \ + --hash=sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556 + # via importlib-metadata + +# WARNING: The following packages were not pinned, but pip requires them to be +# pinned when the requirements file includes hashes. Consider using the --allow-unsafe flag. +# pip +# setuptools diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..d522818f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,57 @@ +[tool.black] +line_length = 88 + +[tool.flake8] +max-line-length = 99 +select = "F,E,W,B,B901,B902,B903" +exclude = [ + ".eggs", + ".git", + ".tox", + "nssm", + "obj", + "out", + "packages", + "pywin32", + "tests", + "swagger_client" +] +ignore = [ + "E722", + "B001", + "W503", + "E203", + "E402" +] + +[tool.isort] +multi_line_output = 3 +line_length = 99 +include_trailing_comma = true + +[tool.pylint.'FORMAT'] +max-line-length=99 + +[tool.pylint.'MESSAGES CONTROL'] +disable= [ + "bare-except", + "broad-except", + "consider-using-with", + "consider-using-generator", + "duplicate-code", + "import-outside-toplevel", + "invalid-name", + "import-error", + "too-few-public-methods", + "too-many-arguments", + "too-many-branches", + "too-many-instance-attributes", + "unspecified-encoding", + "wrong-import-position", +] + +[tool.pyright] +reportOptionalMemberAccess = false +reportGeneralTypeIssues = false +reportOptionalSubscript = false +reportUnboundVariable = false