Docs - Add config and docs for development experience (#155)

Add config and docs for development experience.

__Major Revision__
- Add settings and extensions config for VSCode.
- Add devcontainer config for Codespaces.
- Update document accordingly.
This commit is contained in:
Yifan Xiong 2021-08-16 13:49:19 +08:00 коммит произвёл GitHub
Родитель 7293e783f1
Коммит 96fc4d09dd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 128 добавлений и 6 удалений

Просмотреть файл

@ -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"
}

Просмотреть файл

@ -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

Просмотреть файл

@ -14,12 +14,8 @@ max_line_length = 120
[*.{js,jsx,ts,tsx,md,mdx,css}] [*.{js,jsx,ts,tsx,md,mdx,css}]
indent_size = 2 indent_size = 2
[*.{yml,yaml}] [*.{yml,yaml,json}]
indent_size = 2 indent_size = 2
[*.json]
indent_size = 2
insert_final_newline = false
[{*.mk,Makefile}] [{*.mk,Makefile}]
indent_style = tab indent_style = tab

8
.vscode/extensions.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,8 @@
{
"recommendations": [
"editorconfig.editorconfig",
"ms-python.python",
"ms-python.vscode-pylance",
"njpwerner.autodocstring"
]
}

35
.vscode/launch.json поставляемый Normal file
Просмотреть файл

@ -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": [
"<node_internals>/**"
],
"cwd": "${workspaceFolder}/website",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"start"
],
"serverReadyAction": {
"action": "openExternally",
"pattern": "Docusaurus website is running at \"(.*?)\"",
"uriFormat": "%s"
}
}
]
}

9
.vscode/settings.json поставляемый Normal file
Просмотреть файл

@ -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
}

Просмотреть файл

@ -6,6 +6,9 @@ id: development
If you want to develop new feature, please follow below steps to set up development environment. 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 ## Check Environment
Follow [System Requirements](../getting-started/installation.md). 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. Please install `pre-commit` before `git commit` to run all pre-checks.
```bash ```bash
pre-commit install pre-commit install --install-hooks
``` ```
Open a pull request to main branch on GitHub. Open a pull request to main branch on GitHub.