diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..9237249a --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,55 @@ +{ + "name": "GitHub Codespaces for SuperBench", + "image": "mcr.microsoft.com/vscode/devcontainers/universal:linux", + "settings": { + "go.toolsManagement.checkForUpdates": "local", + "go.useLanguageServer": true, + "go.gopath": "/go", + "go.goroot": "/usr/local/go", + "python.pythonPath": "/opt/python/latest/bin/python", + "python.linting.enabled": true, + "python.linting.pylintEnabled": true, + "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", + "python.formatting.blackPath": "/usr/local/py-utils/bin/black", + "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", + "python.linting.banditPath": "/usr/local/py-utils/bin/bandit", + "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8", + "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", + "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", + "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", + "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint", + "lldb.executable": "/usr/bin/lldb", + "files.watcherExclude": { + "**/target/**": true + }, + "workbench.iconTheme": "vscode-icons" + }, + "remoteUser": "codespace", + "overrideCommand": false, + "mounts": [ + "source=codespaces-linux-var-lib-docker,target=/var/lib/docker,type=volume" + ], + "runArgs": [ + "--cap-add=SYS_PTRACE", + "--security-opt", + "seccomp=unconfined", + "--privileged", + "--init" + ], + "extensions": [ + "gitHub.vscode-pull-request-github", + "editorconfig.editorconfig", + "ms-python.python", + "ms-python.vscode-pylance", + "njpwerner.autodocstring", + "eamodio.gitlens", + "vscode-icons-team.vscode-icons" + ], + "forwardPorts": [ + 3000 + ], + "remoteEnv": { + "SB_TEST_CUDA": "0" + }, + "postCreateCommand": "bash ./.devcontainer/post-create-command.sh" +} diff --git a/.devcontainer/post-create-command.sh b/.devcontainer/post-create-command.sh new file mode 100644 index 00000000..413da260 --- /dev/null +++ b/.devcontainer/post-create-command.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e +export PATH=${HOME}/.local/bin:${PATH} + +# install python packages +pip install .[dev,test,torch] --user --no-cache-dir --progress-bar=off --use-feature=in-tree-build +pre-commit install --install-hooks + +# install nodejs packages +cd website +npm install --no-progress +cd - + +# try superbench cli +sb diff --git a/.editorconfig b/.editorconfig index e72a065d..7318851e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -14,12 +14,8 @@ max_line_length = 120 [*.{js,jsx,ts,tsx,md,mdx,css}] indent_size = 2 -[*.{yml,yaml}] +[*.{yml,yaml,json}] indent_size = 2 -[*.json] -indent_size = 2 -insert_final_newline = false - [{*.mk,Makefile}] indent_style = tab diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..12c94003 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + "recommendations": [ + "editorconfig.editorconfig", + "ms-python.python", + "ms-python.vscode-pylance", + "njpwerner.autodocstring" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..5eb4e2a7 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,35 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Run Unit Tests", + "type": "python", + "request": "launch", + "cwd": "${workspaceFolder}", + "program": "setup.py", + "args": [ + "test" + ], + "console": "integratedTerminal" + }, + { + "name": "Build Website", + "type": "node", + "request": "launch", + "skipFiles": [ + "/**" + ], + "cwd": "${workspaceFolder}/website", + "runtimeExecutable": "npm", + "runtimeArgs": [ + "run-script", + "start" + ], + "serverReadyAction": { + "action": "openExternally", + "pattern": "Docusaurus website is running at \"(.*?)\"", + "uriFormat": "%s" + } + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..6a0ee151 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "editor.formatOnSave": true, + "editor.wordWrap": "on", + "python.autoComplete.addBrackets": true, + "python.formatting.provider": "yapf", + "python.linting.flake8Enabled": true, + "python.linting.mypyEnabled": true, + "python.analysis.completeFunctionParens": true +} diff --git a/docs/developer-guides/development.md b/docs/developer-guides/development.md index e55ee868..b2451506 100644 --- a/docs/developer-guides/development.md +++ b/docs/developer-guides/development.md @@ -6,6 +6,9 @@ id: development If you want to develop new feature, please follow below steps to set up development environment. +We suggest you to use [Visual Studio Code](https://vscode.github.com/) and install the recommended extensions for this project. +You can also develop online with [GitHub Codespaces](https://github.com/codespaces). + ## Check Environment Follow [System Requirements](../getting-started/installation.md). @@ -41,7 +44,7 @@ python3 setup.py test Please install `pre-commit` before `git commit` to run all pre-checks. ```bash -pre-commit install +pre-commit install --install-hooks ``` Open a pull request to main branch on GitHub.